From 83dc46d1bfb6a539d51780e2de509627c375002d Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 1 Jan 2005 16:12:09 +0000 Subject: [PATCH] set LDAPURLDesc lud_scope to LDAP_SCOPE_DEFAULT if set to LDAP_SCOPE_BASE, so no trailing '??base' is added to referrals... --- servers/slapd/back-meta/map.c | 12 +++++++++++- servers/slapd/back-meta/suffixmassage.c | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-meta/map.c b/servers/slapd/back-meta/map.c index a76c5f0f85..949961b7b7 100644 --- a/servers/slapd/back-meta/map.c +++ b/servers/slapd/back-meta/map.c @@ -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; } diff --git a/servers/slapd/back-meta/suffixmassage.c b/servers/slapd/back-meta/suffixmassage.c index 05e4ca2183..4879b8fdd0 100644 --- a/servers/slapd/back-meta/suffixmassage.c +++ b/servers/slapd/back-meta/suffixmassage.c @@ -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 ); -- 2.39.5