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

problem with blocking ldap_bind



Hi!

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?


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


I'm using OpenLDAP 2.0.25.

thanks in advance
Helmut Lehner

This is a small snippet from my example-code.
/* Code snippet */

....

if ((ld=ldap_init("ldap1",LDAP_PORT)) == NULL) {
    printf("ldap_init\n");
    return 1;
}

t1.tv_sec=5;
t1.tv_usec=0;

if (ldap_set_option(ld,LDAP_OPT_NETWORK_TIMEOUT,&t1)!=LDAP_OPT_SUCCESS){
    printf("error ldap_set_option\n");
}

if ((rc=ldap_simple_bind_s(ld,"who" ,"password")) != LDAP_SUCCESS ) {
    perror("LDAP: ldap_bind_s");
    ldap_unbind(ld);
    return 1;
}
...
/*end code */