From: David Mulder Date: Thu, 3 Nov 2022 16:28:58 +0000 (-0600) Subject: s3: Test that store_smb2_posix_info hides info for '..' X-Git-Tag: talloc-2.4.0~462 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbc82a5d425ad51a269e1ab8e4db859943fcc4ff;p=thirdparty%2Fsamba.git s3: Test that store_smb2_posix_info hides info for '..' Signed-off-by: David Mulder Reviewed-by: Volker Lendecke --- diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py index 7dc5cb3f348..3ad49af09fa 100644 --- a/python/samba/tests/smb3unix.py +++ b/python/samba/tests/smb3unix.py @@ -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() diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index bb342bcd96f..3d8bb14bb78 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -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.