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

ldap_simple_bind() can't return immediately?



dear Pierangelo Masarati:
 thank you for your response.
now  i have call ldap_simple_bind() function  but it will return for a long time(almost  60    seconds, and i am working in linux redhat as 4, openldap2.2),
 but  the man doc says this is a asyschronized function, any option should
 i set the pLdapConnection ?
 
 
 if ((msgid = ldap_simple_bind(pLdapConnection, pUserDN, pPassword)) == -1)
/*ldap_simple_bind() return for 60 seconds if the server wrong or down.*/
...
...
 ret = ldap_result(pLdapConnection, msgid, LDAP_MSG_ALL, &     tv_select_timeout, &result);

cheers, 

lijx

> -----Original Message-----
> From: Pierangelo Masarati [mailto:ando@sys-net.it]
> Sent: Saturday, April 19, 2008 5:41 AM
> To: lijx
> Cc: openldap-technical@openldap.org
> Subject: 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
> > LDAP_OPT_TIMEOUT opt,
> >
> > 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.
>
> p.
>
>
>
> Ing. Pierangelo Masarati
> OpenLDAP Core Team
>
> SysNet s.r.l.
> via Dossi, 8 - 27100 Pavia - ITALIA
> http://www.sys-net.it
> ---------------------------------------
> Office:  +39 02 23998309
> Mobile:  +39 333 4963172
> Email:   pierangelo.masarati@sys-net.it
> ---------------------------------------