CVE-2018-10919 tests: test ldap searches for non-existent attributes.
[metze/samba/wip.git] / source4 / dsdb / tests / python / ldap.py
index 815a2c00e6491276fbffd0b96088b01574f4de0a..ea6f30fa5e301716a7496fdec9e22243a5281924 100755 (executable)
@@ -627,6 +627,15 @@ class BasicTests(samba.tests.TestCase):
             (num, _) = e27.args
             self.assertEquals(num, ERR_NO_SUCH_ATTRIBUTE)
 
+        #
+        # When searching the unknown attribute should be ignored
+        expr = "(|(cn=ldaptestgroup)(thisdoesnotexist=x))"
+        res = ldb.search(base=self.base_dn,
+                         expression=expr,
+                         scope=SCOPE_SUBTREE)
+        self.assertTrue(len(res) == 1,
+                        "Search including unknown attribute failed")
+
         delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
 
         # attributes not in objectclasses and mandatory attributes missing test