no normalizer, a_nvals = a_vals.
#ifdef SLAP_NVALUES
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- at->a_nvals ? at->a_nvals : at->a_vals,
+ at->a_nvals,
#else
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
at->a_vals,
if (aci_mask( be, conn, op,
e, desc, val,
#ifdef SLAP_NVALUES
- at->a_nvals ? &at->a_nvals[i] : &at->a_vals[i],
+ &at->a_nvals[i],
#else
&at->a_vals[i],
#endif
#ifdef SLAP_NVALUES
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- at->a_nvals ? at->a_nvals : at->a_vals,
+ at->a_nvals,
#else
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
at->a_vals,
mods->sml_values = NULL;
#ifdef SLAP_NVALUES
- if( attr->a_nvals ) {
+ if( mods->sml_nvalues ) {
attr->a_nvals = ch_realloc( attr->a_nvals,
sizeof( struct berval ) * (i+j) );
/* trim the mods array */
ch_free( mods->sml_nvalues );
mods->sml_nvalues = NULL;
+ } else {
+ attr->a_nvals = attr->a_vals;
}
#endif
const char *text = NULL;
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
+#ifdef SLAP_NVALUES
+ int match;
+
+ for ( i = 0; mods->sml_nvalues[i].bv_val != NULL; i++ ) {
+ /* test asserted values against themselves */
+ for( j = 0; j < i; j++ ) {
+ rc = value_match( &match, mods->sml_desc, mr,
+ SLAP_MR_EQUALITY | SLAP_MR_VALUE_OF_ASSERTION_SYNTAX
+ | SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH
+ | SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
+ &mods->sml_nvalues[i], &mods->sml_nvalues[j], &text );
+ if ( rc == LDAP_SUCCESS && match == 0 ) {
+ /* value exists already */
+ snprintf( textbuf, textlen,
+ "%s: value #%d provided more than once",
+ mods->sml_desc->ad_cname.bv_val, j );
+ return LDAP_TYPE_OR_VALUE_EXISTS;
+ }
+ }
+ }
+#else
rc = modify_check_duplicates( mods->sml_desc, mr,
NULL, mods->sml_bvalues, 0,
&text, textbuf, sizeof( textbuf ) );
-
+#endif
if ( rc != LDAP_SUCCESS ) {
return rc;
}
mods->sml_values = NULL;
#ifdef SLAP_NVALUES
- attr->a_nvals = mods->sml_nvalues;
- mods->sml_nvalues = NULL;
+ if ( mods->sml_nvalues ) {
+ attr->a_nvals = mods->sml_nvalues;
+ mods->sml_nvalues = NULL;
+ } else {
+ attr->a_nvals = attr->a_vals;
+ }
#endif
*tail = attr;
{
ber_bvarray_free( a->a_vals );
#ifdef SLAP_NVALUES
- ber_bvarray_free( a->a_nvals );
+ if (a->a_nvals != a->a_vals) ber_bvarray_free( a->a_nvals );
#endif
free( a );
}
tmp->a_vals[i].bv_val = NULL;
#ifdef SLAP_NVALUES
- if( a->a_nvals != NULL ) {
+ if( a->a_nvals != a->a_vals ) {
tmp->a_nvals = ch_malloc((i+1) * sizeof(struct berval));
for( i=0; a->a_nvals[i].bv_val != NULL; i++ ) {
ber_dupbv( &tmp->a_nvals[i], &a->a_nvals[i] );
tmp->a_nvals[i].bv_val = NULL;
} else {
- tmp->a_nvals = NULL;
+ tmp->a_nvals = tmp->a_vals;
}
#endif
#ifdef SLAP_NVALUES
if( !rc && nvals ) rc = value_add( &(*a)->a_nvals, nvals );
+ else (*a)->a_nvals = (*a)->a_vals;
#endif
return rc;
#ifdef SLAP_NVALUES
if( !rc && nval ) rc = value_add_one( &(*a)->a_nvals, nval );
+ else (*a)->a_nvals = (*a)->a_vals;
#endif
return rc;
}
&& op != NULL
&& access_allowed(be, conn, op, e, entry_at,
#ifdef SLAP_NVALUES
- attr->a_nvals ? &attr->a_nvals[i] : &attr->a_vals[i],
+ &attr->a_nvals[i],
#else
&attr->a_vals[i],
#endif
}
#ifdef SLAP_NVALUES
- ber_dupbv( &v[j],
- attr->a_nvals ? &attr->a_nvals[i] : &attr->a_vals[i] );
+ ber_dupbv( &v[j], &attr->a_nvals[i] );
#else
ber_dupbv( &v[j], &attr->a_vals[i] );
#endif
if ( value_find_ex( ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- a->a_nvals ? a->a_nvals : a->a_vals, &ava->aa_value ) == 0 )
+ a->a_nvals, &ava->aa_value ) == 0 )
#else
if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
#endif
#ifdef SLAP_NVALUES
if( value_find_ex( group_at, SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH
| SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- attr->a_nvals ? attr->a_nvals : attr->a_vals,
- op_ndn ) != LDAP_SUCCESS )
+ attr->a_nvals, op_ndn ) != LDAP_SUCCESS )
#else
if( value_find_ex( group_at, 0, attr->a_vals, op_ndn ) != LDAP_SUCCESS )
#endif
for ( ; ap != NULL; ap = ap->a_next ) {
#ifdef SLAP_NVALUES
rc = bdb_index_values( be, txn, ap->a_desc,
- ap->a_nvals ? ap->a_nvals : ap->a_vals,
- e->e_id, op );
+ ap->a_nvals, e->e_id, op );
#else
rc = bdb_index_values( be, txn, ap->a_desc,
ap->a_vals, e->e_id, op );
if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
rc = bdb_index_values( be, tid, ap->a_desc,
#ifdef SLAP_NVALUES
- ap->a_nvals ? ap->a_nvals : ap->a_vals,
+ ap->a_nvals,
#else
ap->a_vals,
#endif
if (ap->a_flags & SLAP_ATTR_IXADD) {
rc = bdb_index_values( be, tid, ap->a_desc,
#ifdef SLAP_NVALUES
- ap->a_nvals ? ap->a_nvals : ap->a_vals,
+ ap->a_nvals,
#else
ap->a_vals,
#endif
Modifications *tmp;
for (; mod; mod=tmp ) {
tmp = mod->sml_next;
+#ifdef SLAP_NVALUES
+ if ( mod->sml_nvalues ) free( mod->sml_nvalues[0].bv_val );
+#endif
free( mod );
}
}
if ( value_find_ex( ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- a->a_nvals ? a->a_nvals : a->a_vals,
- &ava->aa_value ) == 0 )
+ a->a_nvals, &ava->aa_value ) == 0 )
#else
if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
#endif
if( value_find_ex( group_at,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH
| SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- attr->a_nvals ? attr->a_nvals : attr->a_vals,
- op_ndn ) != LDAP_SUCCESS )
+ attr->a_nvals, op_ndn ) != LDAP_SUCCESS )
#else
if( value_find_ex( group_at, 0, attr->a_vals, op_ndn ) != LDAP_SUCCESS )
#endif
for ( ; ap != NULL; ap = ap->a_next ) {
index_values( be, ap->a_desc,
#ifdef SLAP_NVALUES
- ap->a_nvals ? ap->a_nvals : ap->a_vals,
+ ap->a_nvals,
#else
ap->a_vals,
#endif
if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
rc = index_values( be, ap->a_desc,
#ifdef SLAP_NVALUES
- ap->a_nvals ? ap->a_nvals : ap->a_vals,
+ ap->a_nvals,
#else
ap->a_vals,
#endif
if ( ap->a_flags & SLAP_ATTR_IXADD ) {
rc = index_values( be, ap->a_desc,
#ifdef SLAP_NVALUES
- ap->a_nvals ? ap->a_nvals : ap->a_vals,
+ ap->a_nvals,
#else
ap->a_vals,
#endif
if ( mod != NULL ) {
Modifications *tmp;
for (; mod; mod = tmp ) {
+#ifdef SLAP_NVALUES
+ if ( mod->sml_nvalues ) free( mod->sml_nvalues[0].bv_val );
+#endif
tmp = mod->sml_next;
free( mod );
}
#ifdef SLAP_NVALUES
if ( value_find_ex( ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
- a->a_nvals ? a->a_nvals : a->a_vals,
- &ava->aa_value ) == 0 )
+ a->a_nvals, &ava->aa_value ) == 0 )
#else
if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
#endif
if ( value_find_ex( ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- a->a_nvals ? a->a_nvals : a->a_vals,
+ a->a_nvals,
&ava->aa_value ) == 0 )
#else
if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
len += entry_lenlen(i);
siz += sizeof(struct berval); /* empty berval at end */
#ifdef SLAP_NVALUES_ON_DISK
- if (a->a_nvals) {
+ if (a->a_nvals != a->a_vals) {
for (i=0; a->a_nvals[i].bv_val; i++) {
siz += sizeof(struct berval);
len += a->a_nvals[i].bv_len + 1;
*ptr++ = '\0';
}
#ifdef SLAP_NVALUES_ON_DISK
- if (a->a_nvals) {
+ if (a->a_nvals != a->a_vals) {
entry_putlen(&ptr, i);
for (i=0; a->a_nvals[i].bv_val; i++) {
entry_putlen(&ptr, a->a_nvals[i].bv_len);
bptr->bv_len = 0;
bptr++;
} else {
- a->a_nvals = NULL;
+ a->a_nvals = a->a_vals;
}
#elif defined(SLAP_NVALUES)
if( count && ad->ad_type->sat_equality &&
}
a->a_nvals[j].bv_val = NULL;
a->a_nvals[j].bv_len = 0;
+ } else {
+ a->a_nvals = a->a_vals;
}
#endif
{
struct berval *bv;
#ifdef SLAP_NVALUES
- for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
- bv->bv_val != NULL; bv++ )
+ bv = a->a_nvals;
#else
- for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
+ bv = a->a_vals;
#endif
+ for ( ; bv->bv_val != NULL; bv++ )
{
int ret;
int rc;
/* check match */
#ifdef SLAP_NVALUES
- for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
- bv->bv_val != NULL; bv++ )
+ for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
#else
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
#endif
}
#ifdef SLAP_NVALUES
- for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
- bv->bv_val != NULL; bv++ )
+ for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
#else
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
#endif
}
#ifdef SLAP_NVALUES
- for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
- bv->bv_val != NULL; bv++ )
+ for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
#else
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
#endif
if( rc != LDAP_SUCCESS ) continue;
}
- for ( bv = a->a_vals, j = 0; bv->bv_val != NULL; bv++, j++ ) {
+#ifdef SLAP_NVALUES
+ bv = a->a_nvals;
+#else
+ bv = a->a_vals;
+#endif
+ for ( j = 0; bv->bv_val != NULL; bv++, j++ ) {
int ret;
int rc;
const char *text;
/* Apply modification */
#ifdef SLAP_NVALUES
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
- + 2 * sizeof ( struct berval ) );
+ + 4 * sizeof ( struct berval ) );
#else
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
+ 2 * sizeof ( struct berval ) );
int i, j, numvals = 0, nummods,
rc = LDAP_SUCCESS, matched;
#ifdef SLAP_NVALUES
- /* needs major reworking */
+ /* this function is no longer used */
#else
BerVarray nvals = NULL, nmods = NULL;
/* check if the values we're adding already exist */
if( mr == NULL || !mr->smr_match ) {
-#ifdef SLAP_NVALUES
- /* we should have no normalized values as there is no equality rule */
- /* assert( mod->sm_nvalues[0].bv_val == NULL); */
-#endif
-
if ( a != NULL ) {
/* do not allow add of additional attribute
if no equality rule exists */
for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
/* test asserted values against existing values */
if( a ) {
-#ifdef SLAP_NVALUES
- /* we should have no normalized values as there
- is no equality rule */
- assert( a->a_nvals == NULL);
-#endif
for( matched = 0, j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
if ( bvmatch( &mod->sm_bvalues[i], &a->a_vals[j] ) ) {
if ( permissive ) {
mr, &a->a_nvals[j],
&mod->sm_nvalues[i] );
} else {
+#if 0
assert( a->a_nvals == NULL );
+#endif
rc = (*mr->smr_match)( &match,
SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
a->a_desc->ad_type->sat_syntax,
- mr, &a->a_nvals[j],
+ mr, &a->a_vals[j],
&mod->sm_values[i] );
}
#else
#ifdef SLAP_NVALUES
free( a->a_vals[j].bv_val );
a->a_vals[j].bv_val = &dummy;
- if( a->a_nvals ) {
+ if( a->a_nvals != a->a_vals ) {
free( a->a_nvals[j].bv_val );
a->a_nvals[j].bv_val = &dummy;
}
if ( j != k ) {
a->a_vals[ j ] = a->a_vals[ k ];
#ifdef SLAP_NVALUES
- if (a->a_nvals) {
+ if (a->a_nvals != a->a_vals) {
a->a_nvals[ j ] = a->a_nvals[ k ];
}
#endif
a->a_vals[j].bv_val = NULL;
#ifdef SLAP_NVALUES
- if (a->a_nvals) a->a_nvals[j].bv_val = NULL;
+ if (a->a_nvals != a->a_vals) a->a_nvals[j].bv_val = NULL;
#else
assert( i == k - j );
a->a_vals[1].bv_val = NULL;
#ifdef SLAP_NVALUES
- a->a_nvals = NULL;
+ a->a_nvals = a->a_vals;
#endif
a->a_next = NULL;
vals[0].bv_val = "top";
vals[0].bv_len = sizeof("top")-1;
#ifdef SLAP_NVALUES
- if( attr_merge( e, ad_objectClass, vals, vals ) )
+ if( attr_merge( e, ad_objectClass, vals, NULL ) )
#else
if( attr_merge( e, ad_objectClass, vals ) )
#endif
vals[0].bv_val = "OpenLDAProotDSE";
vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
#ifdef SLAP_NVALUES
- if( attr_merge( e, ad_objectClass, vals, vals ) )
+ if( attr_merge( e, ad_objectClass, vals, NULL ) )
#else
if( attr_merge( e, ad_objectClass, vals ) )
#endif
return LDAP_OTHER;
#ifdef SLAP_NVALUES
- if( attr_merge( e, ad_structuralObjectClass, vals, vals ) )
+ if( attr_merge( e, ad_structuralObjectClass, vals, NULL ) )
#else
if( attr_merge( e, ad_structuralObjectClass, vals ) )
#endif
if ( backends[i].be_flags & SLAP_BFLAG_MONITOR ) {
vals[0] = backends[i].be_suffix[0];
#ifdef SLAP_NVALUES
+ nvals[0] = backends[i].be_nsuffix[0];
if( attr_merge( e, ad_monitorContext, vals, nvals ) )
#else
if( attr_merge( e, ad_monitorContext, vals ) )
for ( j = 0; backends[i].be_suffix[j].bv_val != NULL; j++ ) {
vals[0] = backends[i].be_suffix[j];
#ifdef SLAP_NVALUES
- if( attr_merge( e, ad_namingContexts, vals, NULL ) )
+ nvals[0] = backends[i].be_nsuffix[0];
+ if( attr_merge( e, ad_namingContexts, vals, nvals ) )
#else
if( attr_merge( e, ad_namingContexts, vals ) )
#endif
/* supportedFeatures */
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_supportedFeatures,
- supportedFeatures, supportedFeatures ) )
+ supportedFeatures, NULL ) )
#else
if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
#endif
Attribute *a;
for( a = usr_attr->e_attrs; a != NULL; a = a->a_next ) {
#ifdef SLAP_NVALUES
- if( attr_merge( e, a->a_desc, a->a_vals, a->a_nvals ) )
+ if( attr_merge( e, a->a_desc, a->a_vals,
+ (a->a_nvals == a->a_vals) ? NULL : a->a_nvals ) )
#else
if( attr_merge( e, a->a_desc, a->a_vals ) )
#endif
for(a = e->e_attrs; a != NULL; a = a->a_next) {
#ifdef SLAP_NVALUES
- if( attr_merge( usr_attr, a->a_desc, a->a_vals, a->a_nvals ) )
+ if( attr_merge( usr_attr, a->a_desc, a->a_vals,
+ (a->a_nvals == a->a_vals) ? NULL : a->a_nvals ) )
#else
if( attr_merge( usr_attr, a->a_desc, a->a_vals ) )
#endif
#ifdef SLAP_NVALUES
if ( value_find_ex( desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
- attr->a_nvals ? attr->a_nvals : attr->a_vals,
+ attr->a_nvals,
&ava->la_value ) != 0 )
#else
if ( value_find( desc, attr->a_vals, &ava->la_value ) != 0 )