]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
selftest: Add test for combination of anr and paged_results
authorAndrew Bartlett <abartlet@samba.org>
Wed, 2 Aug 2023 01:40:03 +0000 (13:40 +1200)
committerStefan Metzmacher <metze@samba.org>
Wed, 2 Aug 2023 11:16:41 +0000 (11:16 +0000)
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>
source4/dsdb/tests/python/vlv.py

index 33b51557ed31540be077e035ae62789ccf47ddbe..13fccba75c92c18964da8d5674367c51a92d700b 100644 (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):