From: Howard Chu Date: Tue, 6 Feb 2007 23:02:47 +0000 (+0000) Subject: Revert to original ldap_get_option( TIMEOUT ) behavior X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~56 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a1aa7c284d842b238f86e3f56b113a4336c8f367;p=openldap Revert to original ldap_get_option( TIMEOUT ) behavior --- diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index 8a46d53d32..5589386287 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -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: