Skip to content

Commit

Permalink
CVE-2023-4154 dsdb/tests: Speed up DirSync test by only checking posi…
Browse files Browse the repository at this point in the history
…tive 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 <[email protected]>
  • Loading branch information
abartlet authored and Jule Anger committed Oct 10, 2023
1 parent 76b8d3e commit d4a71fb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source4/dsdb/tests/python/confidential_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,13 @@ def assert_search_result(self, expected_num, expr, samdb, base_dn=None):
# 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,
Expand Down

0 comments on commit d4a71fb

Please sign in to comment.