]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs: Use RESOLVE_NO_XDEV by default on all shares
authorSamuel Cabrero <scabrero@samba.org>
Fri, 14 Feb 2025 16:13:39 +0000 (17:13 +0100)
committerSamuel Cabrero <scabrero@samba.org>
Tue, 18 Nov 2025 08:03:32 +0000 (08:03 +0000)
Enable the flag by default on all shares, it will be automatically
disabled if the system does not support openat2().

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

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
script/autobuild.py
source3/modules/vfs_default.c

index feaafebe9e236c35095a55e2c38f447819873333..08abd398810f2b44806c1569792b7fa6fe7137a1 100755 (executable)
@@ -333,7 +333,7 @@ tasks = {
     "samba-no-opath-build": {
         "git-clone-required": True,
         "sequence": [
-            ("configure", "ADDITIONAL_CFLAGS='-DDISABLE_OPATH=1 -DDISABLE_VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS=1 -DDISABLE_PROC_FDS=1' ./configure.developer --without-ad-dc " + samba_configure_params),
+            ("configure", "ADDITIONAL_CFLAGS='-DDISABLE_OPATH=1 -DDISABLE_VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS=1 -DDISABLE_VFS_OPEN_HOW_RESOLVE_NO_XDEV=1 -DDISABLE_PROC_FDS=1' ./configure.developer --without-ad-dc " + samba_configure_params),
             ("make", "make -j"),
             ("check-clean-tree", CLEAN_SOURCE_TREE_CMD),
             ("chmod-R-a-w", "chmod -R a-w ."),
index 34b00f5b547347ec252912098434a39d09fff800..670c35c94cfbc7972fbcd70e3dd6d392bb4aec88 100644 (file)
@@ -76,6 +76,17 @@ static int vfswrap_connect(vfs_handle_struct *handle, const char *service, const
 #ifdef DISABLE_VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS
        handle->conn->open_how_resolve &= ~VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS;
 #endif
+       bval = lp_parm_bool(SNUM(handle->conn),
+                           "vfs_default",
+                           "VFS_OPEN_HOW_RESOLVE_NO_XDEV",
+                           true);
+       if (bval) {
+               handle->conn->open_how_resolve |=
+                       VFS_OPEN_HOW_RESOLVE_NO_XDEV;
+       }
+#ifdef DISABLE_VFS_OPEN_HOW_RESOLVE_NO_XDEV
+       handle->conn->open_how_resolve &= ~VFS_OPEN_HOW_RESOLVE_NO_XDEV;
+#endif
 
        return 0;    /* Return >= 0 for success */
 }