SLAP_NVALUES mostly populated now

This commit is contained in:
Kurt Zeilenga 2003-02-26 01:41:22 +00:00
parent 793dada79c
commit 2cdbd25a60
2 changed files with 41 additions and 9 deletions

View File

@ -696,10 +696,12 @@ int entry_decode(struct berval *bv, Entry **e)
if( rc ) { if( rc ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG( OPERATION, DETAIL1, LDAP_LOG( OPERATION, DETAIL1,
"str2entry: NULL (ssyn_normalize %d)\n" , rc, 0, 0 ); "entry_decode: NULL (ssyn_normalize %d)\n",
rc, 0, 0 );
#else #else
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"<= str2entry NULL (ssyn_normalize %d)\n", rc, 0, 0 ); "<= entry_decode NULL (ssyn_normalize %d)\n",
rc, 0, 0 );
#endif #endif
return rc; return rc;

View File

@ -562,7 +562,7 @@ int slap_mods_check(
/* /*
* check values * check values
*/ */
if( ml->sml_bvalues != NULL ) { if( ml->sml_nvalues != NULL ) {
ber_len_t nvals; ber_len_t nvals;
slap_syntax_validate_func *validate = slap_syntax_validate_func *validate =
ad->ad_type->sat_syntax->ssyn_validate; ad->ad_type->sat_syntax->ssyn_validate;
@ -583,14 +583,14 @@ int slap_mods_check(
* check that each value is valid per syntax * check that each value is valid per syntax
* and pretty if appropriate * and pretty if appropriate
*/ */
for( nvals = 0; ml->sml_bvalues[nvals].bv_val; nvals++ ) { for( nvals = 0; ml->sml_nvalues[nvals].bv_val; nvals++ ) {
struct berval pval; struct berval pval;
if( pretty ) { if( pretty ) {
rc = pretty( ad->ad_type->sat_syntax, rc = pretty( ad->ad_type->sat_syntax,
&ml->sml_bvalues[nvals], &pval ); &ml->sml_nvalues[nvals], &pval );
} else { } else {
rc = validate( ad->ad_type->sat_syntax, rc = validate( ad->ad_type->sat_syntax,
&ml->sml_bvalues[nvals] ); &ml->sml_nvalues[nvals] );
} }
if( rc != 0 ) { if( rc != 0 ) {
@ -602,11 +602,41 @@ int slap_mods_check(
} }
if( pretty ) { if( pretty ) {
ber_memfree( ml->sml_bvalues[nvals].bv_val ); ber_memfree( ml->sml_nvalues[nvals].bv_val );
ml->sml_bvalues[nvals] = pval; ml->sml_nvalues[nvals] = pval;
} }
} }
#ifdef SLAP_NVALUES
if( nvals && ad->ad_type->sat_equality &&
ad->ad_type->sat_equality->smr_match &&
ad->ad_type->sat_syntax->ssyn_normalize )
{
ml->sml_nvalues = ch_malloc( (nvals+1)*sizeof(struct berval) );
for( nvals = 0; ml->sml_nvalues[nvals].bv_val; nvals++ ) {
rc = ad->ad_type->sat_syntax->ssyn_normalize(
ad->ad_type->sat_syntax,
&ml->sml_values[nvals], &ml->sml_nvalues[nvals] );
if( rc ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, DETAIL1,
"str2entry: NULL (ssyn_normalize %d)\n",
rc, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"<= str2entry NULL (ssyn_normalize %d)\n",
rc, 0, 0 );
#endif
snprintf( textbuf, textlen,
"%s: value #%ld normalization failed",
ml->sml_type.bv_val, (long) nvals );
*text = textbuf;
return rc;
}
}
}
#endif
/* /*
* a rough single value check... an additional check is needed * a rough single value check... an additional check is needed
* to catch add of single value to existing single valued attribute * to catch add of single value to existing single valued attribute