set LDAPURLDesc lud_scope to LDAP_SCOPE_DEFAULT if set to LDAP_SCOPE_BASE, so no trailing '??base' is added to referrals...

This commit is contained in:
Pierangelo Masarati 2005-01-01 16:12:09 +00:00
parent 250c096713
commit 83dc46d1bf
2 changed files with 15 additions and 3 deletions

View File

@ -523,6 +523,7 @@ ldap_back_filter_map_rewrite(
case REWRITE_REGEXEC_OK:
if ( !BER_BVISNULL( fstr ) ) {
fstr->bv_len = strlen( fstr->bv_val );
} else {
*fstr = ftmp;
}
@ -579,6 +580,14 @@ ldap_back_referral_result_rewrite(
continue;
}
/* FIXME: URLs like "ldap:///dc=suffix" if passed
* thru ldap_url_parse() and ldap_url_desc2str()
* get rewritten as "ldap:///dc=suffix??base";
* we don't want this to occur... */
if ( ludp->lud_scope == LDAP_SCOPE_BASE ) {
ludp->lud_scope = LDAP_SCOPE_DEFAULT;
}
ber_str2bv( ludp->lud_dn, 0, 0, &olddn );
rc = ldap_back_dn_massage( dc, &olddn, &dn );
@ -608,7 +617,8 @@ ldap_back_referral_result_rewrite(
newurl = ldap_url_desc2str( ludp );
if ( newurl == NULL ) {
/* FIXME: leave attr untouched
* even if ldap_url_desc2str failed... */
* even if ldap_url_desc2str failed...
*/
break;
}

View File

@ -68,8 +68,10 @@ ldap_back_dn_massage(
{
int rc = 0;
switch (rewrite_session( dc->rwmap->rwm_rw, dc->ctx, (dn->bv_len ? dn->bv_val : ""), dc->conn,
&res->bv_val )) {
switch ( rewrite_session( dc->rwmap->rwm_rw, dc->ctx,
( dn->bv_len ? dn->bv_val : "" ),
dc->conn, &res->bv_val ) )
{
case REWRITE_REGEXEC_OK:
if ( res->bv_val != NULL ) {
res->bv_len = strlen( res->bv_val );