-
Notifications
You must be signed in to change notification settings - Fork 6
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
ldap_result() doesn't honour passed timeout value. #20
Comments
Hum. Note that I've tested the knock-on impact to using next_changed_entries() in a tree with ldap_result() fixed. However, if the OpenLDAP C documentation for ldap_result() is correct and a NULL parameter being passed uses the value set with LDAP_OPT_TIMEOUT, then it should be possible to prove next_changed_entries() is broken on a non-modified build by setting a timeout like this. However, this does not appear to work. Investigating ldap_set_option(), it appears to do a fairly naive "just send this data to the function" - which works fine for pretty much most of the options supported by Mozilla LDAP. But OpenLDAP's support for 'struct timeval' options for LDAP_OPT_TIMEOUT and LDAP_OPT_NETWORK_TIMEOUT wouldn't work like this, and this is supported by ldap_set_option() returning -1. |
…meout - Fixes #20: ldap_result() doesn't honour passed t…
* New upstream release. * Fix undef comparison * Misc variable initializations to quiet warnings * Fixed sasl mechanisms initializtion * Examples cleanup * LDAPv3 extended operation support * New developer mode test suite * Fixed quanah/net-ldapapi#3: ldap_set_rebind_proc XS being called with invalid arguments from set_rebind_proc * Fixed quanah/net-ldapapi#6: ldap_sasl_bind has wrong prototype in LDAPapi.xs * Fixed quanah/net-ldapapi#8: search_s() clobbers ATTRS parameter * Fixed quanah/net-ldapapi#11: result() blocking when called with output from rename() * Fixed quanah/net-ldapapi#20: ldap_result() doesn't honour passed timeout value * Fixed quanah/net-ldapapi#21: ldap_set_option(LDAP_OPT_TIMEOUT, 1) on OpenLDAP returns -1 * Fixed quanah/net-ldapapi#28: Server control responses get eaten after a NULL character in the berval * Fixed quanah/net-ldapapi#30: ldap_search_ext() and ldap_search_ext_s() segfault when used with timeout * Fixed quanah/net-ldapapi#31: ldap_result() and ldap_url_search_st() timeout parameters have a granularity of 1 second * Fixed quanah/net-ldapapi#40: Server control requests get eaten after a NULL character in the berval * Correct merge problem with POD error. * Update standards version to 3.9.8 (no changes required). [dgit import package libnet-ldapapi-perl 3.0.4-1]
This code blocks indefinitely:
LDAPapi.xs has this:
The NULL parameter being passed is the timeout.
The result of this is that on OpenLDAP ldap_result() will use whatever has been set by ldap_set_options(), with the default being to wait forever (equivalent to timeout being set to -1), while Mozilla LDAP's ldap_result() will just wait forever.
In effect, synchronous operations work perfectly - but the asynchronous API does not - once ldap_result() is called, it's synchronous for the scope of of the all parameter unless a timeout has been set by ldap_set_options().
Note that fixing this has a knock-on impact to actually using next_changed_entries() in a timeout environment as next_changed_entries() does not support the case where a timeout has occurred.
I'll create a pull request to resolve both these things. Happily the test suite in #5 will already test the majority of the frequently consumed synchronous and asynchronous API .
The text was updated successfully, but these errors were encountered: