[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri Sep 8 17:25:01 UTC 2023


The branch, master has been updated
       via  ebb6eb9c2fc libsmb: Fix parsing symlink reparse points
       via  c9a000be417 tests: Add test_symlink_reparse_data_buffer_parse
       via  03ce770e8de tests: Create symlinks using posix extensions
      from  f893cf85cc3 security.idl: extend security token for claims

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


- Log -----------------------------------------------------------------
commit ebb6eb9c2fcab06eadea21cecb7258c326042fac
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 30 09:22:13 2023 +0200

    libsmb: Fix parsing symlink reparse points
    
    Untested code is broken code. For symlinks we need to hand over the
    full reparse buffer into symlink_reparse_buffer_parse(), as this is
    also used for the smb2 error response handling. For that, the
    "reserved" field in [MS-FSCC] 2.1.2.4 Symbolic Link Reparse Data
    Buffer is used for the "unparsed" field.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Sep  8 17:24:19 UTC 2023 on atb-devel-224

commit c9a000be41737d2946a4977dde3d5276a4577adf
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Sep 7 15:25:57 2023 +0200

    tests: Add test_symlink_reparse_data_buffer_parse
    
    The blob was taken from a smbclient allinfo command for a Windows
    symlink. Show that reparse_data_buffer_parse() is broken.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 03ce770e8de7d9992abea577bcb8d6b471953e91
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Sep 7 17:00:17 2023 +0200

    tests: Create symlinks using posix extensions
    
    This way we can run the tests and more easily put them into knownfail
    individually. Before this, everything went into the error category,
    which was not so easy to catch in something like knownfail.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 libcli/smb/reparse.c              |  4 ++--
 python/samba/tests/smb2symlink.py | 19 ++++++++++++++++++-
 selftest/knownfail.d/symlink      |  4 ++++
 selftest/skip                     |  1 -
 4 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 selftest/knownfail.d/symlink


Changeset truncated at 500 lines:

diff --git a/libcli/smb/reparse.c b/libcli/smb/reparse.c
index 61b893123a4..1c4ad444bfc 100644
--- a/libcli/smb/reparse.c
+++ b/libcli/smb/reparse.c
@@ -230,8 +230,8 @@ NTSTATUS reparse_data_buffer_parse(TALLOC_CTX *mem_ctx,
 	case IO_REPARSE_TAG_SYMLINK:
 		ret = symlink_reparse_buffer_parse(mem_ctx,
 						   &dst->parsed.lnk,
-						   reparse_data,
-						   reparse_data_length);
+						   buf,
+						   buflen);
 		if (ret != 0) {
 			return map_nt_error_from_unix_common(ret);
 		}
diff --git a/python/samba/tests/smb2symlink.py b/python/samba/tests/smb2symlink.py
index 14f6056ac15..a2084c6a5de 100644
--- a/python/samba/tests/smb2symlink.py
+++ b/python/samba/tests/smb2symlink.py
@@ -34,10 +34,12 @@ class Smb2SymlinkTests(samba.tests.libsmb.LibsmbTests):
                 self.server_ip,
                 share,
                 self.lp,
-                self.creds)
+                self.creds,
+                force_smb1=True)
         except NTSTATUSError as e:
             if e.args[0] != ntstatus.NT_STATUS_CONNECTION_RESET:
                 raise
+        smb1.smb1_posix()
 
         share = samba.tests.env_get_var_value(
             "SMB2_SHARE", allow_missing=True)
@@ -175,6 +177,21 @@ class Smb2SymlinkTests(samba.tests.libsmb.LibsmbTests):
 
         self.clean_file(smb1, symlink)
 
+    def test_symlink_reparse_data_buffer_parse(self):
+        """Test parsing a symlink reparse buffer coming from Windows"""
+
+        buf = (b'\x0c\x00\x00\xa0\x18\x00\x00\x00'
+               b'\x06\x00\x06\x00\x00\x00\x06\x00'
+               b'\x01\x00\x00\x00\x62\x00\x61\x00'
+               b'\x72\x00\x62\x00\x61\x00\x72\x00')
+
+        try:
+            syml = reparse_symlink.symlink_get(buf);
+        except:
+            self.fail("Could not parse symlink buffer")
+
+        self.assertEqual(syml, ('bar', 'bar', 0, 1));
+
 if __name__ == '__main__':
     import unittest
     unittest.main()
diff --git a/selftest/knownfail.d/symlink b/selftest/knownfail.d/symlink
new file mode 100644
index 00000000000..64135666aec
--- /dev/null
+++ b/selftest/knownfail.d/symlink
@@ -0,0 +1,4 @@
+^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlinkerror_directory
+^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlinkerror_file
+^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlinkerror_absolute_outside_share
+^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlinkerror_absolute_inshare
diff --git a/selftest/skip b/selftest/skip
index e808367c00d..cc2fe8979e8 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -147,5 +147,4 @@ bench # don't run benchmarks in our selftest
 ^samba4.smb2.tcon.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
 ^samba4.smb2.mkdir.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
 ^samba.tests.reparsepoints.*
-^samba.tests.smb2symlink.*
 ^samba3.blackbox.open-eintr.*


-- 
Samba Shared Repository



More information about the samba-cvs mailing list