From: Anoop C S Date: Sat, 11 Nov 2023 05:37:28 +0000 (+0530) Subject: vfs_ceph: Add path based fallback mechanism for SMB_VFS_CHOWN X-Git-Tag: talloc-2.4.2~720 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5572400a975a07905f7cb0f3611590dfaf787311;p=thirdparty%2Fsamba.git vfs_ceph: Add path based fallback mechanism for SMB_VFS_CHOWN Fallback mechanism was missing in cephwrap_fchown() for path based call. Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 4bcefcf91e8..521e8303218 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1048,7 +1048,24 @@ static int cephwrap_fchown(struct vfs_handle_struct *handle, files_struct *fsp, int result; DBG_DEBUG("[CEPH] fchown(%p, %p, %d, %d)\n", handle, fsp, uid, gid); - result = ceph_fchown(handle->data, fsp_get_io_fd(fsp), uid, gid); + if (!fsp->fsp_flags.is_pathref) { + /* + * We can use an io_fd to change ownership. + */ + result = ceph_fchown(handle->data, + fsp_get_io_fd(fsp), + uid, + gid); + } else { + /* + * This is no longer a handle based call. + */ + result = ceph_chown(handle->data, + fsp->fsp_name->base_name, + uid, + gid); + } + DBG_DEBUG("[CEPH] fchown(...) = %d\n", result); WRAP_RETURN(result); }