]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph: support real dirfsps in cephwrap_unlinkat()
authorRalph Boehme <slow@samba.org>
Wed, 20 Jan 2021 14:00:43 +0000 (15:00 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 28 Jan 2021 08:11:49 +0000 (08:11 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_ceph.c

index cacc725310a727ec1ae45099ed0dc0e05c9442c5..a34ed8eab140785bf3692a04a2e3171ea77670ee 100644 (file)
@@ -829,21 +829,31 @@ static int cephwrap_unlinkat(struct vfs_handle_struct *handle,
                        const struct smb_filename *smb_fname,
                        int flags)
 {
+       struct smb_filename *full_fname = NULL;
        int result = -1;
 
        DBG_DEBUG("[CEPH] unlink(%p, %s)\n",
                handle,
                smb_fname_str_dbg(smb_fname));
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+
        if (smb_fname->stream_name) {
                errno = ENOENT;
                return result;
        }
+
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
        if (flags & AT_REMOVEDIR) {
-               result = ceph_rmdir(handle->data, smb_fname->base_name);
+               result = ceph_rmdir(handle->data, full_fname->base_name);
        } else {
-               result = ceph_unlink(handle->data, smb_fname->base_name);
+               result = ceph_unlink(handle->data, full_fname->base_name);
        }
+       TALLOC_FREE(full_fname);
        DBG_DEBUG("[CEPH] unlink(...) = %d\n", result);
        WRAP_RETURN(result);
 }