The branch, master has been updated
       via  0be53d7ac0a smbd: return correct reparse tag DFS when listing 
directories
       via  43ee86c0c75 CI: add Python test 
samba.tests.dcerpc.dfs.DfsTests.test_dfs_reparse_tag
       via  5f7b3192773 python/tests: also populate self.server in calls 
LibsmbTests setup()
       via  698a0195f72 pylibsmb: add SMB2_FIND_ID_BOTH_DIRECTORY_INFO
       via  2e88ba4b4de vfs_xattr_tdb: fix dangling symlink detection
       via  2cb2991ccdd s3/rpc_server/dfs: fix creating a DFS link
      from  f3db0e8736a lib: Make file_ploadv() static

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0be53d7ac0a39d6a48c6c5e2144f342c0d406781
Author: Ralph Boehme <[email protected]>
Date:   Fri Aug 15 10:13:33 2025 +0200

    smbd: return correct reparse tag DFS when listing directories
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Fri Aug 15 15:37:05 UTC 2025 on atb-devel-224

commit 43ee86c0c757e95712ed52bd336d2085485498ba
Author: Ralph Boehme <[email protected]>
Date:   Thu Aug 14 17:18:08 2025 +0200

    CI: add Python test samba.tests.dcerpc.dfs.DfsTests.test_dfs_reparse_tag
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

commit 5f7b31927733b0ff3e1207be242f1ddb2cb699bd
Author: Ralph Boehme <[email protected]>
Date:   Fri Aug 15 11:49:27 2025 +0200

    python/tests: also populate self.server in calls LibsmbTests setup()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

commit 698a0195f72a091e9ed6b0448160c79e37761840
Author: Ralph Boehme <[email protected]>
Date:   Fri Aug 15 10:14:53 2025 +0200

    pylibsmb: add SMB2_FIND_ID_BOTH_DIRECTORY_INFO
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

commit 2e88ba4b4de146327c19682d59bbe34d68158bf7
Author: Ralph Boehme <[email protected]>
Date:   Fri Aug 15 11:50:26 2025 +0200

    vfs_xattr_tdb: fix dangling symlink detection
    
    The caller might not have called stat on smb_fname.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

commit 2cb2991ccdd5d4f63e4c5b3ccc4454a6b39d6afe
Author: Ralph Boehme <[email protected]>
Date:   Thu Aug 14 19:20:02 2025 +0200

    s3/rpc_server/dfs: fix creating a DFS link
    
    If there's no existing link, get_referred_path() returns 
NT_STATUS_OBJECT_PATH_NOT_FOUND.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 python/samba/tests/dcerpc/dfs.py    | 48 +++++++++++++++++++++++++++++++++++++
 python/samba/tests/libsmb.py        |  1 +
 source3/libsmb/pylibsmb.c           |  1 +
 source3/modules/vfs_xattr_tdb.c     | 13 +++++-----
 source3/rpc_server/dfs/srv_dfs_nt.c |  4 +++-
 source3/smbd/dir.c                  |  2 ++
 source4/selftest/tests.py           |  1 +
 7 files changed, 62 insertions(+), 8 deletions(-)
 create mode 100644 python/samba/tests/dcerpc/dfs.py


Changeset truncated at 500 lines:

diff --git a/python/samba/tests/dcerpc/dfs.py b/python/samba/tests/dcerpc/dfs.py
new file mode 100644
index 00000000000..0fcce324e55
--- /dev/null
+++ b/python/samba/tests/dcerpc/dfs.py
@@ -0,0 +1,48 @@
+#
+# Unix SMB/CIFS implementation.
+# Copyright Ralph Boehme <[email protected]> 2025
+#
+# 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/>.
+#
+
+"""Tests for samba.dcerpc.dfs"""
+
+import os
+import logging
+import samba
+from samba.dcerpc import dfs
+from samba.tests import RpcInterfaceTestCase
+from samba.logger import get_samba_logger
+from samba.credentials import Credentials
+from samba.samba3 import libsmb_samba_internal as libsmb
+import samba.tests.libsmb
+from samba.samba3 import param as s3param
+
+logger = get_samba_logger(name=__name__)
+
+class DfsTests(samba.tests.libsmb.LibsmbTests):
+    def setUp(self):
+        super().setUp()
+        self.dfs = dfs.netdfs('ncacn_np:%s[/pipe/netdfs]' % self.server, 
self.lp, self.creds)
+        self.c = libsmb.Conn(self.server_ip, "msdfs-share", self.lp, 
self.creds)
+
+    def tearDown(self):
+        super().tearDown()
+
+    def test_dfs_reparse_tag(self):
+        self.dfs.Add('\\\\%s\\msdfs-share\\dfslink' % self.server, 
self.server, 'tmp', 'comment', 0)
+        l = self.c.list('', info_level=libsmb.SMB2_FIND_ID_BOTH_DIRECTORY_INFO)
+        files = {i['name']: i for i in l}
+        self.assertEqual(files['dfslink']['reparse_tag'], 
libsmb.IO_REPARSE_TAG_DFS)
+        self.dfs.Remove('\\\\%s\\msdfs-share\\dfslink' % self.server, 
self.server, 'tmp')
diff --git a/python/samba/tests/libsmb.py b/python/samba/tests/libsmb.py
index 3ac1b68a59b..e3683901df2 100644
--- a/python/samba/tests/libsmb.py
+++ b/python/samba/tests/libsmb.py
@@ -43,6 +43,7 @@ class LibsmbTests(samba.tests.TestCase):
         server_conf_dir = os.path.dirname(server_conf)
         self.global_inject = os.path.join(server_conf_dir, 
"global_inject.conf")
 
