From: Kurt Zeilenga Date: Wed, 26 Feb 2003 01:57:07 +0000 (+0000) Subject: SLAP_NVALUE more add tweaks X-Git-Tag: NO_SLAP_OP_BLOCKS~295 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a5e883a8864b81d852048ddef7fa813abe7ffe3a;p=openldap SLAP_NVALUE more add tweaks --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index b023b9f429..baca001b84 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -413,7 +413,7 @@ slap_mods2entry( for( i=0; attr->a_vals[i].bv_val; i++ ) { /* count them */ } - for( j=0; mods->sml_bvalues[j].bv_val; j++ ) { + for( j=0; mods->sml_nvalues[j].bv_val; j++ ) { /* count them */ } j++; /* NULL */ @@ -423,12 +423,24 @@ slap_mods2entry( /* should check for duplicates */ - AC_MEMCPY( &attr->a_vals[i], mods->sml_bvalues, + AC_MEMCPY( &attr->a_vals[i], mods->sml_nvalues, sizeof( struct berval ) * j ); /* trim the mods array */ - ch_free( mods->sml_bvalues ); - mods->sml_bvalues = NULL; + ch_free( mods->sml_nvalues ); + mods->sml_nvalues = NULL; + + if( attr->a_nvals ) { + attr->a_nvals = ch_realloc( attr->a_nvals, + sizeof( struct berval ) * (i+j) ); + + AC_MEMCPY( &attr->a_nvals[i], mods->sml_nvalues, + sizeof( struct berval ) * j ); + + /* trim the mods array */ + ch_free( mods->sml_nvalues ); + mods->sml_nvalues = NULL; + } continue; #else @@ -439,7 +451,7 @@ slap_mods2entry( #endif } - if( mods->sml_bvalues[1].bv_val != NULL ) { + if( mods->sml_values[1].bv_val != NULL ) { /* check for duplicates */ int i, j; MatchingRule *mr = mods->sml_desc->ad_type->sat_equality; @@ -485,6 +497,7 @@ slap_mods2entry( /* should check for duplicates */ attr->a_vals = mods->sml_values; mods->sml_values = NULL; + #ifdef SLAP_NVALUES attr->a_nvals = mods->sml_nvalues; mods->sml_nvalues = NULL;