]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: media_harmony: Fix mh_readlinkat() to cope with real directory fsps.
authorJeremy Allison <jra@samba.org>
Thu, 11 Feb 2021 19:05:28 +0000 (11:05 -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_media_harmony.c

index fb5a082c98eb1d5b78b7478fbfe212d4e8e9462c..1df2316947283698b408a67b1a297b95f6b01016 100644 (file)
@@ -1679,10 +1679,19 @@ static int mh_readlinkat(vfs_handle_struct *handle,
                size_t bufsiz)
 {
        int status;
+       struct smb_filename *full_fname = NULL;
        struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_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) {
+               status = -1;
+               goto err;
+       }
+
+       if (!is_in_media_files(full_fname->base_name)) {
                status = SMB_VFS_NEXT_READLINKAT(handle,
                                dirfsp,
                                smb_fname,
@@ -1692,13 +1701,13 @@ static int mh_readlinkat(vfs_handle_struct *handle,
        }
 
        if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
-                               smb_fname,
+                               full_fname,
                                &clientFname))) {
                goto err;
        }
 
        status = SMB_VFS_NEXT_READLINKAT(handle,
-                               dirfsp,
+                               handle->conn->cwd_fsp,
                                clientFname,
                                buf,
                                bufsiz);
@@ -1706,6 +1715,7 @@ static int mh_readlinkat(vfs_handle_struct *handle,
 err:
        TALLOC_FREE(clientFname);
 out:
+       TALLOC_FREE(full_fname);
        return status;
 }