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

Re: (ITS#3487) setting LDAP_OPT_NETWORK_TIMEOUT twice causes SIGSEGV



Please provide a stack backtrace (gdb 'bt') showing precisely
where the SIGSEGV occurred.

Kurt

At 02:58 AM 1/15/2005, andrew@entri.com.ua wrote:
>Full_Name: Andrew Kozachenko
>Version: 2.2.20
>OS: Linux FC1
>URL: ftp://ftp.openldap.org/incoming/
>Submission from: (NULL) (195.135.196.145)
>
>
>Here is the client code wich causes SIGSEGV:
>
>LDAP* ldap_connect(char *host, int port, char* dn, char* pw){
>        LDAP *ld;
>        int rc, version;
>        struct timeval timeOut = {10,0};
>
>        version = LDAP_VERSION3;
>        ldap_set_option( NULL, LDAP_OPT_PROTOCOL_VERSION, &version);
>        ldap_set_option( NULL, LDAP_OPT_NETWORK_TIMEOUT, &timeOut);
>
>        if (( ld = ldap_init( host, port )) == NULL){
>                fprintf ( stderr, "LDAP session initialization failed\n");
>                return NULL;
>        }
>
>        rc = ldap_simple_bind_s( ld, NULL, NULL );
>        if (rc != LDAP_SUCCESS ){
>                fprintf( stderr, "ldap_simple_bind_s: %s\n", ldap_err2string( rc
>));
>                ldap_unbind_s ( ld );
>                return NULL;
>
>        }
>        return ld;
>}
>        ...
>        ld = ldap_connect("192.168.8.9", 389, NULL, NULL);
>        ...
>        ldap_unbind_s(ld);
>        ...
>        ld = ldap_connect("192.168.8.9", 389, NULL, NULL);/*oops SIGSEGV*/
>
>It only happens when ldap_set_option( NULL, LDAP_OPT_NETWORK_TIMEOUT, &timeOut)
>called twice in separate function. It seems that openldap lib tries to use old
>timeval set by previous call wich is not valid anymore.
>Reproduced with libldap both 2.0 and 2.2.