]> git.sur5r.net Git - openldap/commitdiff
A couple of minor fixes to LDAPv3 referral chasing
authorKurt Zeilenga <kurt@openldap.org>
Wed, 31 May 2000 17:47:33 +0000 (17:47 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 31 May 2000 17:47:33 +0000 (17:47 +0000)
libraries/libldap/request.c
libraries/libldap/result.c

index 1f28aa1dab9cbc0f268af6c2c32a109686e2cdd6..87d6c84bfac115832d66c01372a85cbf99bb7e60 100644 (file)
@@ -6,7 +6,8 @@
 /*  Portions
  *  Copyright (c) 1995 Regents of the University of Michigan.
  *  All rights reserved.
- ******************************************************************************
+ */
+/*---
  * This notice applies to changes, created by or for Novell, Inc.,
  * to preexisting works for which notices appear elsewhere in this file.
  *
  * WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP PUBLIC
  * LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT THE
  * PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. 
- ******************************************************************************
+ *---
  * Modification to OpenLDAP source by Novell, Inc.
  * April 2000 sfs  Added code to chase V3 referrals
- *
  *  request.c - sending of ldap requests; handling of referrals
  */
 
@@ -668,7 +668,6 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, char **errstrp,
        refs = NULL;
        /* parse out & follow referrals */
        for( i=0; refarray[i] != NULL; i++) {
-
                /* Parse the referral URL */
                if (( rc = ldap_url_parse( refarray[i], &srv)) != LDAP_SUCCESS) {
                        ld->ld_errno = rc;
@@ -676,6 +675,12 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, char **errstrp,
                        goto done;
                }
 
+               /* treat ldap://hostpart and ldap://hostpart/ the same */
+               if ( srv->lud_dn && srv->lud_dn[0] == '\0' ) {
+                       LDAP_FREE( srv->lud_dn );
+                       srv->lud_dn = NULL;
+               }
+
                /* check connection for re-bind in progress */
                if (( lc = find_connection( ld, srv, 1 )) != NULL ) {
                        if( lc->lconn_rebind_inprogress) {
@@ -896,12 +901,14 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
                        continue;
                }
 
+               /* copy the complete referral for rebind process */
+               rinfo.ri_url = LDAP_STRDUP( ref );
+
                *hadrefp = 1;
 
                if (( refdn = strchr( tmpref, '/' )) != NULL ) {
                        *refdn++ = '\0';
                        newdn = refdn[0] != '?' && refdn[0] != '\0';
-
                        if( !newdn ) refdn = NULL;
                } else {
                        newdn = 0;
index 155b2cbd70880ffcf9863162ffe937747066036a..3ceb1fa70d46335347dc4326640a62eecef99ec7 100644 (file)
@@ -6,7 +6,8 @@
 /*  Portions
  *  Copyright (c) 1990 Regents of the University of Michigan.
  *  All rights reserved.
- ******************************************************************************
+ */
+/*---
  * This notice applies to changes, created by or for Novell, Inc.,
  * to preexisting works for which notices appear elsewhere in this file.
  *
@@ -20,7 +21,7 @@
  * WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP PUBLIC
  * LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT THE
  * PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. 
- ******************************************************************************
+ *---
  * Modification to OpenLDAP source by Novell, Inc.
  * April 2000 sfs Add code to process V3 referrals and search results
  *
@@ -440,7 +441,7 @@ try_read1msg(
                                        {
                                                v3ref = -1;  /* Assume referral not chased and return it to app */
                                                /* Get the referral list */
-                                               if( ber_scanf( &tmpber, "v", &refs) == LBER_ERROR) {
+                                               if( ber_scanf( &tmpber, "{v}", &refs) == LBER_ERROR) {
                                                        rc = LDAP_DECODING_ERROR;
                                                        lr->lr_status = LDAP_REQST_COMPLETED;
                                                        Debug( LDAP_DEBUG_TRACE,