]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_default: Retrieve fs capabilites using vfs_get_fs_capabilties
authorAnoop C S <anoopcs@samba.org>
Tue, 24 Sep 2024 05:55:54 +0000 (11:25 +0530)
committerJule Anger <janger@samba.org>
Thu, 20 Mar 2025 09:59:09 +0000 (09:59 +0000)
Make use of get_fs_capabilties to start with already known fs
capabilties from connect phase.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15822

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 9bced4429e90ba871b848f31738aa8614bf03b08)

source3/modules/vfs_default.c

index 752906ba29a95d5084027d4041b39f01ec39491c..360a78c17e231114292b57ba452cbc1f121f77c4 100644 (file)
@@ -153,77 +153,12 @@ static int vfswrap_statvfs(struct vfs_handle_struct *handle,
 static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle,
                enum timestamp_set_resolution *p_ts_res)
 {
-       const struct loadparm_substitution *lp_sub =
-               loadparm_s3_global_substitution();
-       connection_struct *conn = handle->conn;
-       uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
-       struct smb_filename *smb_fname_cpath = NULL;
-       struct vfs_statvfs_struct statbuf;
-       int ret;
-
-       smb_fname_cpath = synthetic_smb_fname(talloc_tos(),
-                                             conn->connectpath,
-                                             NULL,
-                                             NULL,
-                                             0,
-                                             0);
-       if (smb_fname_cpath == NULL) {
-               return caps;
-       }
-
-       ZERO_STRUCT(statbuf);
-       ret = SMB_VFS_STATVFS(conn, smb_fname_cpath, &statbuf);
-       if (ret == 0) {
-               caps = statbuf.FsCapabilities;
-       }
+       uint32_t caps = vfs_get_fs_capabilities(handle->conn, p_ts_res);
 
 #if defined(HAVE_SYS_QUOTAS)
        caps |= FILE_VOLUME_QUOTAS;
 #endif
 
-       if (lp_nt_acl_support(SNUM(conn))) {
-               caps |= FILE_PERSISTENT_ACLS;
-       }
-
-       caps |= lp_parm_int(SNUM(conn), "share", "fake_fscaps", 0);
-
-       *p_ts_res = TIMESTAMP_SET_SECONDS;
-
-       /* Work out what timestamp resolution we can
-        * use when setting a timestamp. */
-
-       ret = SMB_VFS_STAT(conn, smb_fname_cpath);
-       if (ret == -1) {
-               TALLOC_FREE(smb_fname_cpath);
-               return caps;
-       }
-
-       if (smb_fname_cpath->st.st_ex_mtime.tv_nsec ||
-                       smb_fname_cpath->st.st_ex_atime.tv_nsec ||
-                       smb_fname_cpath->st.st_ex_ctime.tv_nsec) {
-               /* If any of the normal UNIX directory timestamps
-                * have a non-zero tv_nsec component assume
-                * we might be able to set sub-second timestamps.
-                * See what filetime set primitives we have.
-                */
-#if defined(HAVE_UTIMENSAT)
-               *p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
-#elif defined(HAVE_UTIMES)
-               /* utimes allows msec timestamps to be set. */
-               *p_ts_res = TIMESTAMP_SET_MSEC;
-#elif defined(HAVE_UTIME)
-               /* utime only allows sec timestamps to be set. */
-               *p_ts_res = TIMESTAMP_SET_SECONDS;
-#endif
-
-               DBG_DEBUG("vfswrap_fs_capabilities: timestamp "
-                       "resolution of %s "
-                       "available on share %s, directory %s\n",
-                       *p_ts_res == TIMESTAMP_SET_MSEC ? "msec" : "sec",
-                       lp_servicename(talloc_tos(), lp_sub, conn->params->service),
-                       conn->connectpath );
-       }
-       TALLOC_FREE(smb_fname_cpath);
        return caps;
 }