1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

CVE-2023-4154 dsdb/tests: Speed up DirSync test by only checking positive matches once

When we (expect to) get back a result, do not waste time against a potentially
slow server confirming we also get back results for all the other attribute
combinations.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15424

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andrew Bartlett 2023-08-08 11:18:46 +12:00 committed by Jule Anger
parent 76b8d3edce
commit d4a71fbece

View File

@ -742,7 +742,13 @@ class ConfidentialAttrTestDirsync(ConfidentialAttrCommon):
# want to weed out results from any previous test runs
search = "(&{0}{1})".format(expr, self.extra_filter)
for attr in self.attr_filters:
# If we expect to return multiple results, only check the first
if expected_num > 0:
attr_filters = [self.attr_filters[0]]
else:
attr_filters = self.attr_filters
for attr in attr_filters:
res = samdb.search(base_dn, expression=search, scope=SCOPE_SUBTREE,
attrs=attr, controls=self.dirsync)
self.assertEqual(len(res), expected_num,