From: Pierangelo Masarati Date: Sat, 27 Aug 2005 19:20:31 +0000 (+0000) Subject: prettify matchedDN; return response code X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~552 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=97600bf23caf0394b53331747fbc27e439f63419;p=openldap prettify matchedDN; return response code --- diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index b38b3db935..56daa3fdcd 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -429,7 +429,14 @@ fail:; * Rewrite the matched portion of the search base, if required */ if ( !BER_BVISNULL( &match ) && !BER_BVISEMPTY( &match ) ) { - rs->sr_matched = match.bv_val; + struct berval pmatch; + + if ( dnPretty( NULL, &match, &pmatch, op->o_tmpmemctx ) == LDAP_SUCCESS ) { + rs->sr_matched = pmatch.bv_val; + + } else { + rs->sr_matched = match.bv_val; + } } if ( rs->sr_v2ref ) { @@ -448,9 +455,14 @@ finish:; rs->sr_ctrls = NULL; } - if ( match.bv_val ) { + if ( rs->sr_matched != NULL ) { + if ( rs->sr_matched != match.bv_val ) { + ber_memfree_x( rs->sr_matched, op->o_tmpmemctx ); + + } else { + LDAP_FREE( match.bv_val ); + } rs->sr_matched = NULL; - LDAP_FREE( match.bv_val ); } if ( !BER_BVISNULL( &filter ) && filter.bv_val != op->ors_filterstr.bv_val ) { @@ -477,7 +489,7 @@ finish:; ldap_back_release_conn( op, rs, lc ); } - return rc; + return rs->sr_err; } static int