]> git.sur5r.net Git - openldap/commitdiff
Don't touch (unescape) URL handed to rebind proc.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 30 Sep 2000 02:37:05 +0000 (02:37 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 30 Sep 2000 02:37:05 +0000 (02:37 +0000)
libraries/libldap/request.c
libraries/libldap/url.c

index 82be383618644c4d185c0b019b555b9530e0961b..b83cafba181c3d3742496f7943b93f9e75aee29e 100644 (file)
@@ -788,8 +788,7 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
 
        len = strlen( *errstrp );
        for ( p = *errstrp; len >= LDAP_REF_STR_LEN; ++p, --len ) {
-               if (( *p == 'R' || *p == 'r' ) && strncasecmp( p,
-                   LDAP_REF_STR, LDAP_REF_STR_LEN ) == 0 ) {
+               if ( strncasecmp( p, LDAP_REF_STR, LDAP_REF_STR_LEN ) == 0 ) {
                        *p = '\0';
                        p += LDAP_REF_STR_LEN;
                        break;
@@ -826,6 +825,9 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
                        p = NULL;
                }
 
+               /* copy the complete referral for rebind process */
+               rinfo.ri_url = LDAP_STRDUP( ref );
+
                ldap_pvt_hex_unescape( ref );
                len = strlen( ref );
 
@@ -841,12 +843,11 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
                            "ignoring unknown referral <%s>\n", ref, 0, 0 );
                        rc = ldap_append_referral( ld, &unfollowed, ref );
                        *hadrefp = 1;
+                       LDAP_FREE( rinfo.ri_url );
+                       rinfo.ri_url = NULL;
                        continue;
                }
 
-               /* copy the complete referral for rebind process */
-               rinfo.ri_url = LDAP_STRDUP( ref );
-
                *hadrefp = 1;
 
                if (( refdn = strchr( tmpref, '/' )) != NULL ) {
index ccb7eca61335ca6267887896b1fc4b84be3467d0..dc188bf813c4e856bf0e1d3d03657e2c984df54e 100644 (file)
@@ -950,10 +950,10 @@ ldap_url_search_s(
 void
 ldap_pvt_hex_unescape( char *s )
 {
-/*
-* Remove URL hex escapes from s... done in place.  The basic concept for
-* this routine is borrowed from the WWW library HTUnEscape() routine.
-*/
+       /*
+        * Remove URL hex escapes from s... done in place.  The basic concept for
+        * this routine is borrowed from the WWW library HTUnEscape() routine.
+        */
        char    *p;
 
        for ( p = s; *s != '\0'; ++s ) {