From bc1583d368902c2e384ed0080c8de003b982a6f7 Mon Sep 17 00:00:00 2001 From: Aaron Haslett Date: Thu, 28 Mar 2019 15:54:06 +1300 Subject: [PATCH] selftest: correcting empty attribute usage in requests Many parts of Samba use an empty attribute list in requests expecting all attributes to be returned in the response, which is incorrect. This patch corrects the instances found by current CI tests. Static analysis and debugging will need to be done before changing ildap to the correct semantics. Signed-off-by: Aaron Haslett Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett Autobuild-User(master): Garming Sam Autobuild-Date(master): Mon May 6 05:45:55 UTC 2019 on sn-devel-184 --- python/samba/tests/samba_tool/computer.py | 2 +- python/samba/tests/samba_tool/group.py | 3 +-- python/samba/tests/samba_tool/ou.py | 3 +-- python/samba/tests/samba_tool/user.py | 2 +- source4/dsdb/tests/python/sec_descriptor.py | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/python/samba/tests/samba_tool/computer.py b/python/samba/tests/samba_tool/computer.py index 38ea5f774c4..6b06d4f32f6 100644 --- a/python/samba/tests/samba_tool/computer.py +++ b/python/samba/tests/samba_tool/computer.py @@ -282,7 +282,7 @@ class ComputerCmdTestCase(SambaToolCmdTest): self.samdb.domain_dn())) computerlist = self.samdb.search(base=self.samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE, - expression=search_filter, attrs=[]) + expression=search_filter) if computerlist: return computerlist[0] else: diff --git a/python/samba/tests/samba_tool/group.py b/python/samba/tests/samba_tool/group.py index 9862251ff01..e521c720b77 100644 --- a/python/samba/tests/samba_tool/group.py +++ b/python/samba/tests/samba_tool/group.py @@ -243,8 +243,7 @@ class GroupCmdTestCase(SambaToolCmdTest): self.samdb.domain_dn())) grouplist = self.samdb.search(base=self.samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE, - expression=search_filter, - attrs=[]) + expression=search_filter) if grouplist: return grouplist[0] else: diff --git a/python/samba/tests/samba_tool/ou.py b/python/samba/tests/samba_tool/ou.py index d318fd3ff85..39b0cad4250 100644 --- a/python/samba/tests/samba_tool/ou.py +++ b/python/samba/tests/samba_tool/ou.py @@ -264,8 +264,7 @@ class OUCmdTestCase(SambaToolCmdTest): self.samdb.domain_dn())) oulist = self.samdb.search(base=self.samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE, - expression=search_filter, - attrs=[]) + expression=search_filter) if oulist: return oulist[0] else: diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py index 1816b895de4..7ae80876b2a 100644 --- a/python/samba/tests/samba_tool/user.py +++ b/python/samba/tests/samba_tool/user.py @@ -592,7 +592,7 @@ sAMAccountName: %s search_filter = "(&(sAMAccountName=%s)(objectCategory=%s,%s))" % (ldb.binary_encode(name), "CN=Person,CN=Schema,CN=Configuration", self.samdb.domain_dn()) userlist = self.samdb.search(base=self.samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE, - expression=search_filter, attrs=[]) + expression=search_filter) if userlist: return userlist[0] else: diff --git a/source4/dsdb/tests/python/sec_descriptor.py b/source4/dsdb/tests/python/sec_descriptor.py index 5e0f1453423..a495356ac48 100755 --- a/source4/dsdb/tests/python/sec_descriptor.py +++ b/source4/dsdb/tests/python/sec_descriptor.py @@ -1847,7 +1847,7 @@ class SdFlagsDescriptorTests(DescriptorTests): self.assertFalse("nTSecurityDescriptor" in res[0]) res = self.ldb_admin.search(self.base_dn, SCOPE_BASE, None, - [], controls=["sd_flags:1:%d" % (sd_flags)]) + controls=["sd_flags:1:%d" % (sd_flags)]) self.assertTrue("nTSecurityDescriptor" in res[0]) tmp = res[0]["nTSecurityDescriptor"][0] sd = ndr_unpack(security.descriptor, tmp)