Commit c75be97a authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

#ifdef -DSLAP_NVALUES

parent 2d68ec09
......@@ -900,14 +900,9 @@ dn_match_cleanup:;
at = attrs_find( at->a_next, b->a_dn_at ) )
{
if( value_find_ex( b->a_dn_at,
#ifdef SLAP_NVALUES
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
at->a_nvals,
#else
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
at->a_vals,
#endif
&bv ) == 0 )
{
/* found it */
......@@ -1120,11 +1115,7 @@ dn_match_cleanup:;
for ( i = 0; at->a_vals[i].bv_val != NULL; i++ ) {
if (aci_mask( op,
e, desc, val,
#ifdef SLAP_NVALUES
&at->a_nvals[i],
#else
&at->a_vals[i],
#endif
matches, &grant, &deny ) != 0)
{
tgrant |= grant;
......@@ -1347,13 +1338,9 @@ acl_check_modlist(
case LDAP_MOD_ADD:
assert( mlist->sml_bvalues != NULL );
#ifdef SLAP_NVALUES
for ( bv = mlist->sml_nvalues
? mlist->sml_nvalues : mlist->sml_values;
bv->bv_val != NULL; bv++ )
#else
for ( bv = mlist->sml_bvalues; bv->bv_val != NULL; bv++ )
#endif
{
if ( ! access_allowed( op, e,
mlist->sml_desc, bv, ACL_WRITE, &state ) )
......@@ -1372,13 +1359,9 @@ acl_check_modlist(
}
break;
}
#ifdef SLAP_NVALUES
for ( bv = mlist->sml_nvalues
? mlist->sml_nvalues : mlist->sml_values;
bv->bv_val != NULL; bv++ )
#else
for ( bv = mlist->sml_bvalues; bv->bv_val != NULL; bv++ )
#endif
{
if ( ! access_allowed( op, e,
mlist->sml_desc, bv, ACL_WRITE, &state ) )
......@@ -1841,14 +1824,9 @@ aci_mask(
at = attrs_find( at->a_next, ad ) )
{
if (value_find_ex( ad,
#ifdef SLAP_NVALUES
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
at->a_nvals,
#else
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
at->a_vals,
#endif
&bv) == 0 )
{
rc = 1;
......
......@@ -108,9 +108,7 @@ do_add( Operation *op, SlapReply *rs )
Modifications *mod;
ber_tag_t rtag;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
rtag = ber_scanf( ber, "{m{W}}", &tmp.sml_type, &tmp.sml_values );
......@@ -145,9 +143,7 @@ do_add( Operation *op, SlapReply *rs )
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_values = tmp.sml_values;
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
......@@ -414,7 +410,6 @@ slap_mods2entry(
ch_free( mods->sml_values );
mods->sml_values = NULL;
#ifdef SLAP_NVALUES
if( mods->sml_nvalues ) {
attr->a_nvals = ch_realloc( attr->a_nvals,
sizeof( struct berval ) * (i+j) );
......@@ -428,7 +423,6 @@ slap_mods2entry(
} else {
attr->a_nvals = attr->a_vals;
}
#endif
continue;
#else
......@@ -462,7 +456,6 @@ slap_mods2entry(
} else {
int rc;
#ifdef SLAP_NVALUES
int match;
for ( i = 0; mods->sml_nvalues[i].bv_val != NULL; i++ ) {
......@@ -482,11 +475,6 @@ slap_mods2entry(
}
}
}
#else
rc = modify_check_duplicates( mods->sml_desc, mr,
NULL, mods->sml_bvalues, 0,
text, textbuf, textlen );
#endif
if ( rc != LDAP_SUCCESS ) {
return rc;
}
......@@ -504,14 +492,12 @@ slap_mods2entry(
attr->a_vals = mods->sml_values;
mods->sml_values = NULL;
#ifdef SLAP_NVALUES
if ( mods->sml_nvalues ) {
attr->a_nvals = mods->sml_nvalues;
mods->sml_nvalues = NULL;
} else {
attr->a_nvals = attr->a_vals;
}
#endif
*tail = attr;
tail = &attr->a_next;
......
......@@ -600,9 +600,7 @@ at_schema_info( Entry *e )
AttributeDescription *ad_attributeTypes = slap_schema.si_ad_attributeTypes;
AttributeType *at;
struct berval val;
#ifdef SLAP_NVALUES
struct berval nval;
#endif
LDAP_SLIST_FOREACH(at,&attr_list,sat_next) {
if( at->sat_flags & SLAP_AT_HIDE ) continue;
......@@ -611,14 +609,10 @@ at_schema_info( Entry *e )
return -1;
}
#ifdef SLAP_NVALUES
nval.bv_val = at->sat_oid;
nval.bv_len = strlen(at->sat_oid);
if( attr_merge_one( e, ad_attributeTypes, &val, &nval ) )
#else
if( attr_merge_one( e, ad_attributeTypes, &val ) )
#endif
{
return -1;
}
......
......@@ -26,9 +26,7 @@ void
attr_free( Attribute *a )
{
ber_bvarray_free( a->a_vals );
#ifdef SLAP_NVALUES
if (a->a_nvals != a->a_vals) ber_bvarray_free( a->a_nvals );
#endif
free( a );
}
......@@ -65,7 +63,6 @@ Attribute *attr_dup( Attribute *a )
}
tmp->a_vals[i].bv_val = NULL;
#ifdef SLAP_NVALUES
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++ ) {
......@@ -77,13 +74,10 @@ Attribute *attr_dup( Attribute *a )
} else {
tmp->a_nvals = tmp->a_vals;
}
#endif
} else {
tmp->a_vals = NULL;
#ifdef SLAP_NVALUES
tmp->a_nvals = NULL;
#endif
}
tmp->a_desc = a->a_desc;
......@@ -129,9 +123,7 @@ attr_merge(
Entry *e,
AttributeDescription *desc,
BerVarray vals
#ifdef SLAP_NVALUES
, BerVarray nvals
#endif
) {
int rc;
......@@ -147,19 +139,15 @@ attr_merge(
*a = (Attribute *) ch_malloc( sizeof(Attribute) );
(*a)->a_desc = desc;
(*a)->a_vals = NULL;
#ifdef SLAP_NVALUES
(*a)->a_nvals = NULL;
#endif
(*a)->a_next = NULL;
(*a)->a_flags = 0;
}
rc = value_add( &(*a)->a_vals, vals );
#ifdef SLAP_NVALUES
if( !rc && nvals ) rc = value_add( &(*a)->a_nvals, nvals );
else (*a)->a_nvals = (*a)->a_vals;
#endif
return rc;
}
......@@ -169,9 +157,7 @@ attr_merge_one(
Entry *e,
AttributeDescription *desc,
struct berval *val
#ifdef SLAP_NVALUES
, struct berval *nval
#endif
) {
int rc;
Attribute **a;
......@@ -186,19 +172,15 @@ attr_merge_one(
*a = (Attribute *) ch_malloc( sizeof(Attribute) );
(*a)->a_desc = desc;
(*a)->a_vals = NULL;
#ifdef SLAP_NVALUES
(*a)->a_nvals = NULL;
#endif
(*a)->a_next = NULL;
(*a)->a_flags = 0;
}
rc = value_add_one( &(*a)->a_vals, val );
#ifdef SLAP_NVALUES
if( !rc && nval ) rc = value_add_one( &(*a)->a_nvals, nval );
else (*a)->a_nvals = (*a)->a_vals;
#endif
return rc;
}
......
......@@ -63,14 +63,9 @@ get_ava(
return rc;
}
#ifdef SLAP_NVALUES
rc = asserted_value_validate_normalize(
aa->aa_desc, ad_mr(aa->aa_desc, usage),
usage, &value, &aa->aa_value, text );
#else
rc = value_validate_normalize( aa->aa_desc, usage,
&value, &aa->aa_value, text );
#endif
if( rc != LDAP_SUCCESS ) {
ch_free( aa );
......
......@@ -116,14 +116,10 @@ dn2entry_retry:
{
rs->sr_err = LDAP_COMPARE_FALSE;
#ifdef SLAP_NVALUES
if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
a->a_nvals, &op->oq_compare.rs_ava->aa_value ) == 0 )
#else
if ( value_find( op->oq_compare.rs_ava->aa_desc, a->a_vals, &op->oq_compare.rs_ava->aa_value ) == 0 )
#endif
{
rs->sr_err = LDAP_COMPARE_TRUE;
break;
......
......@@ -348,13 +348,8 @@ bdb_index_entry(
/* add each attribute to the indexes */
for ( ; ap != NULL; ap = ap->a_next ) {
#ifdef SLAP_NVALUES
rc = bdb_index_values( be, txn, ap->a_desc,
ap->a_nvals, e->e_id, op );
#else
rc = bdb_index_values( be, txn, ap->a_desc,
ap->a_vals, e->e_id, op );
#endif
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
......
......@@ -208,11 +208,7 @@ int bdb_modify_internal(
for ( ap = save_attrs; ap != NULL; ap = ap->a_next ) {
if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
rc = bdb_index_values( op->o_bd, tid, ap->a_desc,
#ifdef SLAP_NVALUES
ap->a_nvals,
#else
ap->a_vals,
#endif
e->e_id, SLAP_INDEX_DELETE_OP );
if ( rc != LDAP_SUCCESS ) {
attrs_free( e->e_attrs );
......@@ -236,11 +232,7 @@ int bdb_modify_internal(
for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) {
if (ap->a_flags & SLAP_ATTR_IXADD) {
rc = bdb_index_values( op->o_bd, tid, ap->a_desc,
#ifdef SLAP_NVALUES
ap->a_nvals,
#else
ap->a_vals,
#endif
e->e_id, SLAP_INDEX_ADD_OP );
if ( rc != LDAP_SUCCESS ) {
attrs_free( e->e_attrs );
......
......@@ -931,9 +931,7 @@ done:
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 );
}
}
......
......@@ -207,9 +207,7 @@ retry: /* transaction retry */
ml.sml_desc = slap_schema.si_ad_userPassword;
ml.sml_values = vals;
#ifdef SLAP_NVALUES
ml.sml_nvalues = NULL;
#endif
ml.sml_op = LDAP_MOD_REPLACE;
ml.sml_next = NULL;
......
......@@ -255,10 +255,8 @@ fail:;
v = a->a_vals;
if (a->a_vals != &dummy)
ber_bvarray_free(a->a_vals);
#ifdef SLAP_NVALUES
if (a->a_nvals != v)
ber_bvarray_free(a->a_nvals);
#endif
ch_free(a);
}
......@@ -407,9 +405,7 @@ ldap_build_entry(
const char *text;
int last;
int private = flags & LDAP_BUILD_ENTRY_PRIVATE;
#ifdef SLAP_NVALUES
int normalize = flags & LDAP_BUILD_ENTRY_NORMALIZE;
#endif /* SLAP_NVALUES */
/* safe assumptions ... */
assert( ent );
......@@ -625,7 +621,6 @@ ldap_build_entry(
next_attr:;
#ifdef SLAP_NVALUES
if ( normalize ) {
if ( last && attr->a_desc->ad_type->sat_equality &&
attr->a_desc->ad_type->sat_equality->smr_normalize ) {
......@@ -647,7 +642,6 @@ next_attr:;
} else {
attr->a_nvals = NULL;
}
#endif
*attrp = attr;
attrp = &attr->a_next;
}
......
......@@ -94,14 +94,10 @@ ldbm_back_compare(
{
rs->sr_err = LDAP_COMPARE_FALSE;
#ifdef SLAP_NVALUES
if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
a->a_nvals, &op->oq_compare.rs_ava->aa_value ) == 0 )
#else
if ( value_find( op->oq_compare.rs_ava->aa_desc, a->a_vals, &op->oq_compare.rs_ava->aa_value ) == 0 )
#endif
{
rs->sr_err = LDAP_COMPARE_TRUE;
break;
......
......@@ -310,11 +310,7 @@ index_entry(
/* add each attribute to the indexes */
for ( ; ap != NULL; ap = ap->a_next ) {
index_values( be, ap->a_desc,
#ifdef SLAP_NVALUES
ap->a_nvals,
#else
ap->a_vals,
#endif
e->e_id, op );
}
......
......@@ -223,11 +223,7 @@ int ldbm_modify_internal(
for ( ap = save_attrs; ap != NULL; ap = ap->a_next ) {
if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
rc = index_values( op->o_bd, ap->a_desc,
#ifdef SLAP_NVALUES
ap->a_nvals,
#else
ap->a_vals,
#endif
e->e_id, SLAP_INDEX_DELETE_OP );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
......@@ -249,11 +245,7 @@ int ldbm_modify_internal(
for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) {
if ( ap->a_flags & SLAP_ATTR_IXADD ) {
rc = index_values( op->o_bd, ap->a_desc,
#ifdef SLAP_NVALUES
ap->a_nvals,
#else
ap->a_vals,
#endif
e->e_id, SLAP_INDEX_ADD_OP );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
......
......@@ -647,9 +647,7 @@ return_results:
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 );
}
......
......@@ -134,9 +134,7 @@ ldbm_back_exop_passwd(
ml.sml_desc = slap_schema.si_ad_userPassword;
ml.sml_values = vals;
#ifdef SLAP_NVALUES
ml.sml_nvalues = vals;
#endif
ml.sml_op = LDAP_MOD_REPLACE;
ml.sml_next = NULL;
......
......@@ -76,15 +76,10 @@ monitor_back_compare( struct slap_op *op, struct slap_rep *rs)
a = attrs_find( a->a_next, op->oq_compare.rs_ava->aa_desc )) {
rs->sr_err = LDAP_COMPARE_FALSE;
#ifdef SLAP_NVALUES
if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
a->a_nvals, &op->oq_compare.rs_ava->aa_value ) == 0 )
#else
if ( value_find( ava->aa_desc, a->a_vals,
&op->oq_compare.rs_ava->aa_value ) == 0 )
#endif
{
rs->sr_err = LDAP_COMPARE_TRUE;
break;
......
......@@ -319,20 +319,12 @@ add_values( Entry *e, Modification *mod, int *newlevel )
const char *text = NULL;
struct berval asserted;
#ifdef SLAP_NVALUES
rc = asserted_value_validate_normalize(
mod->sm_desc, mr,
SLAP_MR_EQUALITY,
&mod->sm_bvalues[i],
&asserted,
&text );
#else
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
&mod->sm_bvalues[i],
&asserted,
&text );
#endif
if ( rc != LDAP_SUCCESS ) {
return rc;
......@@ -341,11 +333,7 @@ add_values( Entry *e, Modification *mod, int *newlevel )
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
#ifdef SLAP_NVALUES
0,
#else
SLAP_MR_ATTRIBUTE_SYNTAX_MATCH,
#endif
&a->a_vals[j], &asserted, &text );
if ( rc == LDAP_SUCCESS && match == 0 ) {
......@@ -412,20 +400,12 @@ delete_values( Entry *e, Modification *mod, int *newlevel )
struct berval asserted;
#ifdef SLAP_NVALUES
rc = asserted_value_validate_normalize(
mod->sm_desc, mr,
SLAP_MR_EQUALITY,
&mod->sm_bvalues[i],
&asserted,
&text );
#else
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
&mod->sm_bvalues[i],
&asserted,
&text );
#endif
if( rc != LDAP_SUCCESS ) return rc;
......@@ -433,11 +413,7 @@ delete_values( Entry *e, Modification *mod, int *newlevel )
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
#ifdef SLAP_NVALUES
0,
#else
SLAP_MR_ATTRIBUTE_SYNTAX_MATCH,
#endif
&a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match != 0 ) {
......
......@@ -82,14 +82,10 @@ backsql_compare( Operation *op, SlapReply *rs )
a = attrs_find( a->a_next, op->oq_compare.rs_ava->aa_desc ))
{
rs->sr_err = LDAP_COMPARE_FALSE;
#ifdef SLAP_NVALUES
if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
a->a_nvals, &op->oq_compare.rs_ava->aa_value ) == 0 )
#else
if ( value_find( op->oq_compare.rs_ava->aa_desc, a->a_vals, &op->oq_compare.rs_ava->aa_value ) == 0 )
#endif
{
rs->sr_err = LDAP_COMPARE_TRUE;
break;
......
......@@ -1140,14 +1140,10 @@ backend_group(
if ( e ) {
a = attr_find( e->e_attrs, group_at );
if ( a ) {
#ifdef SLAP_NVALUES
rc = value_find_ex( group_at,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
a->a_nvals, op_ndn );
#else
rc = value_find_ex( group_at, 0, a->a_vals, op_ndn );
#endif
} else {
rc = LDAP_NO_SUCH_ATTRIBUTE;
}
......@@ -1214,20 +1210,12 @@ backend_attribute(
for ( i=0,j=0; a->a_vals[i].bv_val; i++ ) {
if ( op->o_conn && access_allowed( op,
e, entry_at,
#ifdef SLAP_NVALUES
&a->a_nvals[i],
#else
&a->a_vals[i],
#endif
ACL_AUTH, &acl_state ) == 0 ) {
continue;
}
ber_dupbv( &v[j],
#ifdef SLAP_NVALUES
&a->a_nvals[i]
#else
&a->a_vals[i]
#endif
);
if (v[j].bv_val ) j++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment