summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-06-16 19:58:56 -0700
committerNoel Power <npower@samba.org>2021-06-22 13:44:34 +0000
commit5235ffea593469d746213ed1ed42f7930f7b1f57 (patch)
tree5e329b6e4d30a3ae87699bbfe6f3be65efeb93e4 /source3
parenta9832db6ac07916b91a10e4f3db52426a5ef1bd8 (diff)
downloadsamba-5235ffea593469d746213ed1ed42f7930f7b1f57.tar.gz
s3: VFS: ceph: Use real dirfsp for SMB_VFS_RENAMEAT()
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_ceph.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 973b45d90b0..0e7f2d89c88 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -621,17 +621,39 @@ static int cephwrap_renameat(struct vfs_handle_struct *handle,
files_struct *dstfsp,
const struct smb_filename *smb_fname_dst)
{
+ struct smb_filename *full_fname_src = NULL;
+ struct smb_filename *full_fname_dst = NULL;
int result = -1;
+
DBG_DEBUG("[CEPH] cephwrap_renameat\n");
if (smb_fname_src->stream_name || smb_fname_dst->stream_name) {
errno = ENOENT;
return result;
}
- SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp);
- SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp);
+ full_fname_src = full_path_from_dirfsp_atname(talloc_tos(),
+ srcfsp,
+ smb_fname_src);
+ if (full_fname_src == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ full_fname_dst = full_path_from_dirfsp_atname(talloc_tos(),
+ dstfsp,
+ smb_fname_dst);
+ if (full_fname_dst == NULL) {
+ TALLOC_FREE(full_fname_src);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ result = ceph_rename(handle->data,
+ full_fname_src->base_name,
+ full_fname_dst->base_name);
+
+ TALLOC_FREE(full_fname_src);
+ TALLOC_FREE(full_fname_dst);
- result = ceph_rename(handle->data, smb_fname_src->base_name, smb_fname_dst->base_name);
WRAP_RETURN(result);
}