From: Howard Chu Date: Sat, 20 Sep 2003 03:25:05 +0000 (+0000) Subject: Tweak normalization in slap_entry2mods X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~700 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=93248cee58b6d7021f6a8902b5f5780bfe9c21ac;p=openldap Tweak normalization in slap_entry2mods --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index ef7684a8e9..dd8dcb7ac5 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -597,23 +597,20 @@ slap_entry2mods( mod->sml_bvalues = (struct berval*) malloc( (count+1) * sizeof( struct berval) ); - mod->sml_nvalues = (struct berval*) malloc( + /* see slap_mods_check() comments... + * if a_vals == a_nvals, there is no normalizer. + * in this case, mod->sml_nvalues must be left NULL. + */ + if ( a_new->a_vals != a_new->a_nvals ) { + mod->sml_nvalues = (struct berval*) malloc( (count+1) * sizeof( struct berval) ); + } else { + mod->sml_nvalues = NULL; + } for ( i = 0; i < count; i++ ) { ber_dupbv(mod->sml_bvalues+i, a_new->a_vals+i); - if ( a_new->a_desc->ad_type->sat_equality && - a_new->a_desc->ad_type->sat_equality->smr_normalize ) { - rc = a_new->a_desc->ad_type->sat_equality->smr_normalize( - 0, - a_new->a_desc->ad_type->sat_syntax, - a_new->a_desc->ad_type->sat_equality, - a_new->a_vals+i, mod->sml_nvalues+i, NULL ); - if (rc) { - return rc; - } - } - else { + if ( mod->sml_nvalues ) { ber_dupbv( mod->sml_nvalues+i, a_new->a_vals+i ); } } @@ -621,8 +618,10 @@ slap_entry2mods( mod->sml_bvalues[count].bv_val = 0; mod->sml_bvalues[count].bv_len = 0; - mod->sml_nvalues[count].bv_val = 0; - mod->sml_nvalues[count].bv_len = 0; + if ( mod->sml_nvalues ) { + mod->sml_nvalues[count].bv_val = 0; + mod->sml_nvalues[count].bv_len = 0; + } mod->sml_desc = a_new_desc; mod->sml_next =NULL;