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

index b1fd2a7f098a38e117a995a7503d6e0dd899ab6a..af0ce70e1e80b5286bc3c444b44d797a93b8d061 100644 (file)
@@ -1876,11 +1876,23 @@ static int vfs_gluster_readlinkat(struct vfs_handle_struct *handle,
                                char *buf,
                                size_t bufsiz)
 {
+       struct smb_filename *full_fname = NULL;
        int ret;
 
        START_PROFILE(syscall_readlinkat);
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
-       ret = glfs_readlink(handle->data, smb_fname->base_name, buf, bufsiz);
+
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               smb_fname);
+       if (full_fname == NULL) {
+               END_PROFILE(syscall_readlinkat);
+               return -1;
+       }
+
+       ret = glfs_readlink(handle->data, full_fname->base_name, buf, bufsiz);
+
+       TALLOC_FREE(full_fname);
+
        END_PROFILE(syscall_readlinkat);
 
        return ret;