From: Ralph Boehme Date: Wed, 20 Jan 2021 14:00:43 +0000 (+0100) Subject: vfs_ceph: support real dirfsps in cephwrap_unlinkat() X-Git-Tag: tevent-0.11.0~1943 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa058d166e006d02327add731d34567fa813d91e;p=thirdparty%2Fsamba.git vfs_ceph: support real dirfsps in cephwrap_unlinkat() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index cacc725310a..a34ed8eab14 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -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); }