]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: syncops: Use real dirfsp for SMB_VFS_RENAMEAT()
authorJeremy Allison <jra@samba.org>
Thu, 17 Jun 2021 19:28:30 +0000 (12:28 -0700)
committerNoel Power <npower@samba.org>
Tue, 22 Jun 2021 13:44:34 +0000 (13:44 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/modules/vfs_syncops.c

index bc8b641c1b0833666fb8889b2bd2790c90581d43..679d8b06dcb9b684bbcf7172ae7a242f09a7c20d 100644 (file)
@@ -144,6 +144,8 @@ static int syncops_renameat(vfs_handle_struct *handle,
 {
 
        int ret;
+       struct smb_filename *full_fname_src = NULL;
+       struct smb_filename *full_fname_dst = NULL;
        struct syncops_config_data *config;
 
        SMB_VFS_HANDLE_GET_DATA(handle, config,
@@ -165,9 +167,26 @@ static int syncops_renameat(vfs_handle_struct *handle,
                return ret;
        }
 
+       full_fname_src = full_path_from_dirfsp_atname(talloc_tos(),
+                                                     srcfsp,
+                                                     smb_fname_src);
+       if (full_fname_src == NULL) {
+               errno = ENOMEM;
+               return ret;
+       }
+       full_fname_dst = full_path_from_dirfsp_atname(talloc_tos(),
+                                                     dstfsp,
+                                                     smb_fname_dst);
+       if (full_fname_dst == NULL) {
+               TALLOC_FREE(full_fname_src);
+               errno = ENOMEM;
+               return ret;
+       }
        syncops_two_names(handle->conn,
-                         smb_fname_src,
-                         smb_fname_dst);
+                         full_fname_src,
+                         full_fname_dst);
+       TALLOC_FREE(full_fname_src);
+       TALLOC_FREE(full_fname_dst);
        return ret;
 }