traffic: add paged_results control for ldb search
authorJoe Guo <joeg@catalyst.net.nz>
Wed, 18 Apr 2018 03:36:02 +0000 (15:36 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 12 May 2018 00:09:28 +0000 (02:09 +0200)
While there are more then 1000 records in the search result from Windows,
a `LDAP_SIZE_LIMIT_EXCEEDED` error will be returned.

Add paged_results control to fix.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
python/samba/emulate/traffic.py
python/samba/emulate/traffic_packets.py

index afb57da36f08ac9baa4cbc02c09c500ae670619d..ea0529c4cb49c622c393cc25742aae697a7c1ebe 100644 (file)
@@ -343,6 +343,7 @@ class ReplayContext(object):
 
         res = db.search(db.domain_dn(),
                         scope=ldb.SCOPE_SUBTREE,
+                        controls=["paged_results:1:1000"],
                         attrs=['dn'])
 
         # find a list of dns for each pattern
index 688c935cdc09baf07af00ce0cbd0a6f465b9bd13..25a02f63c2b97749caa95c4869ee0696115732c7 100644 (file)
@@ -326,7 +326,10 @@ def packet_ldap_3(packet, conversation, context):
     samdb = context.get_ldap_connection()
     dn = context.get_matching_dn(dn_sig)
 
-    samdb.search(dn, scope=int(scope), attrs=attrs.split(','))
+    samdb.search(dn,
+                 scope=int(scope),
+                 attrs=attrs.split(','),
+                 controls=["paged_results:1:1000"])
     return True