From: Kurt Zeilenga Date: Wed, 31 May 2000 17:47:33 +0000 (+0000) Subject: A couple of minor fixes to LDAPv3 referral chasing X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2785 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=81d2747247eebd40b08692426ef5a85d8c5b670d;p=openldap A couple of minor fixes to LDAPv3 referral chasing --- diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 1f28aa1dab..87d6c84bfa 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -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. * @@ -20,10 +21,9 @@ * 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; diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index 155b2cbd70..3ceb1fa70d 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -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,