From 87321c3faef98f606d624503532ccacf9113dcf0 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 18 Aug 2009 08:38:42 +0000 Subject: [PATCH] update cachedQueryURL only when requested --- servers/slapd/overlays/pcache.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 76cd1037dd..5601ede571 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -2876,7 +2876,7 @@ refresh_query( Operation *op, SlapReply *rs, CachedQuery *query, Filter filter = {LDAP_FILTER_EQUALITY}; AttributeName attrs[ 2 ] = {{{ 0 }}}; dnlist *dn; - int i, rc; + int rc; ldap_pvt_thread_mutex_lock( &query->answerable_cnt_mutex ); query->refcnt = 0; @@ -4563,10 +4563,12 @@ pcache_monitor_update( CachedQuery *qc; BerVarray vals = NULL; - Attribute *a; - int num = 0; + assert( ad_cachedQueryURL != NULL ); - if ( qm->templates != NULL ) { + attr_delete( &e->e_attrs, ad_cachedQueryURL ); + if ( ( SLAP_OPATTRS( rs->sr_attr_flags ) || ad_inlist( ad_cachedQueryURL, rs->sr_attrs ) ) + && qm->templates != NULL ) + { QueryTemplate *tm; for ( tm = qm->templates; tm != NULL; tm = tm->qmnext ) { @@ -4575,22 +4577,17 @@ pcache_monitor_update( if ( query2url( op, qc, &bv, 1 ) == 0 ) { ber_bvarray_add_x( &vals, &bv, op->o_tmpmemctx ); - num++; } } } - } - assert( ad_cachedQueryURL != NULL ); - attr_delete( &e->e_attrs, ad_cachedQueryURL ); - if ( vals == NULL ) { - return SLAP_CB_CONTINUE; + if ( vals != NULL ) { + attr_merge_normalize( e, ad_cachedQueryURL, vals, NULL ); + ber_bvarray_free_x( vals, op->o_tmpmemctx ); + } } - attr_merge_normalize( e, ad_cachedQueryURL, vals, NULL ); - ber_bvarray_free_x( vals, op->o_tmpmemctx ); - return SLAP_CB_CONTINUE; } -- 2.39.5