s3: VFS: ceph: Fix cephwrap_symlinkat() to cope with real directory fsps.
authorJeremy Allison <jra@samba.org>
Fri, 15 Jan 2021 22:33:17 +0000 (14:33 -0800)
committerJeremy Allison <jra@samba.org>
Sun, 17 Jan 2021 04:43:31 +0000 (04:43 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_ceph.c

index b2d9ead1db5ef91a5a1a2df2b030239df797f8d2..cacc725310a727ec1ae45099ed0dc0e05c9442c5 100644 (file)
@@ -1052,16 +1052,24 @@ static int cephwrap_symlinkat(struct vfs_handle_struct *handle,
                struct files_struct *dirfsp,
                const struct smb_filename *new_smb_fname)
 {
+       struct smb_filename *full_fname = NULL;
        int result = -1;
+
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               new_smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
        DBG_DEBUG("[CEPH] symlink(%p, %s, %s)\n", handle,
                        link_target->base_name,
-                       new_smb_fname->base_name);
-
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+                       full_fname->base_name);
 
        result = ceph_symlink(handle->data,
                        link_target->base_name,
-                       new_smb_fname->base_name);
+                       full_fname->base_name);
+       TALLOC_FREE(full_fname);
        DBG_DEBUG("[CEPH] symlink(...) = %d\n", result);
        WRAP_RETURN(result);
 }