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

Re: problem with blocking ldap_bind



On Tue, Jul 16, 2002 at 11:09:13AM +0200, Helmut Lehner wrote:
> I have a problem with the blocking ldap_simple_bind_s function.
> I know that ldap_simple_bind_s is a synchronous call, but is it possible 
> to set a timeout, after the call returns for sure?

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);
  [...]
}

The API is quite inconsistent here, as there are _st calls for every LDAP
operation except for BIND.

> I found some hints about LDAP_OPT_NETWORK_TIMEOUT, but the call still 
> blocks longer than specified.
> How does LDAP_OPT_NETWORK_TIMEOUT work?

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

regards,
-- 
Lars Uffmann, <lars.uffmann@mediaways.net>, fon: +49 5246 80 1330