From 9be1c8e40a6939873920303d877b3fdb79ae0789 Mon Sep 17 00:00:00 2001 From: Joe Guo Date: Wed, 18 Apr 2018 15:36:02 +1200 Subject: [PATCH] traffic: add paged_results control for ldb search 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 --- python/samba/emulate/traffic.py | 1 + python/samba/emulate/traffic_packets.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index afb57da36f0..ea0529c4cb4 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -343,6 +343,7 @@ def generate_ldap_search_tables(self): 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 diff --git a/python/samba/emulate/traffic_packets.py b/python/samba/emulate/traffic_packets.py index 688c935cdc0..25a02f63c2b 100644 --- a/python/samba/emulate/traffic_packets.py +++ b/python/samba/emulate/traffic_packets.py @@ -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