1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

selftest: Add test for combination of anr and paged_results

This combination was known to cause a segfault in Samba 4.13, fixed by
5f0590362c5c0c5ee20503a67467f9be2d50e73b in later versions.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andrew Bartlett 2023-08-02 13:40:03 +12:00 committed by Stefan Metzmacher
parent 8f4c1c67b4
commit c67534fe3f

View File

@ -1754,6 +1754,27 @@ class PagedResultsTestsRW(PagedResultsTests):
(enum, estr) = e.args
self.assertEqual(enum, ldb.ERR_UNSUPPORTED_CRITICAL_EXTENSION)
def test_anr_paged(self):
"""Testing behaviour with anr= searches and paged_results set.
A problematic combination, as anr involves filter rewriting
"""
prefix = "anr"
num_users = 5
users = [self.create_user(i, num_users, prefix=prefix)
for i in range(num_users)]
expr = f"(|(anr={prefix})(&(objectClass=user)(facsimileTelephoneNumber={prefix}*)))"
results, cookie = self.paged_search(expr, page_size=1)
self.assertEqual(len(results), 1)
results, cookie = self.paged_search(expr, page_size=2, cookie=cookie)
self.assertEqual(len(results), 2)
results, cookie = self.paged_search(expr, page_size=2, cookie=cookie)
self.assertEqual(len(results), 2)
if "://" not in host:
if os.path.isfile(host):