From 68ddf384ca4bceddec18e850f76139980b54e91f Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 18 Aug 2009 14:32:02 +0000 Subject: [PATCH] only add attrs if values are present... --- contrib/slapd-modules/allowed/allowed.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/slapd-modules/allowed/allowed.c b/contrib/slapd-modules/allowed/allowed.c index 6f5795d853..415aeefa9b 100644 --- a/contrib/slapd-modules/allowed/allowed.c +++ b/contrib/slapd-modules/allowed/allowed.c @@ -178,7 +178,7 @@ aa_operational( Operation *op, SlapReply *rs ) ObjectClass **ocp = NULL; BerVarray bv_allowed = NULL, bv_effective = NULL; - int i, ja, je; + int i, ja = 0, je = 0; #define GOT_NONE (0x0U) #define GOT_C (0x1U) @@ -290,19 +290,21 @@ aa_operational( Operation *op, SlapReply *rs ) for ( ap = &rs->sr_operational_attrs; *ap != NULL; ap = &(*ap)->a_next ) /* go to last */ ; - if ( got & GOT_A ) { + if ( ( got & GOT_A ) && ja > 0 ) { BER_BVZERO( &bv_allowed[ ja ] ); *ap = attr_alloc( ad_allowedAttributes ); (*ap)->a_vals = bv_allowed; (*ap)->a_nvals = bv_allowed; + (*ap)->a_numvals = ja; ap = &(*ap)->a_next; } - if ( got & GOT_AE ) { + if ( ( got & GOT_AE ) && je > 0 ) { BER_BVZERO( &bv_effective[ je ] ); *ap = attr_alloc( ad_allowedAttributesEffective ); (*ap)->a_vals = bv_effective; (*ap)->a_nvals = bv_effective; + (*ap)->a_numvals = je; ap = &(*ap)->a_next; } -- 2.39.5