vfs_ceph: assert renameat() fsps match cwd
authorDavid Disseldorp <ddiss@samba.org>
Thu, 9 Jan 2020 17:20:39 +0000 (18:20 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 9 Jan 2020 20:20:05 +0000 (20:20 +0000)
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 <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan  9 20:20:05 UTC 2020 on sn-devel-184

source3/modules/vfs_ceph.c

index 70059db0c018077f850ede15210431c3be8dbf42..2c72b6aee2356343353b70ba86943e9873aa25cb 100644 (file)
@@ -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);
 }