From: Andrew Bartlett Date: Wed, 2 Aug 2023 01:40:03 +0000 (+1200) Subject: selftest: Add test for combination of anr and paged_results X-Git-Tag: tevent-0.16.0~1296 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c67534fe3ff1652dcf95eac2030778b066cdf7a4;p=thirdparty%2Fsamba.git 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 Reviewed-by: Stefan Metzmacher --- diff --git a/source4/dsdb/tests/python/vlv.py b/source4/dsdb/tests/python/vlv.py index 33b51557ed3..13fccba75c9 100644 --- a/source4/dsdb/tests/python/vlv.py +++ b/source4/dsdb/tests/python/vlv.py @@ -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):