handavid opened a new pull request, #1514: URL: https://github.com/apache/knox/pull/1514
[KNOX-3757](https://issues.apache.org/jira/browse/KNOX-3575) - LDAP Proxy passes sizelimit to backend ## What changes were proposed in this pull request? Thread the per-request size and time limits from the SearchOperationContext through UserSearchInterceptor into the backends. FileBackend respects sizeLimit by truncating results (timeLimit is not applicable to its in-memory lookups). LdapProxyBackend forwards timeLimit to the remote server on each page and enforces sizeLimit client-side, combined with the configured maxResultSetSize (smaller positive bound wins). A backward-compatible default search() overload delegates with no limits. ## How was this patch tested? Ran updated unit tests. Manually tested through ldapsearch with sizelimit against an Active Directory backend with ~500 users search w/o sizelimit for comparison ``` time ldapsearch -v -x -H ldap://localhost:3890 -D 'uid=bind2,ou=people,dc=proxy,dc=com' -w bind-password -E pr=250/noprompt -e "1.3.6.1.4.1.18060.18.0.1=AQH/" -b 'ou=people,DC=proxy,DC=com' -s sub '(objectClass=inetOrgPerson)' '*' ... # numResponses: 472 # numEntries: 470 ldapsearch -v -x -H ldap://localhost:3890 -D -w bind-password -E -e -b -s 0.01s user 0.02s system 0% cpu 6.726 total ``` search w/ sizelimit 10 prior to this change ``` time ldapsearch -v -x -H ldap://localhost:3890 -z 10 -D 'uid=bind2,ou=people,dc=proxy,dc=com' -w bind-password -E pr=250/noprompt -e "1.3.6.1.4.1.18060.18.0.1=AQH/" -b 'ou=people,DC=proxy,DC=com' -s sub '(objectClass=inetOrgPerson)' '*' ... # numEntries: 10 ldapsearch -v -x -H ldap://localhost:3890 -z 10 -D -w bind-password -E -e 0.01s user 0.01s system 0% cpu 6.075 total ``` search w/ sizelimit 10 after this change ``` time ldapsearch -v -x -H ldap://localhost:3890 -z 10 -D 'uid=bind2,ou=people,dc=proxy,dc=com' -w bind-password -E pr=250/noprompt -e "1.3.6.1.4.1.18060.18.0.1=AQH/" -b 'ou=people,DC=proxy,DC=com' -s sub '(objectClass=inetOrgPerson)' '*' ... # numEntries: 10 ldapsearch -v -x -H ldap://localhost:3890 -z 10 -D -w bind-password -E -e 0.01s user 0.01s system 1% cpu 1.078 total ``` ## Integration Tests No integration tests were updated because this feature is not visible through the integration tests (other than potentially execution time) ## UI changes No UI changes -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
