]> git.sur5r.net Git - openldap/commitdiff
Revert to original ldap_get_option( TIMEOUT ) behavior
authorHoward Chu <hyc@openldap.org>
Tue, 6 Feb 2007 23:02:47 +0000 (23:02 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 6 Feb 2007 23:02:47 +0000 (23:02 +0000)
libraries/libldap/options.c

index 8a46d53d328872b48fd08b4b51950f511921db04..5589386287dd81ad446beb7c3e70446887c41a01 100644 (file)
@@ -176,11 +176,21 @@ ldap_get_option(
                return LDAP_OPT_SUCCESS;
 
        case LDAP_OPT_TIMEOUT:
-               *(struct timeval *) outvalue = lo->ldo_tm_api;
+               /* the caller has to free outvalue ! */
+               if ( lo->ldo_tm_api.tv_sec < 0 ) {
+                       *(void **)outvalue = NULL;
+               } else if ( ldap_int_timeval_dup( outvalue, &lo->ldo_tm_api ) != 0 ) {
+                       return LDAP_OPT_ERROR;
+               }
                return LDAP_OPT_SUCCESS;
                
        case LDAP_OPT_NETWORK_TIMEOUT:
-               *(struct timeval *) outvalue = lo->ldo_tm_net;
+               /* the caller has to free outvalue ! */
+               if ( lo->ldo_tm_net.tv_sec < 0 ) {
+                       *(void **)outvalue = NULL;
+               } else if ( ldap_int_timeval_dup( outvalue, &lo->ldo_tm_net ) != 0 ) {
+                       return LDAP_OPT_ERROR;
+               }
                return LDAP_OPT_SUCCESS;
 
        case LDAP_OPT_DEREF: