]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: unityed_media: Fixup um_symlinkat() to correctly use the dirfsp path.
authorJeremy Allison <jra@samba.org>
Mon, 25 Jan 2021 21:29:57 +0000 (13:29 -0800)
committerRalph Boehme <slow@samba.org>
Thu, 28 Jan 2021 08:10:18 +0000 (08:10 +0000)
Missed in my original fixes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Jan 28 08:10:18 UTC 2021 on sn-devel-184

source3/modules/vfs_unityed_media.c

index 9c4f2baf691b86922ce7ec70d7aa5b8d0fbd5251..7901b2390d77cf60798c805f6c45fbb9d61244af 100644 (file)
@@ -1262,11 +1262,20 @@ static int um_symlinkat(vfs_handle_struct *handle,
        int status;
        struct smb_filename *new_link_target = NULL;
        struct smb_filename *new_client_fname = NULL;
+       struct smb_filename *full_fname = NULL;
 
        DEBUG(10, ("Entering um_symlinkat\n"));
 
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               new_smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
        if (!is_in_media_files(link_contents->base_name) &&
-                       !is_in_media_files(new_smb_fname->base_name)) {
+                       !is_in_media_files(full_fname->base_name)) {
+               TALLOC_FREE(full_fname);
                return SMB_VFS_NEXT_SYMLINKAT(handle,
                                link_contents,
                                dirfsp,
@@ -1279,19 +1288,20 @@ static int um_symlinkat(vfs_handle_struct *handle,
                goto err;
        }
        status = alloc_get_client_smb_fname(handle, talloc_tos(),
-                                           new_smb_fname, &new_client_fname);
+                                           full_fname, &new_client_fname);
        if (status != 0) {
                goto err;
        }
 
        status = SMB_VFS_NEXT_SYMLINKAT(handle,
                                        new_link_target,
-                                       dirfsp,
+                                       handle->conn->cwd_fsp,
                                        new_client_fname);
 
 err:
        TALLOC_FREE(new_link_target);
        TALLOC_FREE(new_client_fname);
+       TALLOC_FREE(full_fname);
        return status;
 }