From: Jeremy Allison Date: Tue, 5 Apr 2022 02:48:25 +0000 (-0700) Subject: s3: smbd: Move reply_findclose() from trans2.c to smb1_reply.c X-Git-Tag: tevent-0.12.0~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=481b7bfd298b8dd555271eff49fbd31aa661736a;p=thirdparty%2Fsamba.git s3: smbd: Move reply_findclose() from trans2.c to smb1_reply.c Signed-off-by: Jeremy Allison Reviewed-by: David Mulder --- diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index b03ecc77915..64d74ad0c4d 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1108,7 +1108,6 @@ NTSTATUS smb_set_file_time(connection_struct *conn, struct smb_filename *smb_fname, struct smb_file_time *ft, bool setting_write_time); -void reply_findclose(struct smb_request *req); void reply_findnclose(struct smb_request *req); enum perm_type { diff --git a/source3/smbd/smb1_reply.c b/source3/smbd/smb1_reply.c index a790b4bcfb8..82da0257ba9 100644 --- a/source3/smbd/smb1_reply.c +++ b/source3/smbd/smb1_reply.c @@ -6641,3 +6641,47 @@ void reply_getattrE(struct smb_request *req) END_PROFILE(SMBgetattrE); return; } + +/**************************************************************************** + Reply to a SMBfindclose (stop trans2 directory search). +****************************************************************************/ + +void reply_findclose(struct smb_request *req) +{ + int dptr_num; + struct smbd_server_connection *sconn = req->sconn; + files_struct *fsp = NULL; + + START_PROFILE(SMBfindclose); + + if (req->wct < 1) { + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + END_PROFILE(SMBfindclose); + return; + } + + dptr_num = SVALS(req->vwv+0, 0); + + DEBUG(3,("reply_findclose, dptr_num = %d\n", dptr_num)); + + /* + * OS/2 seems to use -1 to indicate "close all directories" + * This has to mean on this specific connection struct. + */ + if (dptr_num == -1) { + dptr_closecnum(req->conn); + } else { + fsp = dptr_fetch_lanman2_fsp(sconn, dptr_num); + dptr_num = -1; + if (fsp != NULL) { + close_file_free(NULL, &fsp, NORMAL_CLOSE); + } + } + + reply_outbuf(req, 0, 0); + + DEBUG(3,("SMBfindclose dptr_num = %d\n", dptr_num)); + + END_PROFILE(SMBfindclose); + return; +} diff --git a/source3/smbd/smb1_reply.h b/source3/smbd/smb1_reply.h index c306d1d726a..e66e9603cce 100644 --- a/source3/smbd/smb1_reply.h +++ b/source3/smbd/smb1_reply.h @@ -76,3 +76,4 @@ void reply_setattrE(struct smb_request *req); void reply_writebmpx(struct smb_request *req); void reply_writebs(struct smb_request *req); void reply_getattrE(struct smb_request *req); +void reply_findclose(struct smb_request *req); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 27bda1555f5..53d165b7071 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -6947,50 +6947,6 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn, return NT_STATUS_OK; } -/**************************************************************************** - Reply to a SMBfindclose (stop trans2 directory search). -****************************************************************************/ - -void reply_findclose(struct smb_request *req) -{ - int dptr_num; - struct smbd_server_connection *sconn = req->sconn; - files_struct *fsp = NULL; - - START_PROFILE(SMBfindclose); - - if (req->wct < 1) { - reply_nterror(req, NT_STATUS_INVALID_PARAMETER); - END_PROFILE(SMBfindclose); - return; - } - - dptr_num = SVALS(req->vwv+0, 0); - - DEBUG(3,("reply_findclose, dptr_num = %d\n", dptr_num)); - - /* - * OS/2 seems to use -1 to indicate "close all directories" - * This has to mean on this specific connection struct. - */ - if (dptr_num == -1) { - dptr_closecnum(req->conn); - } else { - fsp = dptr_fetch_lanman2_fsp(sconn, dptr_num); - dptr_num = -1; - if (fsp != NULL) { - close_file_free(NULL, &fsp, NORMAL_CLOSE); - } - } - - reply_outbuf(req, 0, 0); - - DEBUG(3,("SMBfindclose dptr_num = %d\n", dptr_num)); - - END_PROFILE(SMBfindclose); - return; -} - /**************************************************************************** Reply to a SMBfindnclose (stop FINDNOTIFYFIRST directory search). ****************************************************************************/