]> 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)
committerJule Anger <janger@samba.org>
Wed, 3 Jul 2024 08:48:12 +0000 (08:48 +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

(cherry picked from commit 788ef8f07c75d5e6eca5b8f18d93d96f31574267)
[noel.power@suse.com backported to Samba 4.19 changed test of errno
    after return from widelink_openat to ENOENT because ELOOP isn't set
    for msdfs links in 4.19, ENOENT is set instead. Also minor change
    to use 4.19 create_open_symlink_err fn instead of read_symlink_reparse]

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 1427a8b..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_enumerate_dfs_link
index 02cfc4248222e7a29e0860bc5df3e5a6f75e9a2c..a658a3c03454f5f7a267547e38effa4594e61a40 100644 (file)
@@ -1168,6 +1168,24 @@ next:
        }
 
        if (fd == -1) {
+               /*
+                * vfs_widelink widelink_openat will update stat for fsp
+                * and return ENOENT for non-existing link, we can report
+                * the link here and let calling code decide what to do.
+                */
+               if ((errno == ENOENT) && S_ISLNK(fsp->fsp_name->st.st_ex_mode)) {
+                       status = create_open_symlink_err(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));