]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/smbd: fix nested chdir into msdfs links on (widelinks = yes) share
authorNoel Power <noel.power@suse.com>
Fri, 7 Jun 2024 18:35:47 +0000 (19:35 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 11 Jun 2024 19:31:40 +0000 (19:31 +0000)
This patch also removes known fail for existing test

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 11 19:31:40 UTC 2024 on atb-devel-224

selftest/knownfail.d/dfs_widelink [deleted file]
source3/smbd/files.c

diff --git a/selftest/knownfail.d/dfs_widelink b/selftest/knownfail.d/dfs_widelink
deleted file mode 100644 (file)
index 2a75c75..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^samba.tests.blackbox.misc_dfs_widelink.samba.tests.blackbox.misc_dfs_widelink.DfsWidelinkBlockboxTestBase.test_nested_chdir\(fileserver\)
-^samba.tests.blackbox.misc_dfs_widelink.samba.tests.blackbox.misc_dfs_widelink.DfsWidelinkBlockboxTestBase.test_ci_chdir\(fileserver\)
index 046b58023bd98045ecc3e9603b7504996159e0e3..0ab8aa80f20ce6d7269b770bd7d3ea21b28136cc 100644 (file)
@@ -1307,6 +1307,24 @@ next:
        }
 
        if (fd == -1) {
+               /*
+                * vfs_widelink widelink_openat will update stat for fsp
+                * and return ELOOP for non-existing link, we can report
+                * the link here and let calling code decide what to do.
+                */
+               if ((errno == ELOOP) && S_ISLNK(fsp->fsp_name->st.st_ex_mode)) {
+                       status = read_symlink_reparse(mem_ctx,
+                                                     dirfsp,
+                                                     &rel_fname,
+                                                     &symlink_err);
+                       if (NT_STATUS_IS_OK(status)) {
+                               status = NT_STATUS_STOPPED_ON_SYMLINK;
+                       } else {
+                               DBG_ERR("read_symlink_reparse failed: %s\n",
+                                       nt_errstr(status));
+                       }
+                       goto fail;
+               }
                status = map_nt_error_from_unix(errno);
                DBG_DEBUG("SMB_VFS_OPENAT() failed: %s\n",
                          strerror(errno));