]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph: Handle absolute paths with dirfd = ‑1 in openat master
authorAnoop C S <anoopcs@samba.org>
Sun, 15 Feb 2026 04:27:18 +0000 (09:57 +0530)
committerAnoop C S <anoopcs@samba.org>
Mon, 16 Feb 2026 17:27:03 +0000 (17:27 +0000)
ceph_openat() does not follow the convention of ignoring 'dirfd' when
the pathname is absolute, resulting in EBADF. As a temporary workaround,
handle this special case in cephwrap_openat() by calling ceph_open()
directly instead of ceph_openat().

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Xavi Hernandez <xhernandez@redhat.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Feb 16 17:27:03 UTC 2026 on atb-devel-224

source3/modules/vfs_ceph.c

index e927f41dd03096c75439d946a7db3df5c94b5c70..830b8b17a4bb7bae2ef48ddcd7f2ce39942a0d40 100644 (file)
@@ -509,12 +509,21 @@ static int cephwrap_openat(struct vfs_handle_struct *handle,
                became_root = true;
        }
 
+       if (dirfd == -1 && smb_fname->base_name[0] == '/') {
+               result = ceph_open(handle->data,
+                                  smb_fname->base_name,
+                                  flags,
+                                  mode);
+               goto done;
+       }
+
        result = ceph_openat(handle->data,
                             dirfd,
                             smb_fname->base_name,
                             flags,
                             mode);
 
+done:
        if (became_root) {
                unbecome_root();
        }