From: Pierangelo Masarati Date: Thu, 26 Oct 2006 22:53:47 +0000 (+0000) Subject: import fix to ITS#4664 X-Git-Tag: OPENLDAP_REL_ENG_2_3_29~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=af27cd356b7cec5e70d3068c953094581e16fcc8;p=openldap import fix to ITS#4664 --- diff --git a/CHANGES b/CHANGES index 4c6d03f1e3..728a8c22a2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ OpenLDAP 2.3 Change Log OpenLDAP 2.3.29 Engineering + Fixed slapo-dynlist leaks (ITS#4664) Documentation Fixed slapd-ldap/meta(5) rebind-as-user usage (ITS#4715) Fixed slapd-ldap/meta(5) missing network-timeout (ITS#4718) diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index 163e4daa85..4fc91171b9 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -1,4 +1,5 @@ /* dynlist.c - dynamic list overlay */ +/* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * * Copyright 2003-2006 The OpenLDAP Foundation. @@ -24,7 +25,7 @@ #if LDAP_VENDOR_VERSION_MINOR != X && LDAP_VENDOR_VERSION_MINOR < 3 #define OL_2_2_COMPAT -#elif defined(LDAP_DEVEL) && SLAPD_OVER_DYNGROUP != SLAPD_MOD_STATIC +#elif SLAPD_OVER_DYNGROUP != SLAPD_MOD_STATIC #define TAKEOVER_DYNGROUP #endif @@ -350,7 +351,7 @@ dynlist_send_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli ) continue; } - if ( lud->lud_host ) { + if ( lud->lud_host != NULL ) { /* FIXME: host not allowed; reject as illegal? */ Debug( LDAP_DEBUG_ANY, "dynlist_send_entry(\"%s\"): " "illegal URI \"%s\"\n", @@ -365,6 +366,7 @@ dynlist_send_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli ) * this can be useful in case of a database serving * the empty suffix */ BER_BVSTR( &dn, "" ); + } else { ber_str2bv( lud->lud_dn, 0, 0, &dn ); } @@ -435,6 +437,7 @@ dynlist_send_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli ) if ( lud->lud_filter == NULL ) { ber_dupbv_x( &o.ors_filterstr, &dli->dli_default_filter, op->o_tmpmemctx ); + } else { struct berval flt; ber_str2bv( lud->lud_filter, 0, 0, &flt ); @@ -471,13 +474,9 @@ cleanup:; if ( !BER_BVISNULL( &o.o_req_ndn ) ) { op->o_tmpfree( o.o_req_ndn.bv_val, op->o_tmpmemctx ); } - if ( o.ors_filterstr.bv_val != lud->lud_filter ) { - op->o_tmpfree( o.ors_filterstr.bv_val, op->o_tmpmemctx ); - lud->lud_filter = NULL; - } - if ( lud ) { - ldap_free_urldesc( lud ); - } + assert( o.ors_filterstr.bv_val != lud->lud_filter ); + op->o_tmpfree( o.ors_filterstr.bv_val, op->o_tmpmemctx ); + ldap_free_urldesc( lud ); } rs->sr_entry = e; @@ -696,7 +695,7 @@ dynlist_build_def_filter( dynlist_info_t *dli ) dli->dli_default_filter.bv_len = STRLENOF( "(!(objectClass=" "))" ) + dli->dli_oc->soc_cname.bv_len; - dli->dli_default_filter.bv_val = SLAP_MALLOC( dli->dli_default_filter.bv_len + 1 ); + dli->dli_default_filter.bv_val = ch_malloc( dli->dli_default_filter.bv_len + 1 ); if ( dli->dli_default_filter.bv_val == NULL ) { Debug( LDAP_DEBUG_ANY, "dynlist_db_open: malloc failed.\n", 0, 0, 0 ); @@ -1345,9 +1344,11 @@ dynlist_db_open( dli->dli_ad = ad; } - rc = dynlist_build_def_filter( dli ); - if ( rc != 0 ) { - return rc; + if ( BER_BVISNULL( &dli->dli_default_filter ) ) { + rc = dynlist_build_def_filter( dli ); + if ( rc != 0 ) { + return rc; + } } }