From d46c3aa7dd76f10692a5c2610171d0191a9f6bf9 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Wed, 26 Jan 2011 19:07:18 +0000 Subject: [PATCH] ITS#6793 --- CHANGES | 1 + servers/slapd/back-ldap/search.c | 22 +++++++--------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CHANGES b/CHANGES index 5e96604c8c..cf910c1297 100644 --- a/CHANGES +++ b/CHANGES @@ -65,6 +65,7 @@ OpenLDAP 2.4.24 Engineering Fixed slapd-ldap chaining with onelevel scope (ITS#6699) Fixed slapd-ldap chaining with ppolicy (ITS#6540) Fixed slapd-ldap with SASL/EXTERNAL (ITS#6642) + Fixed slapd-ldap crasher on matchedDN (ITS#6793) Fixed slapd-ldif error strings (ITS#6731) Fixed slapd-ndb to honor rootpw setting (ITS#6661) Fixed slapd-ndb hasSubordinates generation (ITS#6712) diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 702cde2a5d..e58641cff1 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -169,9 +169,7 @@ ldap_back_search( int do_retry = 1, dont_retry = 0; LDAPControl **ctrls = NULL; char **references = NULL; - - /* FIXME: shouldn't this be null? */ - const char *save_matched = rs->sr_matched; + void *matchctx = NULL; if ( !ldap_back_dobind( &lc, op, rs, LDAP_BACK_SENDERR ) ) { return rs->sr_err; @@ -548,12 +546,11 @@ retry: struct berval pmatch; if ( dnPretty( NULL, &match, &pmatch, op->o_tmpmemctx ) == LDAP_SUCCESS ) { - rs->sr_matched = pmatch.bv_val; ber_memfree( match.bv_val ); - - } else { - rs->sr_matched = match.bv_val; + matchctx = op->o_tmpmemctx; + match.bv_val = pmatch.bv_val; } + rs->sr_matched = match.bv_val; } if ( rs->sr_v2ref ) { @@ -584,15 +581,10 @@ finish:; rs->sr_ctrls = NULL; } - if ( rs->sr_matched != NULL && rs->sr_matched != save_matched ) { - if ( rs->sr_matched != match.bv_val ) { - ber_memfree_x( (char *)rs->sr_matched, op->o_tmpmemctx ); - - } else { - ber_memfree( match.bv_val ); - } - rs->sr_matched = save_matched; + if ( match.bv_val ) { + ber_memfree_x( match.bv_val, matchctx ); } + rs->sr_matched = NULL; if ( rs->sr_text ) { if ( freetext ) { -- 2.39.5