+        self.server = samba.tests.env_get_var_value("SERVER")
         self.server_ip = samba.tests.env_get_var_value("SERVER_IP")
 
     def clean_file(self, conn, filename):
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 67872d8e3b1..cba910d173d 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -3740,6 +3740,7 @@ MODULE_INIT_FUNC(libsmb_samba_cwrapper)
        ADD_STRING(SMB2_CREATE_TAG_APP_INSTANCE_ID);
        ADD_STRING(SVHDX_OPEN_DEVICE_CONTEXT);
        ADD_STRING(SMB2_CREATE_TAG_POSIX);
+       ADD_FLAGS(SMB2_FIND_ID_BOTH_DIRECTORY_INFO);
        ADD_FLAGS(SMB2_FIND_POSIX_INFORMATION);
        ADD_FLAGS(FILE_SUPERSEDE);
        ADD_FLAGS(FILE_OPEN);
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index 447d868924d..19331d0de4f 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -604,13 +604,12 @@ static int xattr_tdb_unlinkat(vfs_handle_struct *handle,
        } else {
                ret = SMB_VFS_NEXT_STAT(handle, full_fname);
                if (ret == -1 && (errno == ENOENT || errno == ELOOP)) {
-                       if (VALID_STAT(smb_fname->st) &&
-                                       S_ISLNK(smb_fname->st.st_ex_mode)) {
-                               /*
-                                * Original name was a link - Could be
-                                * trying to remove a dangling symlink.
-                                */
-                               ret = SMB_VFS_NEXT_LSTAT(handle, full_fname);
+                       /*
+                        * Could be trying to remove a dangling symlink.
+                        */
+                       ret = SMB_VFS_NEXT_LSTAT(handle, full_fname);
+                       if (ret == 0 && !S_ISLNK(full_fname->st.st_ex_mode)) {
+                               ret = -1;
                        }
                }
        }
diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c 
b/source3/rpc_server/dfs/srv_dfs_nt.c
index 8eaa59a8b0e..d8aeb76a1fb 100644
--- a/source3/rpc_server/dfs/srv_dfs_nt.c
+++ b/source3/rpc_server/dfs/srv_dfs_nt.c
@@ -97,7 +97,9 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r)
                                   remote_address,
                                   local_address,
                                   jn, &consumedcnt, &self_ref);
-       if(!NT_STATUS_IS_OK(status)) {
+       if(!NT_STATUS_IS_OK(status) &&
+          !NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND))
+       {
                return ntstatus_to_werror(status);
        }
 
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 137d9a1dacd..95869e054f3 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -639,6 +639,8 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
                        smb_fname->st.st_ex_mode = (smb_fname->st.st_ex_mode &
                                                    ~S_IFMT) |
                                                   S_IFDIR;
+                       smb_fname->fsp->fsp_name->st.st_ex_mode =
+                               smb_fname->st.st_ex_mode;
 
                        mode = dos_mode_msdfs(conn, dname, &smb_fname->st);
                        get_dosmode = false;
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 50cabb903bb..0cd0a822c94 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -2237,6 +2237,7 @@ planoldpythontestsuite("proclimitdc",
 
 planoldpythontestsuite("none", "samba.tests.usage")
 planpythontestsuite("fileserver", "samba.tests.dcerpc.mdssvc")
+planpythontestsuite("fileserver", "samba.tests.dcerpc.dfs")
 planoldpythontestsuite("none", "samba.tests.compression")
 planpythontestsuite("none", "samba.tests.security_descriptors")
 


-- 
Samba Shared Repository

Reply via email to