The Samba-Bugzilla – Attachment 18336 Details for
Bug 15435
regression DFS not working with widelinks = true
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
backported patch for 4.19
bug-15435-v4-19.patch (text/plain), 8.35 KB, created by
Noel Power
on 2024-06-12 10:06:44 UTC
(
hide
)
Description:
backported patch for 4.19
Filename:
MIME Type:
Creator:
Noel Power
Created:
2024-06-12 10:06:44 UTC
Size:
8.35 KB
patch
obsolete
>From 7f1f9d8c9f22f9215c5b856e283fb5c2afd20e88 Mon Sep 17 00:00:00 2001 >From: Noel Power <noel.power@suse.com> >Date: Tue, 11 Jun 2024 11:19:50 +0100 >Subject: [PATCH 1/2] selftest: Add a python blackbox test for some misc > (widelink) DFS tests > >On master attempting to chdir into a nested dfs link > >e.g. cd dfslink (works) > cd dfslink/another_dfslink (fails) > >[1] Add a test for this scenario (nested chdir) >[2] Add test for enumerating a dfs link in root of dfs share >[3] Add a test to check case insensitive chdir into dfs link on widelink > enabled share > >Add knownfails for tests 1 and 3 > >Signed-off-by: Noel Power <noel.power@suse.com> >Reviewed-by: Jeremy Allison <jra@samba.org> > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435 >(cherry picked from commit 7f1de90f72d6e8287aec6ab1d9f7776b7df624e5) > >[noel.power@suse.com backported to Samba 4.19 changed knownfails because > test_ci_chdir doen't fail in 4.19 but test_enumerate_dfs_link does] >--- > .../samba/tests/blackbox/misc_dfs_widelink.py | 86 +++++++++++++++++++ > selftest/knownfail.d/dfs_widelink | 2 + > source4/selftest/tests.py | 3 + > 3 files changed, 91 insertions(+) > create mode 100644 python/samba/tests/blackbox/misc_dfs_widelink.py > create mode 100644 selftest/knownfail.d/dfs_widelink > >diff --git a/python/samba/tests/blackbox/misc_dfs_widelink.py b/python/samba/tests/blackbox/misc_dfs_widelink.py >new file mode 100644 >index 00000000000..7948590d710 >--- /dev/null >+++ b/python/samba/tests/blackbox/misc_dfs_widelink.py >@@ -0,0 +1,86 @@ >+# Blackbox tests for DFS (widelink) >+# >+# Copyright (C) Noel Power noel.power@suse.com >+# >+# This program is free software; you can redistribute it and/or modify >+# it under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with this program. If not, see <http://www.gnu.org/licenses/>. >+# >+from samba.tests import BlackboxTestCase, BlackboxProcessError >+from samba.samba3 import param as s3param >+ >+from samba.credentials import Credentials >+ >+import os >+ >+class DfsWidelinkBlockboxTestBase(BlackboxTestCase): >+ >+ def setUp(self): >+ super().setUp() >+ self.lp = s3param.get_context() >+ self.server = os.environ["SERVER"] >+ self.user = os.environ["USER"] >+ self.passwd = os.environ["PASSWORD"] >+ self.creds = Credentials() >+ self.creds.guess(self.lp) >+ self.creds.set_username(self.user) >+ self.creds.set_password(self.passwd) >+ self.testdir = os.getenv("TESTDIR", "msdfs-share-wl") >+ self.share = os.getenv("SHARE", "msdfs-share-wl") >+ self.dirpath = os.path.join(os.environ["LOCAL_PATH"],self.testdir) >+ # allow a custom teardown function to be defined >+ self.cleanup = None >+ self.cleanup_args = [] >+ >+ def tearDown(self): >+ try: >+ if (self.cleanup): >+ self.cleanup(self.cleanup_args) >+ except Exception as e: >+ print("remote remove failed: %s" % str(e)) >+ >+ def build_test_cmd(self, cmd, args): >+ cmd = [cmd, "-U%s%%%s" % (self.user, self.passwd)] >+ cmd.extend(args) >+ return cmd >+ >+ def test_ci_chdir(self): >+ parent_dir = "msdfs-src1" >+ dirs = [parent_dir, parent_dir.upper()] >+ # try as named dir first then try upper-cased version >+ for adir in dirs: >+ smbclient_args = self.build_test_cmd("smbclient", ["//%s/%s" % (self.server, self.share), "-c", "cd %s" % (adir)]) >+ try: >+ out_str = self.check_output(smbclient_args) >+ except BlackboxProcessError as e: >+ print(str(e)) >+ self.fail(str(e)) >+ >+ def test_nested_chdir(self): >+ parent_dir = "dfshop1" >+ child_dir = "dfshop2" >+ smbclient_args = self.build_test_cmd("smbclient", ["//%s/%s" % (self.server, self.share), "-c", "cd %s/%s" % (parent_dir,child_dir)]) >+ try: >+ out_str = self.check_output(smbclient_args) >+ except BlackboxProcessError as e: >+ print(str(e)) >+ self.fail(str(e)) >+ >+ def test_enumerate_dfs_link(self): >+ smbclient_args = self.build_test_cmd("smbclient", ["//%s/%s" % (self.server, self.share), "-c", "dir"]) >+ try: >+ out_str = self.check_output(smbclient_args) >+ except BlackboxProcessError as e: >+ print(str(e)) >+ self.fail(str(e)) >+ out_str = out_str.decode() >+ self.assertIn("msdfs-src1", out_str) >diff --git a/selftest/knownfail.d/dfs_widelink b/selftest/knownfail.d/dfs_widelink >new file mode 100644 >index 00000000000..1427a8ba5d7 >--- /dev/null >+++ b/selftest/knownfail.d/dfs_widelink >@@ -0,0 +1,2 @@ >+^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 >diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py >index 8456ec1f1c5..48a139e7908 100755 >--- a/source4/selftest/tests.py >+++ b/source4/selftest/tests.py >@@ -1459,6 +1459,9 @@ planoldpythontestsuite("fileserver", > "samba.tests.blackbox.smbcacls_dfs_propagate_inherit", > "samba.tests.blackbox.smbcacls_dfs_propagate_inherit(DFS-msdfs-root)", > environ={'SHARE': 'smbcacls_share'}) >+ >+planoldpythontestsuite("fileserver", >+ "samba.tests.blackbox.misc_dfs_widelink") > # > # Want a selection of environments across the process models > # >-- >2.35.3 > > >From 3dce6da9f69250ffba10d6d1e93b2af0dfa4fd7b Mon Sep 17 00:00:00 2001 >From: Noel Power <noel.power@suse.com> >Date: Fri, 7 Jun 2024 19:35:47 +0100 >Subject: [PATCH 2/2] s3/smbd: fix nested chdir into msdfs links on (widelinks > = yes) share > >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 | 2 -- > source3/smbd/files.c | 18 ++++++++++++++++++ > 2 files changed, 18 insertions(+), 2 deletions(-) > delete mode 100644 selftest/knownfail.d/dfs_widelink > >diff --git a/selftest/knownfail.d/dfs_widelink b/selftest/knownfail.d/dfs_widelink >deleted file mode 100644 >index 1427a8ba5d7..00000000000 >--- a/selftest/knownfail.d/dfs_widelink >+++ /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 >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index 02cfc424822..a658a3c0345 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -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)); >-- >2.35.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
Actions:
View
Attachments on
bug 15435
:
18013
|
18022
|
18331
|
18332
|
18335
| 18336 |
18337