From: Volker Lendecke Date: Mon, 23 Sep 2024 17:37:15 +0000 (+0200) Subject: tests: Check that we return the posix type in query_directory X-Git-Tag: tdb-1.4.13~1057 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=83794d08bc39c74caebebd8dee4cc3f207ed90c5;p=thirdparty%2Fsamba.git tests: Check that we return the posix type in query_directory Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py index 5a005889298..612a54e0f79 100644 --- a/python/samba/tests/smb3unix.py +++ b/python/samba/tests/smb3unix.py @@ -297,18 +297,28 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests): for fname,perm in test_files.items(): self.assertIn(get_string(fname), found_files.keys(), 'Test file not found') - self.assertEqual(test_files[fname], found_files[fname]['perms'], + + found_unixmode = found_files[fname]['perms'] + found_perms = found_unixmode & (stat.S_IRWXU| + stat.S_IRWXG| + stat.S_IRWXO| + stat.S_ISUID| + stat.S_ISGID| + stat.S_ISVTX) + + self.assertEqual(test_files[fname], found_perms, 'Requested %04o, Received %04o' % \ - (test_files[fname], found_files[fname]['perms'])) + (test_files[fname], found_perms)) self.assertEqual(found_files[fname]['reparse_tag'], libsmb.IO_REPARSE_TAG_RESERVED_ZERO) - self.assertEqual(found_files[fname]['perms'], perm) + self.assertEqual(found_perms, perm) self.assertEqual(found_files[fname]['owner_sid'], self.samsid + "-1000") self.assertTrue(found_files[fname]['group_sid'].startswith("S-1-22-2-")) if fname.startswith("testfile"): + self.assertTrue(stat.S_ISREG(found_unixmode)) self.assertEqual(found_files[fname]['nlink'], 1) self.assertEqual(found_files[fname]['size'], 4) self.assertEqual(found_files[fname]['allocaction_size'], @@ -316,6 +326,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests): self.assertEqual(found_files[fname]['attrib'], libsmb.FILE_ATTRIBUTE_ARCHIVE) else: + self.assertTrue(stat.S_ISDIR(found_unixmode)) # Note: btrfs always reports the link count of directories as one. if self.fstype == "btrfs": self.assertEqual(found_files[fname]['nlink'], 1) diff --git a/selftest/knownfail.d/smb3unix b/selftest/knownfail.d/smb3unix new file mode 100644 index 00000000000..59920f281b7 --- /dev/null +++ b/selftest/knownfail.d/smb3unix @@ -0,0 +1 @@ +samba.tests.smb3unix.samba.tests.smb3unix.Smb3UnixTests.test_posix_perm_files