]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph: Add path based fallback mechanism for SMB_VFS_CHOWN
authorAnoop C S <anoopcs@samba.org>
Sat, 11 Nov 2023 05:37:28 +0000 (11:07 +0530)
committerJeremy Allison <jra@samba.org>
Wed, 15 Nov 2023 17:48:42 +0000 (17:48 +0000)
Fallback mechanism was missing in cephwrap_fchown() for path based call.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_ceph.c

index 4bcefcf91e8d48186524d13580f94716f5f706cd..521e8303218345f5e5a7189f72153ae1e1efef8f 100644 (file)
@@ -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);
 }