diff --git a/selftest/knownfail.d/ldap b/selftest/knownfail.d/ldap index 5bb01bc38bf..0331d3687d4 100644 --- a/selftest/knownfail.d/ldap +++ b/selftest/knownfail.d/ldap @@ -1,2 +1,3 @@ # the attributes too long test returns the wrong error -^samba4.ldap.python.+test_attribute_ranges_too_long \ No newline at end of file +^samba4.ldap.python.+test_attribute_ranges_too_long +samba4.ldap.python\(ad_dc_default\).*__main__.BasicTests.test_ldapSearchNoAttributes diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index b46d3a1a4b7..9b43daa5891 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -3175,6 +3175,23 @@ nTSecurityDescriptor:: """ + desc_base64 self.assertTrue(len(res[0]["msTSExpireDate"]) == 1) self.assertEquals(str(res[0]["msTSExpireDate"][0]), v_get) + def test_ldapSearchNoAttributes(self): + """Testing ldap search with no attributes""" + + user_name = "testemptyattributesuser" + user_dn = "CN=%s,%s" % (user_name, self.base_dn) + delete_force(self.ldb, user_dn) + + self.ldb.add({"dn": user_dn, + "objectClass": "user", + "sAMAccountName": user_name}) + + res = self.ldb.search(user_dn, scope=SCOPE_BASE, attrs=[]) + delete_force(self.ldb, user_dn) + + self.assertEqual(len(res), 1) + self.assertEqual(len(res[0]), 0) + class BaseDnTests(samba.tests.TestCase):