The branch, master has been updated
       via  e73513a588c smbd: Fix getting fs capabilities
      from  a2dfaa194fb build: clang 21 re-enable -Wunititialized-const-pointer

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e73513a588c53f4ab702d981e6e6eeb29c85a2a1
Author: Volker Lendecke <[email protected]>
Date:   Tue Mar 3 16:41:03 2026 +0100

    smbd: Fix getting fs capabilities
    
    The change from statvfs to fstatvfs has a bug: When this is called in
    make_connection_snum, conn->cwd_fsp is not fully set up yet. So the
    "This happens in create_conn_struct_as_root()" comment applies
    everywhere. We need to look at the share rootdir, so open a pathref
    fsp on it. This is called only once per tcon, so it's not in our hot
    code path.
    
    Found by a user who has "/" mounted readonly, and MacOS denied
    writing.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Wed Mar  4 10:01:41 UTC 2026 on atb-devel-224

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/vfs.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 9a1805ee3de..9f7b2cb40bf 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1116,26 +1116,19 @@ uint32_t vfs_get_fs_capabilities(struct 
connection_struct *conn,
        struct smb_filename *smb_fname_cpath = NULL;
        struct vfs_statvfs_struct statbuf = {};
        NTSTATUS status;
-       int dirfd, ret;
-
-       dirfd = fsp_get_pathref_fd(conn->cwd_fsp);
-
-       if (dirfd == -1) {
-               /*
-                * This happens in create_conn_struct_as_root()
-                */
-               status = openat_pathref_fsp_rootdir(talloc_tos(),
-                                                   conn,
-                                                   &smb_fname_cpath);
-       } else {
-               status = openat_pathref_fsp_dot(talloc_tos(),
-                                               conn->cwd_fsp,
-                                               0,
-                                               &smb_fname_cpath);
-       }
+       int ret;
 
+       status = synthetic_pathref(talloc_tos(),
+                                  conn->cwd_fsp,
+                                  conn->connectpath,
+                                  NULL,
+                                  NULL,
+                                  0,
+                                  0,
+                                  &smb_fname_cpath);
        if (!NT_STATUS_IS_OK(status)) {
-               return caps;
+               DBG_DEBUG("Could not open share root\n");
+               goto done;
        }
 
        ret = SMB_VFS_FSTATVFS(conn, smb_fname_cpath->fsp, &statbuf);
@@ -1179,6 +1172,7 @@ uint32_t vfs_get_fs_capabilities(struct connection_struct 
*conn,
                          lp_servicename(talloc_tos(), lp_sub, 
conn->params->service),
                          conn->connectpath );
        }
+done:
        TALLOC_FREE(smb_fname_cpath);
        return caps;
 }


-- 
Samba Shared Repository

Reply via email to