ignore empty attrs in search requests (ITS#6819; see also ITS#6652)

This commit is contained in:
Pierangelo Masarati 2011-02-01 13:09:11 +00:00
parent a7e0c6cd2e
commit 75e3a1931d

View file

@ -1609,15 +1609,19 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
if ( !BER_BVISEMPTY( &op->ors_filterstr )) if ( !BER_BVISEMPTY( &op->ors_filterstr ))
attr_merge_one( e, ad_reqFilter, &op->ors_filterstr, NULL ); attr_merge_one( e, ad_reqFilter, &op->ors_filterstr, NULL );
if ( op->ors_attrs ) { if ( op->ors_attrs ) {
int j;
/* count them */ /* count them */
for (i=0; !BER_BVISNULL(&op->ors_attrs[i].an_name );i++) for (i=0; !BER_BVISNULL(&op->ors_attrs[i].an_name );i++)
; ;
vals = op->o_tmpalloc( (i+1) * sizeof(struct berval), vals = op->o_tmpalloc( (i+1) * sizeof(struct berval),
op->o_tmpmemctx ); op->o_tmpmemctx );
for (i=0; !BER_BVISNULL(&op->ors_attrs[i].an_name );i++) for (i=0, j=0; !BER_BVISNULL(&op->ors_attrs[i].an_name );i++) {
vals[i] = op->ors_attrs[i].an_name; if (!BER_BVISEMPTY(&op->ors_attrs[i].an_name)) {
vals[i].bv_val = NULL; vals[j] = op->ors_attrs[i].an_name;
vals[i].bv_len = 0; j++;
}
}
BER_BVZERO(&vals[j]);
attr_merge( e, ad_reqAttr, vals, NULL ); attr_merge( e, ad_reqAttr, vals, NULL );
op->o_tmpfree( vals, op->o_tmpmemctx ); op->o_tmpfree( vals, op->o_tmpmemctx );
} }