From 97600bf23caf0394b53331747fbc27e439f63419 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 27 Aug 2005 19:20:31 +0000 Subject: [PATCH] prettify matchedDN; return response code --- servers/slapd/back-ldap/search.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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 -- 2.39.5