]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: unityed_media: Fix um_readlinkat() to cope with real directory fsps.
authorJeremy Allison <jra@samba.org>
Thu, 11 Feb 2021 19:55:16 +0000 (11:55 -0800)
committerJeremy Allison <jra@samba.org>
Sat, 13 Feb 2021 00:17:31 +0000 (00:17 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
source3/modules/vfs_unityed_media.c

index fea026e82c95f3f7d0a984bba43a425b726e7df4..2acd80d7ddac791d36147206f89a7d13e459e91e 100644 (file)
@@ -1322,10 +1322,19 @@ static int um_readlinkat(vfs_handle_struct *handle,
 {
        int status;
        struct smb_filename *client_fname = NULL;
+       struct smb_filename *full_fname = NULL;
 
        DEBUG(10, ("Entering um_readlinkat\n"));
 
-       if (!is_in_media_files(smb_fname->base_name)) {
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
+       if (!is_in_media_files(full_fname->base_name)) {
+               TALLOC_FREE(full_fname);
                return SMB_VFS_NEXT_READLINKAT(handle,
                                dirfsp,
                                smb_fname,
@@ -1334,18 +1343,19 @@ static int um_readlinkat(vfs_handle_struct *handle,
        }
 
        status = alloc_get_client_smb_fname(handle, talloc_tos(),
-                                           smb_fname, &client_fname);
+                                           full_fname, &client_fname);
        if (status != 0) {
                goto err;
        }
 
        status = SMB_VFS_NEXT_READLINKAT(handle,
-                               dirfsp,
+                               handle->conn->cwd_fsp,
                                client_fname,
                                buf,
                                bufsiz);
 
 err:
+       TALLOC_FREE(full_fname);
        TALLOC_FREE(client_fname);
        return status;
 }