From: Volker Lendecke Date: Mon, 23 Sep 2024 16:23:43 +0000 (+0200) Subject: tests: Check that posix extensions return the file type X-Git-Tag: tdb-1.4.13~1059 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3b63170f506114a556fad31cba6a4f1922944e39;p=thirdparty%2Fsamba.git tests: Check that posix extensions return the file type We'll need to check more, but this is a start Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py index 6c04eed0403..5a005889298 100644 --- a/python/samba/tests/smb3unix.py +++ b/python/samba/tests/smb3unix.py @@ -26,6 +26,7 @@ from samba.dcerpc.security import dom_sid from samba import reparse_symlink import os import subprocess +import stat def posix_context(mode): return (libsmb.SMB2_CREATE_TAG_POSIX, mode.to_bytes(4, 'little')) @@ -69,6 +70,13 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests): return (conn1, conn2) + def wire_mode_to_unix(self, wire): + mode = libsmb.wire_mode_to_unix(wire) + type = stat.S_IFMT(mode) + perms = mode & (stat.S_IRWXU|stat.S_IRWXG|stat.S_IRWXO| + stat.S_ISUID|stat.S_ISGID|stat.S_ISVTX) + return (type, perms) + def test_negotiate_context_posix(self): c = libsmb.Conn( self.server_ip, @@ -384,7 +392,11 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests): self.assertEqual(cc.nlinks, 2) self.assertEqual(cc.reparse_tag, libsmb.IO_REPARSE_TAG_RESERVED_ZERO) - self.assertEqual(cc.posix_mode, 0o700) + + (type, perms) = self.wire_mode_to_unix(cc.posix_mode); + self.assertEqual(type, stat.S_IFDIR) + self.assertEqual(perms, 0o700) + self.assertEqual(cc.owner, dom_sid(self.samsid + "-1000")) self.assertTrue(str(cc.group).startswith("S-1-22-2-")) diff --git a/selftest/knownfail.d/smb3unix b/selftest/knownfail.d/smb3unix new file mode 100644 index 00000000000..1bbd7f7ccf7 --- /dev/null +++ b/selftest/knownfail.d/smb3unix @@ -0,0 +1 @@ +samba.tests.smb3unix.samba.tests.smb3unix.Smb3UnixTests.test_create_context_basic1