From 60b72f589e2a912682516f1d28c84cc713248a0a Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Thu, 9 Jan 2020 18:20:39 +0100 Subject: [PATCH] vfs_ceph: assert renameat() fsps match cwd As discussed with Jeremy in bug 14232, the vfs_ceph.renameat_fn implementation currently ignores srcfsp and dstfsp. As a result, relative smb_fname_src/smb_fname_dest paths will be processed as relative to cwd. This is currently a valid assumption, as srcfsp and dstfsp should always match conn->cwd_fsp. Add an assert to clarify this. Signed-off-by: David Disseldorp Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Jan 9 20:20:05 UTC 2020 on sn-devel-184 --- source3/modules/vfs_ceph.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 70059db0c01..2c72b6aee23 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -612,6 +612,9 @@ static int cephwrap_renameat(struct vfs_handle_struct *handle, return result; } + SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp); + SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp); + result = ceph_rename(handle->data, smb_fname_src->base_name, smb_fname_dst->base_name); WRAP_RETURN(result); }