s3: Test that store_smb2_posix_info hides info for '..'
authorDavid Mulder <dmulder@samba.org>
Thu, 3 Nov 2022 16:28:58 +0000 (10:28 -0600)
committerVolker Lendecke <vl@samba.org>
Tue, 29 Nov 2022 10:26:38 +0000 (10:26 +0000)
Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
python/samba/tests/smb3unix.py
source3/libsmb/pylibsmb.c

index 7dc5cb3f3482bcb2d6558da80a1daf417b9d9d7a..3ad49af09fabc85493323da769162d8776ab5e4c 100644 (file)
@@ -185,7 +185,7 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
             actual_count = len(c.list('',
                                 info_level=libsmb.SMB2_FIND_POSIX_INFORMATION,
                                 posix=True))
-            self.assertEqual(actual_count, expected_count,
+            self.assertEqual(actual_count-2, expected_count,
                              'SMB2_FIND_POSIX_INFORMATION failed to list contents')
 
         finally:
@@ -336,3 +336,27 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
                 self.delete_test_file(c, '\\%s' % fname)
 
             self.disable_smb3unix()
+
+    def test_share_root_null_sids_fid(self):
+        try:
+            self.enable_smb3unix()
+
+            c = libsmb.Conn(
+                self.server_ip,
+                "smb3_posix_share",
+                self.lp,
+                self.creds,
+                posix=True)
+            self.assertTrue(c.have_posix())
+
+            res = c.list("", info_level=100, posix=True)
+            found_files = {get_string(i['name']): i for i in res}
+            dotdot = found_files['..']
+            self.assertEqual('S-1-0-0', dotdot['owner_sid'],
+                             'The owner sid for .. was not NULL')
+            self.assertEqual('S-1-0-0', dotdot['group_sid'],
+                             'The group sid for .. was not NULL')
+            self.assertEqual(0, dotdot['ino'], 'The ino for .. was not 0')
+            self.assertEqual(0, dotdot['dev'], 'The dev for .. was not 0')
+        finally:
+            self.disable_smb3unix()
index bb342bcd96f666674ac838b49d40c59001d93bf6..3d8bb14bb78370c1b2d5fc30df707a761e246b67 100644 (file)
@@ -1901,10 +1901,6 @@ static NTSTATUS list_posix_helper(struct file_info *finfo,
        PyObject *size = NULL;
        int ret;
 
-       /* suppress '.' and '..' in the results we return */
-       if (ISDOT(finfo->name) || ISDOTDOT(finfo->name)) {
-               return NT_STATUS_OK;
-       }
        size = PyLong_FromUnsignedLongLong(finfo->size);
        /*
         * Build a dictionary representing the file info.