]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Return newname from smb2_parse_file_rename_information()
authorVolker Lendecke <vl@samba.org>
Wed, 17 Sep 2025 22:46:37 +0000 (15:46 -0700)
committerRalph Boehme <slow@samba.org>
Tue, 21 Oct 2025 17:33:29 +0000 (17:33 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/proto.h
source3/smbd/smb2_setinfo.c
source3/smbd/smb2_trans2.c

index b9e598810c30d35ad3505a713da0c30df76ea9c1..ee2d8294a105c7bea32cd27a1968cc67cf4542e6 100644 (file)
@@ -1136,17 +1136,19 @@ NTSTATUS smb_set_fsquota(connection_struct *conn,
                         files_struct *fsp,
                         const DATA_BLOB *qdata);
 
-NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
-                                           struct connection_struct *conn,
-                                           struct smb_request *req,
-                                           const char *pdata,
-                                           int total_data,
-                                           files_struct *fsp,
-                                           struct smb_filename *smb_fname_src,
-                                           bool *overwrite,
-                                           struct files_struct **_dst_dirfsp,
-                                           struct smb_filename **_smb_fname_dst,
-                                           char **_dst_original_lcomp);
+NTSTATUS smb2_parse_file_rename_information(
+       TALLOC_CTX *ctx,
+       struct connection_struct *conn,
+       struct smb_request *req,
+       const char *pdata,
+       int total_data,
+       files_struct *fsp,
+       struct smb_filename *smb_fname_src,
+       char **_newname,
+       bool *overwrite,
+       struct files_struct **_dst_dirfsp,
+       struct smb_filename **_smb_fname_dst,
+       char **_dst_original_lcomp);
 
 /* The following definitions come from smbd/uid.c  */
 
index b6256907c9c2ff39b255ecc941e2fba449c05c9a..522e10e92f6d34eceea4277679578ad60081922e 100644 (file)
@@ -577,6 +577,7 @@ static void smbd_smb2_setinfo_rename_dst_check(struct tevent_req *req)
                req, struct smbd_smb2_setinfo_state);
        struct tevent_req *subreq = NULL;
        struct timeval timeout;
+       char *newname = NULL;
        bool overwrite = false;
        struct files_struct *fsp = state->fsp;
        struct files_struct *dst_dirfsp = NULL;
@@ -601,6 +602,7 @@ static void smbd_smb2_setinfo_rename_dst_check(struct tevent_req *req)
                                                    state->data.length,
                                                    fsp,
                                                    fsp->fsp_name,
+                                                   &newname,
                                                    &overwrite,
                                                    &dst_dirfsp,
                                                    &smb_fname_dst,
@@ -788,6 +790,7 @@ static void smbd_smb2_setinfo_rename_dst_parent_check(struct tevent_req *req)
                req, struct smbd_smb2_setinfo_state);
        struct tevent_req *subreq = NULL;
        struct timeval timeout;
+       char *newname = NULL;
        bool overwrite = false;
        struct files_struct *fsp = state->fsp;
        struct files_struct *dst_parent_dirfsp = NULL;
@@ -813,6 +816,7 @@ static void smbd_smb2_setinfo_rename_dst_parent_check(struct tevent_req *req)
                                                    state->data.length,
                                                    fsp,
                                                    fsp->fsp_name,
+                                                   &newname,
                                                    &overwrite,
                                                    &dst_parent_dirfsp,
                                                    &smb_fname_dst,
index 13b3689197fa86f5dfcc4a892f44eb6e61a48ccd..f5d2737e01b2970db9e8c40e076bd54815af0de0 100644 (file)
@@ -4237,17 +4237,19 @@ static NTSTATUS smb_file_mode_information(connection_struct *conn,
  Deal with SMB2_FILE_RENAME_INFORMATION_INTERNAL
 ****************************************************************************/
 
-NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
-                                           struct connection_struct *conn,
-                                           struct smb_request *req,
-                                           const char *pdata,
-                                           int total_data,
-                                           files_struct *fsp,
-                                           struct smb_filename *smb_fname_src,
-                                           bool *_overwrite,
-                                           struct files_struct **_dst_dirfsp,
-                                           struct smb_filename **_smb_fname_dst,
-                                           char **_dst_original_lcomp)
+NTSTATUS smb2_parse_file_rename_information(
+       TALLOC_CTX *ctx,
+       struct connection_struct *conn,
+       struct smb_request *req,
+       const char *pdata,
+       int total_data,
+       files_struct *fsp,
+       struct smb_filename *smb_fname_src,
+       char **_newname,
+       bool *_overwrite,
+       struct files_struct **_dst_dirfsp,
+       struct smb_filename **_smb_fname_dst,
+       char **_dst_original_lcomp)
 {
        char *newname = NULL;
        struct files_struct *dst_dirfsp = NULL;
@@ -4339,6 +4341,7 @@ NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
        }
 
 done:
+       *_newname = newname;
        *_overwrite = overwrite;
        *_dst_dirfsp = dst_dirfsp;
        *_smb_fname_dst = smb_fname_dst;
@@ -4354,6 +4357,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
                                            struct share_mode_lock **lck,
                                            struct smb_filename *smb_fname_src)
 {
+       char *newname = NULL;
        bool overwrite;
        struct files_struct *dst_dirfsp = NULL;
        struct smb_filename *smb_fname_dst = NULL;
@@ -4368,6 +4372,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
                                                    total_data,
                                                    fsp,
                                                    smb_fname_src,
+                                                   &newname,
                                                    &overwrite,
                                                    &dst_dirfsp,
                                                    &smb_fname_dst,