From 77e7acc4f919e756bd76929cfd3a94d39ff6c436 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 24 Apr 2006 12:12:14 +0000 Subject: [PATCH] cleanup; make sure no spurious error code slip thru --- libraries/libldap/request.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index c4a5514a1b..5786816fd3 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -741,14 +741,17 @@ ldap_free_request_int( LDAP *ld, LDAPRequest *lr ) if ( lr->lr_ber != NULL ) { ber_free( lr->lr_ber, 1 ); + lr->lr_ber = NULL; } if ( lr->lr_res_error != NULL ) { LDAP_FREE( lr->lr_res_error ); + lr->lr_res_error = NULL; } if ( lr->lr_res_matched != NULL ) { LDAP_FREE( lr->lr_res_matched ); + lr->lr_res_matched = NULL; } LDAP_FREE( lr ); @@ -882,8 +885,11 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char * { /* Parse the referral URL */ - if (( rc = ldap_url_parse_ext( refarray[i], &srv)) != LDAP_SUCCESS) { - ld->ld_errno = rc; + rc = ldap_url_parse_ext( refarray[i], &srv ); + if ( rc != LDAP_URL_SUCCESS ) { + /* ldap_url_parse_ext() returns LDAP_URL_* errors + * which do not map on API errors */ + ld->ld_errno = LDAP_PARAM_ERROR; rc = -1; goto done; } @@ -1147,10 +1153,10 @@ ldap_chase_referrals( LDAP *ld, } rc = ldap_url_parse_ext( ref, &srv ); - if ( rc != LDAP_URL_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, - "ignoring unknown referral <%s>\n", ref, 0, 0 ); + "ignoring %s referral <%s>\n", + ref, rc == LDAP_URL_ERR_BADSCHEME ? "unknown" : "incorrect", 0 ); rc = ldap_append_referral( ld, &unfollowed, ref ); *hadrefp = 1; continue; -- 2.39.5