]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: ceph: Fix cephwrap_readlinkat() to cope with real directory fsps.
authorJeremy Allison <jra@samba.org>
Thu, 11 Feb 2021 17:26:15 +0000 (09:26 -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_ceph.c

index 9da074a31ce31cd54b0d76da8b0c20841989e2a4..47b5046cfcbf641b14ef7d1081958ccb3ec1b402 100644 (file)
@@ -1090,13 +1090,21 @@ static int cephwrap_readlinkat(struct vfs_handle_struct *handle,
                char *buf,
                size_t bufsiz)
 {
+       struct smb_filename *full_fname = NULL;
        int result = -1;
-       DBG_DEBUG("[CEPH] readlink(%p, %s, %p, %llu)\n", handle,
-                       smb_fname->base_name, buf, llu(bufsiz));
 
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
 
-       result = ceph_readlink(handle->data, smb_fname->base_name, buf, bufsiz);
+       DBG_DEBUG("[CEPH] readlink(%p, %s, %p, %llu)\n", handle,
+                       full_fname->base_name, buf, llu(bufsiz));
+
+       result = ceph_readlink(handle->data, full_fname->base_name, buf, bufsiz);
+       TALLOC_FREE(full_fname);
        DBG_DEBUG("[CEPH] readlink(...) = %d\n", result);
        WRAP_RETURN(result);
 }