1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

vfs_ceph: support real dirfsps in cephwrap_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2021-01-20 15:00:43 +01:00 committed by Jeremy Allison
parent a1c9782d23
commit fa058d166e

View 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;
}
if (flags & AT_REMOVEDIR) {
result = ceph_rmdir(handle->data, smb_fname->base_name);
} else {
result = ceph_unlink(handle->data, smb_fname->base_name);
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, full_fname->base_name);
} else {
result = ceph_unlink(handle->data, full_fname->base_name);
}
TALLOC_FREE(full_fname);
DBG_DEBUG("[CEPH] unlink(...) = %d\n", result);
WRAP_RETURN(result);
}