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

Re: timeout for ldap_unbind()

> Newbie question here:
> After several days of scouring the newsgroups, LDAP documentation and source
> code I'm hoping someone on this distribution will be able to answer my
> question.
> I've been trying to figure out how to set a client-side timeout for
> ldap_unbind().  The session option, LDAP_OPT_TIMELIMIT, seems to only refer
> to searches, that is, if you can believe what you read, and is server-side
> anyway.
> For instance, when using ldap_bind(), you can pass a timeout in the
> parameters of ldap_result().  I've looked in the code and  ldap_unbind() and
> ldap_unbind_s() are basically, the same function.  Neither returns the LDAP
> message id required by ldap_result().
> Can this be done?  Can someone point be towards a solution?

I know is kinda misleading, but ldap_unbind is not the opposite of ldap_bind;
it is rather a "connection shutdown" operation. If you need to revert to
an anonymous binding, you may simply rebind with empty dn and credentials;
if you need to close a connection, then use ldap_unbind, which is always
synchronous and instantaneous; remember that you cannot use the LDAP*
descriptor any more; you need to re-initialize it (ldap_init).