From 75e3a1931d02fd36e958e57dc1b9afd7973ddf11 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 1 Feb 2011 13:09:11 +0000 Subject: [PATCH] ignore empty attrs in search requests (ITS#6819; see also ITS#6652) --- servers/slapd/overlays/accesslog.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index 957738c7e2..e2ce467472 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -1609,15 +1609,19 @@ static int accesslog_response(Operation *op, SlapReply *rs) { if ( !BER_BVISEMPTY( &op->ors_filterstr )) attr_merge_one( e, ad_reqFilter, &op->ors_filterstr, NULL ); if ( op->ors_attrs ) { + int j; /* count them */ for (i=0; !BER_BVISNULL(&op->ors_attrs[i].an_name );i++) ; vals = op->o_tmpalloc( (i+1) * sizeof(struct berval), op->o_tmpmemctx ); - for (i=0; !BER_BVISNULL(&op->ors_attrs[i].an_name );i++) - vals[i] = op->ors_attrs[i].an_name; - vals[i].bv_val = NULL; - vals[i].bv_len = 0; + for (i=0, j=0; !BER_BVISNULL(&op->ors_attrs[i].an_name );i++) { + if (!BER_BVISEMPTY(&op->ors_attrs[i].an_name)) { + vals[j] = op->ors_attrs[i].an_name; + j++; + } + } + BER_BVZERO(&vals[j]); attr_merge( e, ad_reqAttr, vals, NULL ); op->o_tmpfree( vals, op->o_tmpmemctx ); } -- 2.39.5