From: Howard Chu Date: Mon, 7 Apr 2003 10:51:57 +0000 (+0000) Subject: Fix matchedDn detection X-Git-Tag: AUTOCONF_2_57~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bb305eee0b01440075583774b3a9e5803298ea55;p=openldap Fix matchedDn detection --- diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 31158d7a31..cc4fbe2277 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -317,7 +317,7 @@ fail:; /* * Rewrite the matched portion of the search base, if required */ - if ( match != NULL ) { + if ( match && *match ) { struct berval dn, mdn; #ifdef ENABLE_REWRITE diff --git a/servers/slapd/back-ldap/suffixmassage.c b/servers/slapd/back-ldap/suffixmassage.c index f4a31c1f78..15a8903cf2 100644 --- a/servers/slapd/back-ldap/suffixmassage.c +++ b/servers/slapd/back-ldap/suffixmassage.c @@ -92,12 +92,12 @@ ldap_back_dn_massage( int ldap_back_dn_massage( dncookie *dc, - struct berval *dn, + struct berval *odn, struct berval *res ) { int i, src, dst; - struct berval pretty = {0,NULL}; + struct berval pretty = {0,NULL}, *dn = odn; assert( res ); @@ -157,13 +157,14 @@ ldap_back_dn_massage( break; } } + if (pretty.bv_val) { + ch_free(pretty.bv_val); + dn = odn; + } /* Nothing matched, just return the original DN */ if (res->bv_val == NULL) { *res = *dn; } - if (pretty.bv_val) { - ch_free(pretty.bv_val); - } return 0; }