From: Kurt Zeilenga Date: Tue, 22 Dec 1998 04:49:56 +0000 (+0000) Subject: Allow LDAP session errno and error strings to be set. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~892 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a64c2a39549813867e565c51ff94709ece110ab0;p=openldap Allow LDAP session errno and error strings to be set. --- diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index 6468f9166c..b1c2fb66b6 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -316,12 +316,6 @@ ldap_set_option( case LDAP_OPT_ERROR_NUMBER: { int err = * (int *) invalue; - if (err != 0 ) { - /* not supported */ - /* we only allow ld_errno to be cleared. */ - break; - } - if(ld == NULL) { /* need a struct ldap */ break; @@ -333,18 +327,16 @@ ldap_set_option( case LDAP_OPT_ERROR_STRING: { char* err = * (char **) invalue; - if (err != NULL ) { - /* not supported */ - /* we only allow ld_error to be cleared. */ - break; - } - if(ld == NULL) { /* need a struct ldap */ break; } - ld->ld_error = err; + if( ld->ld_error ) { + free(ld->ld_error); + } + + ld->ld_error = strdup(err); } return 0; case LDAP_OPT_API_FEATURE_INFO: