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

RE: problem with blocking ldap_bind



> No, no as easy as with the other synchrounus function calls like
> ldap_search_st(), which accept a timeout parameter. You'll have to
> implement your own ldap_bind_st() using the asyncrounus function
> calls:
>
> int ldap_bind_st(LDAP *ld, char *whop, char *credp) {
>   int rc, msgid;
>   struct timeval tm;
>   LDAPMessage *res;
>   [...]
>   msgid = ldap_bind(ld, whop, credp, LDAP_AUTH_SIMPLE);
>   rc = ldap_result(ld, msgid, 1, &tm, &res);
>   [...]
> }

But ldap_bind still blocks too long for our purpose if there is no route to the LDAP-server, for example.


> LDAP_OPT_NETWORK_TIMEOUT specifies the maximum time to wait to establish > the TCP connection to the ldap server.

I also set the LDAP_OPT_NETWORK_TIMEOUT and ldap_bind hangs for a while (longer as specified in LDAP_OPT_NETWORK_TIMEOUT).

Is there maybe another option i have to set, so that the call is interrupted after a configurable time?


thanks Helmut