RE: timeout on ldap_simple_bind_s()
"Xu, Qiang (FXSGSC)" <[email protected]> Sat, 12 Sep 2009 14:59:38 +0800
| Newsgroups | gmane.comp.mozilla.devel.directory |
|---|---|
| Message-ID | <D8C9BC7FFCF8154FB7141EB8DB609C172F0C105AAF@SGPAPHQ-EXSCC01.dc01.fujixerox.net> |
> -----Original Message----- > From: [email protected] [mailto:[email protected]] > Sent: Friday, September 11, 2009 8:03 PM > To: Xu, Qiang (FXSGSC) > Cc: [email protected] > Subject: Re: timeout on ldap_simple_bind_s() > > > if you are using NSPR there you should try setting [before init calls] > > prldap_set_session_option( NULL, NULL, PRLDAP_OPT_IO_MAX_TIMEOUT, 5000 /* 5s */); > > and see if that helps to get it to timeout in about 5 seconds. Gosh, it works! =============================================== <distribution> (Sat Sep 12 2009 14:34:32.667) <p578,t813147760,aba_ldap_interface.c,1396> INFO>> Secure Login <distribution> (Sat Sep 12 2009 14:34:32.667) <p578,t813147760,aba_ldap_interface.c,5886> INFO>> debug ldap_simple_bind_ext_s timeout = 10 <distribution> (Sat Sep 12 2009 14:34:32.667) <p578,t813147760,aba_ldap_interface.c,5890> INFO>> debug ldap_simple_bind_ext_s --1 <distribution> (Sat Sep 12 2009 14:34:37.665) <p578,t813147760,aba_ldap_interface.c,1407> INFO>> ldap_simple_bind_ext_s return 91 <distribution> (Sat Sep 12 2009 14:34:37.665) <p578,t813147760,aba_ldap_interface.c,1412> INFO>> LDAP BIND: Value of ldapStatus 91 <distribution> (Sat Sep 12 2009 14:34:37.665) <p578,t813147760,aba_ldap_interface.c,1481> ERROR>> LDAP BIND: Value of ldap failure status and text 91 Can't connect to the LDAP server =============================================== You can notice the time interval is around 5 seconds (14:34:37.665 - 14:34:32.667). That's exactly what I want. :-) > otherwise the stack trace is useless, i cant tell anything from it. Still, I am curious about on when the following code will take effect: =============================================== static int ldap_simple_bind_ext_s( LDAP *ld, const char *dn, const char *passwd, struct timeval *timeout ) { int msgid; LDAPMessage *result; LOGINFO("debug ldap_simple_bind_ext_s timeout = %d ", timeout->tv_sec ); if ( ld == NULL ) { return( LDAP_PARAM_ERROR ); } LOGINFO("debug ldap_simple_bind_ext_s --1" ); if ( (msgid = ldap_simple_bind( ld, dn, passwd )) == -1 ) return( ldap_get_lderrno( ld, NULL, NULL ) ); LOGINFO("debug ldap_simple_bind_ext_s --2 "); if ( ldap_result( ld, msgid, 1, timeout, &result ) == -1 ) return( ldap_get_lderrno( ld, NULL, NULL ) ); LOGINFO("debug ldap_simple_bind_ext_s --3" ); return( ldap_result2error( ld, result, 1 ) ); } =============================================== It just seems to me that the behavior of ldap_simple_bind() is almost identical to the behavior of ldap_simple_bind_s(). It shouldn't be, right? Could you hightlight more on this issue, Anton? Thanks a lot for your help, Xu Qiang