Skip to content

Commit

Permalink
Fix problem with missing LDAP batching cookie in search
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Apr 16, 2019
1 parent fcf2716 commit a97e1b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ History
1.0b9 (unreleased)
------------------

- Fix problem with missing LDAP batching cookie in search.
[jensens]

- Remove ``smbpasswd`` dependency. Use ``passlib`` instead.
[rnix]

Expand Down
8 changes: 6 additions & 2 deletions src/node/ext/ldap/ugm/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def raw_search(self, criteria=None, attrlist=None,
)
except ldap.NO_SUCH_OBJECT: # pragma: no cover
return []
if type(results) is tuple:
if isinstance(results, tuple):
results, cookie = results
if attrlist is not None:
_results = list()
Expand All @@ -630,14 +630,18 @@ def search(self, criteria=None, attrlist=None,
result = []
cookie = None
while True:
chunk, cookie = self.raw_search(
chunk_cookie = self.raw_search(
criteria=criteria,
attrlist=attrlist,
exact_match=exact_match,
or_search=or_search,
page_size=self.context.ldap_session._props.page_size,
cookie=cookie
)
if isinstance(chunk_cookie, tuple):
chunk, cookie = chunk_cookie
else:
chunk, cookie = chunk_cookie, None
result += chunk
if not cookie:
break
Expand Down

0 comments on commit a97e1b8

Please sign in to comment.