Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - How to limit the number of results #431

Closed
abolinhas opened this issue Apr 21, 2023 · 6 comments
Closed

Question - How to limit the number of results #431

abolinhas opened this issue Apr 21, 2023 · 6 comments
Labels

Comments

@abolinhas
Copy link

Hi
I have a big active directory with a lot of entries, what i prented to achive with go-ldap is to retrive only the first 50 results.
I already try the size limit option or paging but always return all results.
Anyone can help me to limit the number of results per search?
Best regards

@cpuschma
Copy link
Member

cpuschma commented May 5, 2023

Hi,

SizeLimit should do the trick usually. Are you querying using SearchWithPaging or a normal search request? Additionally, you can reduce the search scope to one organizational unit and enumerate over them one by one if necessary until you hit your limit

@VakarisZ
Copy link

For me sizeLimit does nothing:
image

@VakarisZ
Copy link

VakarisZ commented Aug 1, 2023

LdapSearch -z option does nothing also. I think this has something to do with the ldap setup, not a bug in this package

@GuoFlight
Copy link

I have the same problem.

@cpuschma
Copy link
Member

I can replicate this issue, but it is not an implementation issue of the library. I analyzed the traffic with Wireshark and the SizeLimit attribute is correctly set and sent to the server.

I've created a patch and a PR to optionally enforce a size limit.

@cpuschma
Copy link
Member

See #482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants