@@ -150,24 +150,32 @@ def execute(self, quals, columns):
150150 val = qual .value
151151 request = unicode_ ("(&%s(%s=%s))" ) % (
152152 request , qual .field_name , val )
153- self .ldap .search (
154- self .path , request , self .scope ,
155- attributes = list (self .field_definitions ))
156- for entry in self .ldap .response :
157- # Case insensitive lookup for the attributes
158- litem = dict ()
159- for key , value in entry ["attributes" ].items ():
160- if key .lower () in self .field_definitions :
161- pgcolname = self .field_definitions [key .lower ()].column_name
162- if ldap3 .version .__version__ > '2.0.0' :
163- value = value
164- else :
165- if pgcolname in self .array_columns :
153+ cookie = None
154+ while True :
155+ self .ldap .search (
156+ self .path , request , self .scope ,
157+ attributes = list (self .field_definitions ),
158+ paged_size = 1000 ,
159+ paged_cookie = cookie )
160+ for entry in self .ldap .response :
161+ # Case insensitive lookup for the attributes
162+ litem = dict ()
163+ for key , value in entry ["attributes" ].items ():
164+ if key .lower () in self .field_definitions :
165+ pgcolname = self .field_definitions [key .lower ()].column_name
166+ if ldap3 .version .__version__ > '2.0.0' :
166167 value = value
167168 else :
168- value = value [0 ]
169- litem [pgcolname ] = value
170- yield litem
169+ if pgcolname in self .array_columns :
170+ value = value
171+ else :
172+ value = value [0 ]
173+ litem [pgcolname ] = value
174+ yield litem
175+ # pagedResultsControl, see RFC 2696
176+ cookie = self .ldap .result ['controls' ]['1.2.840.113556.1.4.319' ]['value' ]['cookie' ]
177+ if not cookie :
178+ break
171179
172180 def parse_scope (self , scope = None ):
173181 if scope in (None , "" , "one" ):
0 commit comments