]> git.sur5r.net Git - openldap/commitdiff
cleanup; make sure no spurious error code slip thru
authorPierangelo Masarati <ando@openldap.org>
Mon, 24 Apr 2006 12:12:14 +0000 (12:12 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 24 Apr 2006 12:12:14 +0000 (12:12 +0000)
libraries/libldap/request.c

index c4a5514a1bc8ce08fd78a64e25aab185fdd32d90..5786816fd3fc79cf13ae0a2467eae13be21f7ef3 100644 (file)
@@ -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;