[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldapbind() timeout can't work .

lijx wrote:
LDAP APIS confused me, anyone can tell my what's wrong with my code?

I have call ldap_set_option() and set the LDAP_OPT_NETWORK_TIMEOUT or the

before call the ldap_bind_s() or the non synchronize APIS, but the
authentication result still return after almost 70

seconds later, am I miss something (note: my server is windows active
directory, simple authentication.)?

LDAP_OPT_NETWORK_TIMEOUT olny acts at the connection level, which apparently is established successfully. ldap_bind_s(), which BTW is deprecated in favor of ldap_sasl_bind_s(), does not allow any timeout while waiting for response. Until OpenLDAP 2.3, the LDAP_OPT_TIMEOUT was not honored; only calling ldap_result() with an explicit timeout would allow to time out requests taking too long. The only way to make use of a timeout was to use the asynchronous API, as done in the code you submitted when BIND_TIME_CONTROL is defined. Since OpenLDAP 2.4, LDAP_OPT_TIMEOUT is honored by the library. Unfortunately you didn't specify what version of the API you're using.


Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Email:   pierangelo.masarati@sys-net.it