From a1aa7c284d842b238f86e3f56b113a4336c8f367 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 6 Feb 2007 23:02:47 +0000 Subject: [PATCH] Revert to original ldap_get_option( TIMEOUT ) behavior --- libraries/libldap/options.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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: -- 2.39.5