#ifdef -DSLAP_NVALUES

This commit is contained in:
Kurt Zeilenga 2003-04-05 03:35:16 +00:00
parent 2d68ec09f2
commit c75be97ae9
48 changed files with 2 additions and 1261 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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 );

View file

@ -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;

View file

@ -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

View file

@ -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 );

View file

@ -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 );
}
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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 );
}

View file

@ -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

View file

@ -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 );
}

View file

@ -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;

View file

@ -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;

View file

@ -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 ) {

View file

@ -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;

View file

@ -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++;
}

View file

@ -130,15 +130,10 @@ do_compare(
goto cleanup;
}
#ifdef SLAP_NVALUES
rs->sr_err = asserted_value_validate_normalize( ava.aa_desc,
ava.aa_desc->ad_type->sat_equality,
SLAP_MR_EQUALITY|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
&value, &ava.aa_value, &rs->sr_text );
#else
rs->sr_err = value_validate_normalize( ava.aa_desc, SLAP_MR_EQUALITY,
&value, &ava.aa_value, &rs->sr_text );
#endif
if( rs->sr_err != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
goto cleanup;
@ -331,15 +326,11 @@ static int compare_entry(
{
rc = LDAP_COMPARE_FALSE;
#ifdef SLAP_NVALUES
if ( value_find_ex( ava->aa_desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
a->a_nvals,
&ava->aa_value ) == 0 )
#else
if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
#endif
{
rc = LDAP_COMPARE_TRUE;
break;

View file

@ -250,11 +250,7 @@ controls_root_dse_info( Entry *e )
LDAP_SLIST_FOREACH( sc, &controls_list, sc_next ) {
vals[0].bv_val = sc->sc_oid;
vals[0].bv_len = strlen( sc->sc_oid );
#ifdef SLAP_NVALUES
if ( attr_merge( e, ad_supportedControl, vals, NULL ) )
#else
if ( attr_merge( e, ad_supportedControl, vals ) )
#endif /* SLAP_NVALUES */
return -1;
}

View file

@ -404,9 +404,7 @@ cr_schema_info( Entry *e )
ContentRule *cr;
struct berval val;
#ifdef SLAP_NVALUES
struct berval nval;
#endif
LDAP_SLIST_FOREACH(cr, &cr_list, scr_next) {
if ( ldap_contentrule2bv( &cr->scr_crule, &val ) == NULL ) {
@ -421,14 +419,10 @@ cr_schema_info( Entry *e )
(long) val.bv_len, val.bv_val, 0 );
#endif
#ifdef SLAP_NVALUES
nval.bv_val = cr->scr_oid;
nval.bv_len = strlen(cr->scr_oid);
if( attr_merge_one( e, ad_ditContentRules, &val, &nval ) )
#else
if( attr_merge_one( e, ad_ditContentRules, &val ) )
#endif
{
return -1;
}

View file

@ -239,9 +239,7 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
LDAPAVA *ava = rdn[ 0 ][ iAVA ];
AttributeDescription *ad;
slap_syntax_validate_func *validf = NULL;
#ifdef SLAP_NVALUES
slap_mr_normalize_func *normf = NULL;
#endif
slap_syntax_transform_func *transf = NULL;
MatchingRule *mr = NULL;
struct berval bv = { 0, NULL };
@ -281,11 +279,7 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
} else { /* normalization */
validf = ad->ad_type->sat_syntax->ssyn_validate;
mr = ad->ad_type->sat_equality;
#ifdef SLAP_NVALUES
if( mr ) normf = mr->smr_normalize;
#else
transf = ad->ad_type->sat_syntax->ssyn_normalize;
#endif
}
if ( validf ) {
@ -302,11 +296,7 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
if ( transf ) {
/*
#ifdef SLAP_NVALUES
* transform value by pretty function
#else
* transform value by normalize/pretty function
#endif
* if value is empty, use empty_bv
*/
rc = ( *transf )( ad->ad_type->sat_syntax,
@ -320,7 +310,6 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
}
}
#ifdef SLAP_NVALUES
if ( normf ) {
/*
* normalize value
@ -340,17 +329,6 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
}
}
#else
if( mr && ( mr->smr_usage & SLAP_MR_DN_FOLD ) ) {
char *s = bv.bv_val;
if ( UTF8bvnormalize( &bv, &bv,
LDAP_UTF8_CASEFOLD ) == NULL ) {
return LDAP_INVALID_SYNTAX;
}
free( s );
}
#endif
if( bv.bv_val ) {
free( ava->la_value.bv_val );
@ -365,19 +343,12 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
}
int
#ifdef SLAP_NVALUES
dnNormalize(
slap_mask_t use,
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
struct berval *out )
#else
dnNormalize(
Syntax *syntax,
struct berval *val,
struct berval *out )
#endif
{
assert( val );
assert( out );

View file

@ -45,9 +45,7 @@ str2entry( char *s )
Entry *e;
char *type;
struct berval vals[2];
#ifdef SLAP_NVALUES
struct berval nvals[2], *nvalsp;
#endif
AttributeDescription *ad;
const char *text;
char *next;
@ -239,7 +237,6 @@ str2entry( char *s )
}
}
#ifdef SLAP_NVALUES
nvalsp = NULL;
nvals[0].bv_val = NULL;
@ -272,13 +269,8 @@ str2entry( char *s )
nvalsp = &nvals[0];
}
#endif
#ifdef SLAP_NVALUES
rc = attr_merge( e, ad, vals, nvalsp );
#else
rc = attr_merge( e, ad, vals );
#endif
if( rc != 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, DETAIL1,
@ -295,9 +287,7 @@ str2entry( char *s )
free( type );
free( vals[0].bv_val );
#ifdef SLAP_NVALUES
free( nvals[0].bv_val );
#endif
}
/* check to make sure there was a dn: line */
@ -544,7 +534,6 @@ int entry_encode(Entry *e, struct berval *bv)
}
len += entry_lenlen(i);
siz += sizeof(struct berval); /* empty berval at end */
#ifdef SLAP_NVALUES
if (a->a_nvals != a->a_vals) {
for (i=0; a->a_nvals[i].bv_val; i++) {
siz += sizeof(struct berval);
@ -556,7 +545,6 @@ int entry_encode(Entry *e, struct berval *bv)
} else {
len += entry_lenlen(0); /* 0 nvals */
}
#endif
}
len += 1; /* NUL byte at end */
len += entry_lenlen(siz);
@ -589,7 +577,6 @@ int entry_encode(Entry *e, struct berval *bv)
ptr += a->a_vals[i].bv_len;
*ptr++ = '\0';
}
#ifdef SLAP_NVALUES
if (a->a_nvals != a->a_vals) {
entry_putlen(&ptr, i);
for (i=0; a->a_nvals[i].bv_val; i++) {
@ -602,7 +589,6 @@ int entry_encode(Entry *e, struct berval *bv)
} else {
entry_putlen(&ptr, 0);
}
#endif
}
}
*ptr = '\0';
@ -709,7 +695,6 @@ int entry_decode(struct berval *bv, Entry **e)
bptr->bv_len = 0;
bptr++;
#ifdef SLAP_NVALUES
j = entry_getlen(&ptr);
if (j) {
a->a_nvals = bptr;
@ -727,7 +712,6 @@ int entry_decode(struct berval *bv, Entry **e)
} else {
a->a_nvals = a->a_vals;
}
#endif
}
if (a) a->a_next = NULL;

View file

@ -36,9 +36,7 @@ static int get_simple_vrFilter(
ValuesReturnFilter **f,
const char **text );
#ifdef SLAP_NVALUES
#define XXX 1
#endif
int
get_filter(
@ -430,7 +428,6 @@ get_ssa(
goto return_error;
}
#ifdef SLAP_NVALUES
/* validate/normalize using equality matching rule validator! */
rc = asserted_value_validate_normalize(
ssa.sa_desc, ssa.sa_desc->ad_type->sat_equality,
@ -439,21 +436,6 @@ get_ssa(
if( rc != LDAP_SUCCESS ) {
goto return_error;
}
#else
/* validate using equality matching rule validator! */
rc = value_validate( ssa.sa_desc->ad_type->sat_equality,
&value, text );
if( rc != LDAP_SUCCESS ) {
goto return_error;
}
rc = value_normalize( ssa.sa_desc, usage,
&value, &nvalue, text );
if( rc != LDAP_SUCCESS ) {
goto return_error;
}
#endif
rc = LDAP_PROTOCOL_ERROR;
@ -1459,7 +1441,6 @@ get_substring_vrFilter(
goto return_error;
}
#ifdef SLAP_NVALUES
/* validate/normalize using equality matching rule validator! */
rc = asserted_value_validate_normalize(
vrf->vrf_sub_desc, vrf->vrf_sub_desc->ad_type->sat_equality,
@ -1467,20 +1448,6 @@ get_substring_vrFilter(
if( rc != LDAP_SUCCESS ) {
goto return_error;
}
#else
/* valiate using equality matching rule validator! */
rc = value_validate( vrf->vrf_sub_desc->ad_type->sat_equality,
&value, text );
if( rc != LDAP_SUCCESS ) {
goto return_error;
}
rc = value_normalize( vrf->vrf_sub_desc, usage,
&value, &bv, text );
if( rc != LDAP_SUCCESS ) {
goto return_error;
}
#endif
value = bv;

View file

@ -214,14 +214,12 @@ static int test_mra_filter(
a = attrs_find( a->a_next, mra->ma_desc ) )
{
struct berval *bv;
#ifdef SLAP_NVALUES
/* If ma_rule is not the same as the attribute's
* normal rule, then we can't use the a_nvals.
*/
if (mra->ma_rule == a->a_desc->ad_type->sat_equality)
bv = a->a_nvals;
else
#endif
bv = a->a_vals;
for ( ; bv->bv_val != NULL; bv++ )
{
@ -257,15 +255,9 @@ static int test_mra_filter(
}
/* normalize for equality */
#ifdef SLAP_NVALUES
rc = asserted_value_validate_normalize( a->a_desc, mra->ma_rule,
SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
&mra->ma_value, &value, &text );
#else
rc = value_validate_normalize( a->a_desc,
SLAP_MR_EQUALITY,
&mra->ma_value, &value, &text );
#endif
if ( rc != LDAP_SUCCESS ) {
continue;
}
@ -277,11 +269,9 @@ static int test_mra_filter(
}
/* check match */
#ifdef SLAP_NVALUES
if (mra->ma_rule == a->a_desc->ad_type->sat_equality)
bv = a->a_nvals;
else
#endif
bv = a->a_vals;
for ( ; bv->bv_val != NULL; bv++ )
{
@ -344,15 +334,10 @@ static int test_mra_filter(
}
/* normalize for equality */
#ifdef SLAP_NVALUES
rc = asserted_value_validate_normalize( ad,
mra->ma_rule,
SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
&mra->ma_value, &value, &text );
#else
rc = value_validate_normalize( ad, SLAP_MR_EQUALITY,
&mra->ma_value, &value, &text );
#endif
if ( rc != LDAP_SUCCESS ) {
continue;
}
@ -431,11 +416,7 @@ test_ava_filter(
continue;
}
#ifdef SLAP_NVALUES
for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
#else
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
#endif
{
int ret;
int rc;
@ -659,11 +640,7 @@ test_substrings_filter(
continue;
}
#ifdef SLAP_NVALUES
for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
#else
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
#endif
{
int ret;
int rc;

View file

@ -223,11 +223,7 @@ test_ava_vrFilter(
}
#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;
@ -310,11 +306,7 @@ test_substrings_vrFilter(
continue;
}
#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;
@ -365,26 +357,14 @@ test_mra_vrFilter(
continue;
}
#ifdef SLAP_NVALUES
rc = asserted_value_validate_normalize( a->a_desc, mra->ma_rule,
SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
&mra->ma_value, &value, &text );
#else
/* normalize for equality */
rc = value_validate_normalize( a->a_desc,
SLAP_MR_EQUALITY,
&mra->ma_value, &value,
&text );
#endif
if( rc != LDAP_SUCCESS ) continue;
}
#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;

View file

@ -103,9 +103,7 @@ do_modify(
ber_int_t mop;
Modifications tmp, *mod;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
if ( ber_scanf( op->o_ber, "{i{m[W]}}", &mop,
&tmp.sml_type, &tmp.sml_values )
@ -120,9 +118,7 @@ do_modify(
mod->sml_op = mop;
mod->sml_type = tmp.sml_type;
mod->sml_values = tmp.sml_values;
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
mod->sml_desc = NULL;
mod->sml_next = NULL;
*modtail = mod;
@ -615,7 +611,6 @@ int slap_mods_check(
return LDAP_CONSTRAINT_VIOLATION;
}
#ifdef SLAP_NVALUES
if( nvals && ad->ad_type->sat_equality &&
ad->ad_type->sat_equality->smr_normalize )
{
@ -646,7 +641,6 @@ int slap_mods_check(
ml->sml_nvalues[nvals].bv_val = NULL;
ml->sml_nvalues[nvals].bv_len = 0;
}
#endif
}
}
@ -661,9 +655,7 @@ int slap_mods_opattrs(
char *textbuf, size_t textlen )
{
struct berval name, timestamp, csn;
#ifdef SLAP_NVALUES
struct berval nname;
#endif
char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
Modifications *mod;
@ -692,14 +684,10 @@ int slap_mods_opattrs(
if( op->o_dn.bv_len == 0 ) {
name.bv_val = SLAPD_ANONYMOUS;
name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
#ifdef SLAP_NVALUES
nname = name;
#endif
} else {
name = op->o_dn;
#ifdef SLAP_NVALUES
nname = op->o_ndn;
#endif
}
}
@ -723,14 +711,12 @@ int slap_mods_opattrs(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &tmpval );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
assert( mod->sml_nvalues[0].bv_val );
#endif
*modtail = mod;
modtail = &mod->sml_next;
}
@ -751,9 +737,7 @@ int slap_mods_opattrs(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -766,14 +750,12 @@ int slap_mods_opattrs(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &nname );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
assert( mod->sml_nvalues[0].bv_val );
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -786,9 +768,7 @@ int slap_mods_opattrs(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
}
@ -804,9 +784,7 @@ int slap_mods_opattrs(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -819,14 +797,12 @@ int slap_mods_opattrs(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &nname );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
assert( mod->sml_nvalues[0].bv_val );
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -839,9 +815,7 @@ int slap_mods_opattrs(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
}

View file

@ -458,18 +458,12 @@ slap_modrdn2mods(
}
/* Apply modification */
#ifdef SLAP_NVALUES
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
+ 4 * sizeof( struct berval ) );
#else
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
+ 2 * sizeof( struct berval ) );
#endif
mod_tmp->sml_desc = desc;
mod_tmp->sml_values = ( BerVarray )( mod_tmp + 1 );
mod_tmp->sml_values[0] = new_rdn[0][a_cnt]->la_value;
mod_tmp->sml_values[1].bv_val = NULL;
#ifdef SLAP_NVALUES
if( desc->ad_type->sat_equality->smr_normalize) {
mod_tmp->sml_nvalues = &mod_tmp->sml_values[2];
(void) (*desc->ad_type->sat_equality->smr_normalize)(
@ -482,7 +476,6 @@ slap_modrdn2mods(
} else {
mod_tmp->sml_nvalues = NULL;
}
#endif
mod_tmp->sml_op = SLAP_MOD_SOFTADD;
mod_tmp->sml_next = mod;
mod = mod_tmp;
@ -534,18 +527,12 @@ slap_modrdn2mods(
}
/* Apply modification */
#ifdef SLAP_NVALUES
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
+ 4 * sizeof ( struct berval ) );
#else
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
+ 2 * sizeof ( struct berval ) );
#endif
mod_tmp->sml_desc = desc;
mod_tmp->sml_values = ( BerVarray )(mod_tmp+1);
mod_tmp->sml_values[0] = old_rdn[0][d_cnt]->la_value;
mod_tmp->sml_values[1].bv_val = NULL;
#ifdef SLAP_NVALUES
if( desc->ad_type->sat_equality->smr_normalize) {
mod_tmp->sml_nvalues = &mod_tmp->sml_values[2];
(void) (*desc->ad_type->sat_equality->smr_normalize)(
@ -558,7 +545,6 @@ slap_modrdn2mods(
} else {
mod_tmp->sml_nvalues = NULL;
}
#endif
mod_tmp->sml_op = LDAP_MOD_DELETE;
mod_tmp->sml_next = mod;
mod = mod_tmp;

View file

@ -30,251 +30,7 @@ modify_check_duplicates(
{
int i, j, numvals = 0, nummods,
rc = LDAP_SUCCESS, matched;
#ifdef SLAP_NVALUES
/* this function is no longer used */
#else
BerVarray nvals = NULL, nmods = NULL;
/*
* FIXME: better do the following
*
* - count the existing values
* - count the new values
*
* - if the existing values are less than the new ones {
* - normalize all the existing values
* - for each new value {
* - normalize
* - check with existing
* - cross-check with already normalized new vals
* }
* } else {
* - for each new value {
* - normalize
* - cross-check with already normalized new vals
* }
* - for each existing value {
* - normalize
* - check with already normalized new values
* }
* }
*
* The first case is good when adding a lot of new values,
* and significantly at first import of values (e.g. adding
* a new group); the latter case seems to be quite important
* as well, because it is likely to be the most frequently
* used when administering the entry. The current
* implementation will always normalize all the existing
* values before checking. If there's no duplicate, the
* performances should not change; they will in case of error.
*/
for ( nummods = 0; mods[ nummods ].bv_val != NULL; nummods++ )
/* count new values */ ;
if ( vals ) {
for ( numvals = 0; vals[ numvals ].bv_val != NULL; numvals++ )
/* count existing values */ ;
if ( numvals < nummods ) {
nvals = SLAP_CALLOC( numvals + 1, sizeof( struct berval ) );
if( nvals == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 );
#endif
goto return_results;
}
/* normalize the existing values first */
for ( j = 0; vals[ j ].bv_val != NULL; j++ ) {
rc = value_normalize( ad, SLAP_MR_EQUALITY,
&vals[ j ], &nvals[ j ], text );
/* existing attribute values must normalize */
assert( rc == LDAP_SUCCESS );
if ( rc != LDAP_SUCCESS ) {
nvals[ j ].bv_val = NULL;
goto return_results;
}
}
nvals[ j ].bv_val = NULL;
}
}
/*
* If the existing values are less than the new values,
* it is more convenient to normalize all the existing
* values and test each new value against them first,
* then to other already normalized values
*/
nmods = SLAP_CALLOC( nummods + 1, sizeof( struct berval ) );
if ( nmods == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 );
#endif
goto return_results;
}
for ( i=0; mods[i].bv_val != NULL; i++ ) {
rc = value_normalize( ad, SLAP_MR_EQUALITY,
&mods[i], &nmods[i], text );
if ( rc != LDAP_SUCCESS ) {
nmods[i].bv_val = NULL;
goto return_results;
}
if ( numvals > 0 && numvals < nummods ) {
for ( matched=0, j=0; nvals[j].bv_val; j++ ) {
int match;
rc = (*mr->smr_match)( &match,
SLAP_MR_ATTRIBUTE_SYNTAX_MATCH,
ad->ad_type->sat_syntax,
mr, &nmods[ i ], &nvals[ j ] );
if ( rc != LDAP_SUCCESS ) {
nmods[ i + 1 ].bv_val = NULL;
*text = textbuf;
snprintf( textbuf, textlen,
"%s: matching rule failed",
ad->ad_cname.bv_val );
goto return_results;
}
if ( match == 0 ) {
if ( permissive ) {
matched++;
continue;
}
*text = textbuf;
snprintf( textbuf, textlen,
"%s: value #%d provided more than once",
ad->ad_cname.bv_val, i );
rc = LDAP_TYPE_OR_VALUE_EXISTS;
nmods[ i + 1 ].bv_val = NULL;
goto return_results;
}
}
if ( permissive && matched == j ) {
nmods[ i + 1 ].bv_val = NULL;
rc = LDAP_TYPE_OR_VALUE_EXISTS;
goto return_results;
}
}
for ( matched = 0, j = 0; j < i; j++ ) {
int match;
rc = (*mr->smr_match)( &match,
SLAP_MR_ATTRIBUTE_SYNTAX_MATCH,
ad->ad_type->sat_syntax,
mr, &nmods[ i ], &nmods[ j ] );
if ( rc != LDAP_SUCCESS ) {
nmods[ i + 1 ].bv_val = NULL;
*text = textbuf;
snprintf( textbuf, textlen,
"%s: matching rule failed",
ad->ad_cname.bv_val );
goto return_results;
}
if ( match == 0 ) {
if ( permissive ) {
matched++;
continue;
}
*text = textbuf;
snprintf( textbuf, textlen,
"%s: value #%d provided more than once",
ad->ad_cname.bv_val, j );
rc = LDAP_TYPE_OR_VALUE_EXISTS;
nmods[ i + 1 ].bv_val = NULL;
goto return_results;
}
}
if ( permissive && matched == j ) {
nmods[ i + 1 ].bv_val = NULL;
rc = LDAP_TYPE_OR_VALUE_EXISTS;
goto return_results;
}
}
nmods[ i ].bv_val = NULL;
/*
* if new values are more than existing values, it is more
* convenient to normalize and check all new values first,
* then check each new value against existing values, which
* can be normalized in place
*/
if ( numvals >= nummods ) {
for ( j = 0; vals[ j ].bv_val; j++ ) {
struct berval asserted;
rc = value_normalize( ad, SLAP_MR_EQUALITY,
&vals[ j ], &asserted, text );
if ( rc != LDAP_SUCCESS ) {
goto return_results;
}
for ( matched = 0, i = 0; nmods[ i ].bv_val; i++ ) {
int match;
rc = (*mr->smr_match)( &match,
SLAP_MR_ATTRIBUTE_SYNTAX_MATCH,
ad->ad_type->sat_syntax,
mr, &nmods[ i ], &asserted );
if ( rc != LDAP_SUCCESS ) {
*text = textbuf;
snprintf( textbuf, textlen,
"%s: matching rule failed",
ad->ad_cname.bv_val );
goto return_results;
}
if ( match == 0 ) {
if ( permissive ) {
matched++;
continue;
}
*text = textbuf;
snprintf( textbuf, textlen,
"%s: value #%d provided more than once",
ad->ad_cname.bv_val, j );
rc = LDAP_TYPE_OR_VALUE_EXISTS;
goto return_results;
}
}
if ( permissive && matched == i ) {
rc = LDAP_TYPE_OR_VALUE_EXISTS;
goto return_results;
}
}
}
return_results:;
if ( nvals ) {
ber_bvarray_free( nvals );
}
if ( nmods ) {
ber_bvarray_free( nmods );
}
#endif
return rc;
}
@ -362,7 +118,6 @@ modify_add_values(
}
} else {
#ifdef SLAP_NVALUES
/* no normalization is done in this routine nor
* in the matching routines called by this routine.
* values are now normalized once on input to the
@ -371,53 +126,16 @@ modify_add_values(
* This should outperform the old code. No numbers
* are available yet.
*/
#else
/*
* The original code performs ( n ) normalizations
* and ( n * ( n - 1 ) / 2 ) matches, which hide
* the same number of normalizations. The new code
* performs the same number of normalizations ( n )
* and ( n * ( n - 1 ) / 2 ) mem compares, far less
* expensive than an entire match, if a match is
* equivalent to a normalization and a mem compare ...
*
* This is far more memory expensive than the previous,
* but it can heavily improve performances when big
* chunks of data are added (typical example is a group
* with thousands of DN-syntax members; on my system:
* for members of 5-RDN DNs,
members orig bvmatch (dirty) new
1000 0m38.456s 0m0.553s 0m0.608s
2000 2m33.341s 0m0.851s 0m1.003s
* Moreover, 100 groups with 10000 members each were
* added in 37m27.933s (an analogous LDIF file was
* loaded into Active Directory in 38m28.682s, BTW).
*
* Maybe we could switch to the new algorithm when
* the number of values overcomes a given threshold?
*/
#endif
int rc;
if ( mod->sm_bvalues[1].bv_val == 0 ) {
if ( a != NULL ) {
int i;
#ifndef SLAP_NVALUES
struct berval asserted;
rc = value_normalize( mod->sm_desc, SLAP_MR_EQUALITY,
&mod->sm_bvalues[ 0 ], &asserted, text );
if ( rc != LDAP_SUCCESS ) {
return rc;
}
#endif
for ( matched = 0, i = 0; a->a_vals[ i ].bv_val; i++ ) {
int match;
#ifdef SLAP_NVALUES
if( mod->sm_nvalues ) {
rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_EQUALITY
@ -437,22 +155,12 @@ modify_add_values(
text );
}
#else
rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_ATTRIBUTE_SYNTAX_MATCH,
&a->a_vals[i],
&asserted,
text );
#endif
if( rc == LDAP_SUCCESS && match == 0 ) {
if ( permissive ) {
matched++;
continue;
}
#ifndef SLAP_NVALUES
free( asserted.bv_val );
#endif
*text = textbuf;
snprintf( textbuf, textlen,
"modify/%s: %s: value #0 already exists",
@ -460,9 +168,6 @@ modify_add_values(
return LDAP_TYPE_OR_VALUE_EXISTS;
}
}
#ifndef SLAP_NVALUES
free( asserted.bv_val );
#endif
if ( permissive && matched == i ) {
/* values already exist; do nothing */
return LDAP_SUCCESS;
@ -485,11 +190,7 @@ modify_add_values(
}
/* no - add them */
#ifdef SLAP_NVALUES
if( attr_merge( e, mod->sm_desc, mod->sm_values, mod->sm_nvalues ) != 0 )
#else
if( attr_merge( e, mod->sm_desc, mod->sm_bvalues ) != 0 )
#endif
{
/* this should return result of attr_merge */
*text = textbuf;
@ -514,9 +215,6 @@ modify_delete_values(
int i, j, k, rc = LDAP_SUCCESS;
Attribute *a;
MatchingRule *mr = mod->sm_desc->ad_type->sat_equality;
#ifndef SLAP_NVALUES
BerVarray nvals = NULL;
#endif
char dummy = '\0';
/*
@ -562,63 +260,13 @@ modify_delete_values(
return LDAP_NO_SUCH_ATTRIBUTE;
}
#ifndef SLAP_NVALUES
/* find each value to delete */
for ( j = 0; a->a_vals[ j ].bv_val != NULL; j++ )
/* count existing values */ ;
nvals = (BerVarray)SLAP_CALLOC( j + 1, sizeof ( struct berval ) );
if( nvals == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
"modify_delete_values: SLAP_CALLOC failed", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"modify_delete_values: SLAP_CALLOC failed", 0, 0, 0 );
#endif
goto return_results;
}
/* normalize existing values */
for ( j = 0; a->a_vals[ j ].bv_val != NULL; j++ ) {
rc = value_normalize( a->a_desc, SLAP_MR_EQUALITY,
&a->a_vals[ j ], &nvals[ j ], text );
if ( rc != LDAP_SUCCESS ) {
nvals[ j ].bv_val = NULL;
goto return_results;
}
}
#endif
for ( i = 0; mod->sm_values[i].bv_val != NULL; i++ ) {
int found = 0;
#ifndef SLAP_NVALUES
struct berval asserted;
/* normalize the value to be deleted */
rc = value_normalize( mod->sm_desc, SLAP_MR_EQUALITY,
&mod->sm_bvalues[ i ], &asserted, text );
if( rc != LDAP_SUCCESS ) {
goto return_results;
}
/* search it */
for ( j = 0; nvals[ j ].bv_val != NULL; j++ )
#else
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ )
#endif
{
int match;
#ifndef SLAP_NVALUES
if ( nvals[j].bv_val == &dummy ) {
continue;
}
#endif
#ifdef SLAP_NVALUES
if( mod->sm_nvalues ) {
assert( a->a_nvals );
rc = (*mr->smr_match)( &match,
@ -638,18 +286,8 @@ modify_delete_values(
mr, &a->a_vals[j],
&mod->sm_values[i] );
}
#else
rc = (*mr->smr_match)( &match,
SLAP_MR_ATTRIBUTE_SYNTAX_MATCH,
a->a_desc->ad_type->sat_syntax,
mr, &nvals[ j ],
&asserted );
#endif
if ( rc != LDAP_SUCCESS ) {
#ifndef SLAP_NVALUES
free( asserted.bv_val );
#endif
*text = textbuf;
snprintf( textbuf, textlen,
"%s: matching rule failed",
@ -664,24 +302,16 @@ modify_delete_values(
found = 1;
/* delete value and mark it as dummy */
#ifdef SLAP_NVALUES
free( a->a_vals[j].bv_val );
a->a_vals[j].bv_val = &dummy;
if( a->a_nvals != a->a_vals ) {
free( a->a_nvals[j].bv_val );
a->a_nvals[j].bv_val = &dummy;
}
#else
free( nvals[ j ].bv_val );
nvals[ j ].bv_val = &dummy;
#endif
break;
}
#ifndef SLAP_NVALUES
free( asserted.bv_val );
#endif
if ( found == 0 ) {
*text = textbuf;
@ -694,49 +324,25 @@ modify_delete_values(
}
/* compact array skipping dummies */
#ifdef SLAP_NVALUES
for ( k = 0, j = 0; a->a_vals[k].bv_val != NULL; k++ )
#else
for ( k = 0, j = 0; nvals[k].bv_val != NULL; j++, k++ )
#endif
{
#ifdef SLAP_NVALUES
/* skip dummies */
if( a->a_vals[k].bv_val == &dummy ) {
assert( a->a_nvals == NULL || a->a_nvals[k].bv_val == &dummy );
continue;
}
#else
/* delete and skip dummies */ ;
for ( ; nvals[ k ].bv_val == &dummy; k++ ) {
free( a->a_vals[ k ].bv_val );
}
#endif
if ( j != k ) {
a->a_vals[ j ] = a->a_vals[ k ];
#ifdef SLAP_NVALUES
if (a->a_nvals != a->a_vals) {
a->a_nvals[ j ] = a->a_nvals[ k ];
}
#endif
}
#ifndef SLAP_NVALUES
if ( a->a_vals[ k ].bv_val == NULL ) {
break;
}
#else
j++;
#endif
}
a->a_vals[j].bv_val = NULL;
#ifdef SLAP_NVALUES
if (a->a_nvals != a->a_vals) a->a_nvals[j].bv_val = NULL;
#else
assert( i == k - j );
#endif
/* if no values remain, delete the entire attribute */
if ( a->a_vals[0].bv_val == NULL ) {
@ -750,17 +356,6 @@ modify_delete_values(
}
return_results:;
#ifndef SLAP_NVALUES
if ( nvals ) {
/* delete the remaining normalized values */
for ( j = 0; nvals[ j ].bv_val != NULL; j++ ) {
if ( nvals[ j ].bv_val != &dummy ) {
ber_memfree( nvals[ j ].bv_val );
}
}
ber_memfree( nvals );
}
#endif
return rc;
}
@ -792,10 +387,8 @@ slap_mod_free(
if ( mod->sm_values != NULL ) ber_bvarray_free( mod->sm_values );
mod->sm_values = NULL;
#ifdef SLAP_NVALUES
if ( mod->sm_nvalues != NULL ) ber_bvarray_free( mod->sm_nvalues );
mod->sm_nvalues = NULL;
#endif
if( freeit ) free( mod );
}

View file

@ -181,9 +181,6 @@ mr_add(
smr->smr_compat_syntaxes = compat_syn;
smr->smr_normalize = def->mrd_normalize;
smr->smr_match = def->mrd_match;
#ifndef SLAP_NVALUES
smr->smr_convert = def->mrd_convert;
#endif
smr->smr_indexer = def->mrd_indexer;
smr->smr_filter = def->mrd_filter;
smr->smr_associated = amr;
@ -443,9 +440,7 @@ int mr_schema_info( Entry *e )
{
AttributeDescription *ad_matchingRules = slap_schema.si_ad_matchingRules;
MatchingRule *mr;
#ifdef SLAP_NVALUES
struct berval nval;
#endif
LDAP_SLIST_FOREACH(mr, &mr_list, smr_next ) {
if ( mr->smr_usage & SLAP_MR_HIDE ) {
@ -467,13 +462,9 @@ int mr_schema_info( Entry *e )
Debug( LDAP_DEBUG_TRACE, "Merging mr [%lu] %s\n",
mr->smr_str.bv_len, mr->smr_str.bv_val, 0 );
#endif
#ifdef SLAP_NVALUES
nval.bv_val = mr->smr_oid;
nval.bv_len = strlen(mr->smr_oid);
if( attr_merge_one( e, ad_matchingRules, &mr->smr_str, &nval ) )
#else
if( attr_merge_one( e, ad_matchingRules, &mr->smr_str ) )
#endif
{
return -1;
}
@ -486,9 +477,7 @@ int mru_schema_info( Entry *e )
AttributeDescription *ad_matchingRuleUse
= slap_schema.si_ad_matchingRuleUse;
MatchingRuleUse *mru;
#ifdef SLAP_NVALUES
struct berval nval;
#endif
LDAP_SLIST_FOREACH( mru, &mru_list, smru_next ) {
@ -505,13 +494,9 @@ int mru_schema_info( Entry *e )
Debug( LDAP_DEBUG_TRACE, "Merging mru [%lu] %s\n",
mru->smru_str.bv_len, mru->smru_str.bv_val, 0 );
#endif
#ifdef SLAP_NVALUES
nval.bv_val = mru->smru_oid;
nval.bv_len = strlen(mru->smru_oid);
if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str, &nval ) )
#else
if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str ) )
#endif
{
return -1;
}

View file

@ -201,25 +201,8 @@ get_mra(
return LDAP_INAPPROPRIATE_MATCHING;
}
#ifndef SLAP_NVALUES
/*
* OK, if no matching rule, normalize for equality, otherwise
* normalize for the matching rule.
*/
rc = value_validate_normalize( ma.ma_desc, SLAP_MR_EQUALITY,
&value, &ma.ma_value, text );
} else {
/*
* Need to normalize, but how?
*/
rc = value_validate( ma.ma_rule, &value, text );
if ( rc == LDAP_SUCCESS ) {
ber_dupbv( &ma.ma_value, &value );
}
#endif
}
#ifdef SLAP_NVALUES
/*
* Normalize per matching rule
*/
@ -227,7 +210,6 @@ get_mra(
ma.ma_rule,
SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
&value, &ma.ma_value, text );
#endif
if( rc != LDAP_SUCCESS ) {
return rc;

View file

@ -483,9 +483,7 @@ oc_schema_info( Entry *e )
AttributeDescription *ad_objectClasses = slap_schema.si_ad_objectClasses;
ObjectClass *oc;
struct berval val;
#ifdef SLAP_NVALUES
struct berval nval;
#endif
LDAP_SLIST_FOREACH( oc, &oc_list, soc_next ) {
if( oc->soc_flags & SLAP_OC_HIDE ) continue;
@ -498,14 +496,10 @@ oc_schema_info( Entry *e )
Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s\n",
(long) val.bv_len, val.bv_val, 0 );
#endif
#ifdef SLAP_NVALUES
nval.bv_val = oc->soc_oid;
nval.bv_len = strlen(oc->soc_oid);
if( attr_merge_one( e, ad_objectClasses, &val, &nval ) )
#else
if( attr_merge_one( e, ad_objectClasses, &val ) )
#endif
{
return -1;
}

View file

@ -28,12 +28,10 @@ slap_operational_subschemaSubentry( Backend *be )
a->a_vals[1].bv_len = 0;
a->a_vals[1].bv_val = NULL;
#ifdef SLAP_NVALUES
a->a_nvals = ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( a->a_nvals, &global_schemandn );
a->a_nvals[1].bv_len = 0;
a->a_nvals[1].bv_val = NULL;
#endif
a->a_next = NULL;
a->a_flags = 0;
@ -65,9 +63,7 @@ slap_operational_hasSubordinate( int hs )
ber_str2bv( val, len, 1, a->a_vals );
a->a_vals[1].bv_val = NULL;
#ifdef SLAP_NVALUES
a->a_nvals = a->a_vals;
#endif
a->a_next = NULL;
a->a_flags = 0;

View file

@ -135,7 +135,6 @@ LDAP_SLAPD_F (int) at_next LDAP_P(( AttributeType **at ));
LDAP_SLAPD_F (void) attr_free LDAP_P(( Attribute *a ));
LDAP_SLAPD_F (Attribute *) attr_dup LDAP_P(( Attribute *a ));
#ifdef SLAP_NVALUES
#define attr_mergeit( e, d, v ) attr_merge( e, d, v, NULL /* FIXME */ )
#define attr_mergeit_one( e, d, v ) attr_merge_one( e, d, v, NULL /* FIXME */ )
@ -147,16 +146,6 @@ LDAP_SLAPD_F (int) attr_merge_one LDAP_P(( Entry *e,
AttributeDescription *desc,
struct berval *val,
struct berval *nval ));
#else
#define attr_mergeit( e, d, v ) attr_merge( e, d, v )
#define attr_mergeit_one( e, d, v ) attr_merge_one( e, d, v )
LDAP_SLAPD_F (int) attr_merge LDAP_P(( Entry *e,
AttributeDescription *desc,
BerVarray vals ));
LDAP_SLAPD_F (int) attr_merge_one LDAP_P(( Entry *e,
AttributeDescription *desc,
struct berval *val ));
#endif
LDAP_SLAPD_F (Attribute *) attrs_find LDAP_P((
Attribute *a, AttributeDescription *desc ));
LDAP_SLAPD_F (Attribute *) attr_find LDAP_P((
@ -381,7 +370,6 @@ LDAP_SLAPD_F (int) dnValidate LDAP_P((
Syntax *syntax,
struct berval *val ));
#ifdef SLAP_NVALUES
LDAP_SLAPD_F (int) dnNormalize LDAP_P((
slap_mask_t use,
Syntax *syntax,
@ -389,13 +377,6 @@ LDAP_SLAPD_F (int) dnNormalize LDAP_P((
struct berval *val,
struct berval *normalized ));
#define dnNormalize2(s,v,n) dnNormalize(0,(s),NULL,(v),(n))
#else
LDAP_SLAPD_F (int) dnNormalize LDAP_P((
Syntax *syntax,
struct berval *val,
struct berval *normalized ));
#define dnNormalize2(s,v,n) dnNormalize((s),(v),(n))
#endif
LDAP_SLAPD_F (int) dnPretty LDAP_P((
Syntax *syntax,
@ -1004,7 +985,6 @@ LDAP_SLAPD_F (void) slap_init_user LDAP_P(( char *username, char *groupname ));
/*
* value.c
*/
#ifdef SLAP_NVALUES
LDAP_SLAPD_F (int) asserted_value_validate_normalize LDAP_P((
AttributeDescription *ad,
MatchingRule *mr,
@ -1012,25 +992,6 @@ LDAP_SLAPD_F (int) asserted_value_validate_normalize LDAP_P((
struct berval *in,
struct berval *out,
const char ** text ));
#else
LDAP_SLAPD_F (int) value_validate LDAP_P((
MatchingRule *mr,
struct berval *in,
const char ** text ));
LDAP_SLAPD_F (int) value_normalize LDAP_P((
AttributeDescription *ad,
unsigned usage,
struct berval *in,
struct berval *out,
const char ** text ));
LDAP_SLAPD_F (int) value_validate_normalize LDAP_P((
AttributeDescription *ad,
unsigned usage,
struct berval *in,
struct berval *out,
const char ** text ));
#define value_find(ad,values,value) (value_find_ex((ad),0,(values),(value)))
#endif
LDAP_SLAPD_F (int) value_match LDAP_P((
int *match,

View file

@ -43,9 +43,7 @@ root_dse_info(
{
Entry *e;
struct berval vals[2], *bv;
#ifdef SLAP_NVALUES
struct berval nvals[2];
#endif
int i, j;
char ** supportedSASLMechanisms;
@ -69,9 +67,7 @@ root_dse_info(
= slap_schema.si_ad_ref;
vals[1].bv_val = NULL;
#ifdef SLAP_NVALUES
nvals[1].bv_val = NULL;
#endif
e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
@ -100,39 +96,23 @@ root_dse_info(
vals[0].bv_val = "top";
vals[0].bv_len = sizeof("top")-1;
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_objectClass, vals, NULL ) )
#else
if( attr_merge( e, ad_objectClass, vals ) )
#endif
{
return LDAP_OTHER;
}
vals[0].bv_val = "OpenLDAProotDSE";
vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
#ifdef SLAP_NVALUES
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, NULL ) )
#else
if( attr_merge( e, ad_structuralObjectClass, vals ) )
#endif
return LDAP_OTHER;
for ( i = 0; i < nbackends; i++ ) {
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 ) )
#endif
{
return LDAP_OTHER;
}
@ -143,12 +123,8 @@ root_dse_info(
}
for ( j = 0; backends[i].be_suffix[j].bv_val != NULL; j++ ) {
vals[0] = backends[i].be_suffix[j];
#ifdef SLAP_NVALUES
nvals[0] = backends[i].be_nsuffix[0];
if( attr_merge( e, ad_namingContexts, vals, nvals ) )
#else
if( attr_merge( e, ad_namingContexts, vals ) )
#endif
{
return LDAP_OTHER;
}
@ -165,11 +141,7 @@ root_dse_info(
/* supportedExtension */
for ( i=0; (bv = get_supported_extop(i)) != NULL; i++ ) {
vals[0] = *bv;
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_supportedExtension, vals, NULL ) )
#else
if( attr_merge( e, ad_supportedExtension, vals ) )
#endif
{
return LDAP_OTHER;
}
@ -179,11 +151,7 @@ root_dse_info(
/* netscape supportedExtension */
for ( i = 0; (bv = ns_get_supported_extop(i)) != NULL; i++ ) {
vals[0] = *bv;
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_supportedExtension, vals, NULL ))
#else
if( attr_merge( e, ad_supportedExtension, vals ))
#endif
{
return LDAP_OTHER;
}
@ -191,12 +159,8 @@ root_dse_info(
#endif /* LDAP_SLAPI */
/* supportedFeatures */
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_supportedFeatures,
supportedFeatures, NULL ) )
#else
if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
#endif
{
return LDAP_OTHER;
}
@ -213,11 +177,7 @@ root_dse_info(
snprintf(buf, sizeof buf, "%d", i);
vals[0].bv_val = buf;
vals[0].bv_len = strlen( vals[0].bv_val );
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_supportedLDAPVersion, vals, NULL ) )
#else
if( attr_merge( e, ad_supportedLDAPVersion, vals ) )
#endif
{
return LDAP_OTHER;
}
@ -230,11 +190,7 @@ root_dse_info(
for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
vals[0].bv_val = supportedSASLMechanisms[i];
vals[0].bv_len = strlen( vals[0].bv_val );
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_supportedSASLMechanisms, vals, NULL ) )
#else
if( attr_merge( e, ad_supportedSASLMechanisms, vals ) )
#endif
{
return LDAP_OTHER;
}
@ -243,11 +199,7 @@ root_dse_info(
}
if ( default_referral != NULL ) {
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_ref, default_referral, NULL /* FIXME */ ) )
#else
if( attr_merge( e, ad_ref, default_referral ) )
#endif
{
return LDAP_OTHER;
}
@ -256,12 +208,8 @@ root_dse_info(
if( usr_attr != NULL) {
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 == a->a_vals) ? NULL : a->a_nvals ) )
#else
if( attr_merge( e, a->a_desc, a->a_vals ) )
#endif
{
return LDAP_OTHER;
}
@ -334,12 +282,8 @@ int read_root_dse_file( const char *fname )
*/
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 == a->a_vals) ? NULL : a->a_nvals ) )
#else
if( attr_merge( usr_attr, a->a_desc, a->a_vals ) )
#endif
{
rc = LDAP_OTHER;
break;

View file

@ -32,9 +32,7 @@ schema_info( Entry **entry, const char **text )
Entry *e;
struct berval vals[5];
#ifdef SLAP_NVALUES
struct berval nvals[5];
#endif
e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
if( e == NULL ) {
@ -60,11 +58,7 @@ schema_info( Entry **entry, const char **text )
vals[0].bv_val = "subentry";
vals[0].bv_len = sizeof("subentry")-1;
#ifdef SLAP_NVALUES
if( attr_merge_one( e, ad_structuralObjectClass, vals, vals ) )
#else
if( attr_merge_one( e, ad_structuralObjectClass, vals ) )
#endif
{
/* Out of memory, do something about it */
entry_free( e );
@ -81,11 +75,7 @@ schema_info( Entry **entry, const char **text )
vals[3].bv_val = "extensibleObject";
vals[3].bv_len = sizeof("extensibleObject")-1;
vals[4].bv_val = NULL;
#ifdef SLAP_NVALUES
if( attr_merge( e, ad_objectClass, vals, vals ) )
#else
if( attr_merge( e, ad_objectClass, vals ) )
#endif
{
/* Out of memory, do something about it */
entry_free( e );
@ -116,7 +106,6 @@ schema_info( Entry **entry, const char **text )
return LDAP_OTHER;
}
#ifdef SLAP_NVALUES
nvals[0].bv_val = strchr( global_schemandn.bv_val, '=' );
assert( nvals[0].bv_val );
nvals[0].bv_val++;
@ -124,9 +113,6 @@ schema_info( Entry **entry, const char **text )
(nvals[0].bv_val - global_schemandn.bv_val);
if( attr_merge_one( e, desc, vals, nvals ) )
#else
if( attr_merge_one( e, desc, vals ) )
#endif
{
/* Out of memory, do something about it */
entry_free( e );
@ -158,22 +144,14 @@ schema_info( Entry **entry, const char **text )
vals[0].bv_val = timebuf;
vals[0].bv_len = strlen( timebuf );
#ifdef SLAP_NVALUES
if( attr_merge_one( e, ad_createTimestamp, vals, vals ) )
#else
if( attr_merge_one( e, ad_createTimestamp, vals ) )
#endif
{
/* Out of memory, do something about it */
entry_free( e );
*text = "out of memory";
return LDAP_OTHER;
}
#ifdef SLAP_NVALUES
if( attr_merge_one( e, ad_modifyTimestamp, vals, vals ) )
#else
if( attr_merge_one( e, ad_modifyTimestamp, vals ) )
#endif
{
/* Out of memory, do something about it */
entry_free( e );

View file

@ -856,14 +856,10 @@ entry_naming_check(
rc = LDAP_NAMING_VIOLATION;
}
#ifdef SLAP_NVALUES
if ( value_find_ex( desc,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
attr->a_nvals,
&ava->la_value ) != 0 )
#else
if ( value_find( desc, attr->a_vals, &ava->la_value ) != 0 )
#endif
{
snprintf( textbuf, textlen,
"value of naming attribute '%s' is not present in entry",

View file

@ -28,6 +28,8 @@
#define HASH_Update(c,buf,len) lutil_HASHUpdate(c,buf,len)
#define HASH_Final(d,c) lutil_HASHFinal(d,c)
#define SLAP_NVALUES 1
#ifdef SLAP_NVALUES
/* TO BE DELETED */
#define SLAP_MR_DN_FOLD (0)

View file

@ -90,11 +90,7 @@ objectSubClassMatch(
return SLAPD_COMPARE_UNDEFINED;
}
#ifdef SLAP_NVALUES
if( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( flags ) )
#else
if( SLAP_IS_MR_ATTRIBUTE_SYNTAX_MATCH( flags ) )
#endif
{
*matchp = ( asserted != oc );
} else {

View file

@ -36,7 +36,6 @@
#include "ldap_queue.h"
#ifdef LDAP_DEVEL
#define SLAP_NVALUES 1
#define SLAP_EXTENDED_SCHEMA 1
#define LDAP_CACHING
#endif
@ -320,9 +319,6 @@ typedef struct slap_syntax {
#define SLAP_SYNTAX_HIDE 0x8000U /* hide (do not publish) */
slap_syntax_validate_func *ssyn_validate;
#ifndef SLAP_NVALUES
slap_syntax_transform_func *ssyn_normalize;
#endif
slap_syntax_transform_func *ssyn_pretty;
#ifdef SLAPD_BINARY_CONVERSION
@ -344,11 +340,7 @@ typedef struct slap_syntax_defs_rec {
char *sd_desc;
int sd_flags;
slap_syntax_validate_func *sd_validate;
#ifdef SLAP_NVALUES
slap_syntax_transform_func *sd_normalizeXXX; /* to be deleted */
#else
slap_syntax_transform_func *sd_normalize;
#endif
slap_syntax_transform_func *sd_pretty;
#ifdef SLAPD_BINARY_CONVERSION
slap_syntax_transform_func *sd_ber2str;
@ -436,29 +428,7 @@ typedef struct slap_matching_rule {
#define SLAP_MR_SUBSTR_ANY ( SLAP_MR_SUBSTR | 0x0200U )
#define SLAP_MR_SUBSTR_FINAL ( SLAP_MR_SUBSTR | 0x0400U )
#ifndef SLAP_NVALUES
#define SLAP_MR_DN_FOLD 0x0080U
#endif
#ifndef SLAP_NVALUES
/*
* normally the asserted value is expected to conform to
* assertion syntax specified in the matching rule, however
* at times (such as during individual value modification),
* the asserted value is expected to conform to the
* attribute's value syntax.
*/
#define SLAP_MR_ASSERTION_SYNTAX_MATCH 0x0000U
#define SLAP_MR_ATTRIBUTE_SYNTAX_MATCH 0x0001U
/* For SLAP_MR_ATTRIBUTE_SYNTAX_MATCHes, this flag indicates
* that the asserted value of the attribute syntax has been
* converted to the assertion syntax. (Not sure why we just
* don't clear the SLAP_MR_ATTRIBUTE_SYNTAX_MATCH flag instead.)
*/
#define SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH 0x0002U
#else
/*
* The asserted value, depending on the particular usage,
* is expected to conform to either the assertion syntax
@ -477,7 +447,6 @@ typedef struct slap_matching_rule {
((usage) & SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX )
#define SLAP_MR_IS_VALUE_OF_ASSERTION_SYNTAX( usage ) \
((usage) & SLAP_MR_VALUE_OF_ASSERTION_SYNTAX )
#endif
/* either or both the asserted value or attribute value
* may be provided in normalized form
@ -947,9 +916,7 @@ typedef struct slap_valuesreturnfilter {
typedef struct slap_attr {
AttributeDescription *a_desc;
BerVarray a_vals; /* preserved values */
#ifdef SLAP_NVALUES
BerVarray a_nvals; /* normalized values */
#endif
struct slap_attr *a_next;
unsigned a_flags;
#define SLAP_ATTR_IXADD 0x1U
@ -1000,9 +967,7 @@ typedef struct slap_mod {
struct berval sm_type;
BerVarray sm_values;
#define sm_bvalues sm_values
#ifdef SLAP_NVALUES
BerVarray sm_nvalues;
#endif
} Modification;
typedef struct slap_mod_list {

View file

@ -299,9 +299,7 @@ freeMods( Modifications *ml )
next = ml->sml_next;
slapi_ch_free( (void **)&ml->sml_bvalues );
#ifdef SLAP_NVALUES
slapi_ch_free( (void **)&ml->sml_nvalues );
#endif
slapi_ch_free( (void **)&ml );
}
}
@ -366,9 +364,7 @@ LDAPModToEntry(
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
@ -377,9 +373,7 @@ LDAPModToEntry(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -395,9 +389,7 @@ LDAPModToEntry(
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
@ -406,9 +398,7 @@ LDAPModToEntry(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -921,9 +911,7 @@ slapi_modify_internal(
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *)ch_malloc( sizeof(Modifications) );
@ -932,9 +920,7 @@ slapi_modify_internal(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
} else {
rs.sr_err = values2obj( pMod->mod_values, &bv );
if ( rs.sr_err != LDAP_SUCCESS )
@ -942,9 +928,7 @@ slapi_modify_internal(
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
@ -953,9 +937,7 @@ slapi_modify_internal(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
}
*modtail = mod;
modtail = &mod->sml_next;

View file

@ -567,9 +567,7 @@ slapi_entry_add_values( Slapi_Entry *e, const char *type, struct berval **vals )
return LDAP_CONSTRAINT_VIOLATION;
}
}
#ifdef SLAP_NVALUES
mod.sm_nvalues = NULL;
#endif
rc = modify_add_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) );
@ -643,9 +641,7 @@ slapi_entry_delete_values( Slapi_Entry *e, const char *type, struct berval **val
if ( rc != LDAP_SUCCESS ) {
return LDAP_CONSTRAINT_VIOLATION;
}
#if SLAP_NVALUES
mod.sm_nvalues = NULL;
#endif
rc = modify_delete_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) );
@ -2375,9 +2371,7 @@ Slapi_Attr *slapi_attr_init( Slapi_Attr *a, const char *type )
a->a_desc = ad;
a->a_vals = NULL;
#ifdef SLAP_NVALUES
a->a_nvals = NULL;
#endif
a->a_next = NULL;
a->a_flags = 0;
@ -2407,11 +2401,9 @@ Slapi_Attr *slapi_attr_dup( const Slapi_Attr *attr )
int slapi_attr_add_value( Slapi_Attr *a, const Slapi_Value *v )
{
#ifdef LDAP_SLAPI
#ifdef SLAP_NVALUES
/*
* FIXME: here we may lose alignment between a_vals/a_nvals
*/
#endif
return value_add_one( &a->a_vals, (Slapi_Value *)v );
#else
return -1;
@ -2463,14 +2455,9 @@ int slapi_attr_value_cmp( const Slapi_Attr *a, const struct berval *v1, const st
const char *text;
mr = a->a_desc->ad_type->sat_equality;
#ifdef SLAP_NVALUES
rc = value_match( &ret, a->a_desc, mr,
SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
(struct berval *)v1, (void *)v2, &text );
#else
rc = value_match( &ret, a->a_desc, mr, SLAP_MR_ASSERTION_SYNTAX_MATCH,
(struct berval *)v1, (void *)v2, &text );
#endif
if ( rc != LDAP_SUCCESS )
return -1;
@ -2492,13 +2479,8 @@ int slapi_attr_value_find( const Slapi_Attr *a, struct berval *v )
mr = a->a_desc->ad_type->sat_equality;
for ( bv = a->a_vals, j = 0; bv->bv_val != NULL; bv++, j++ ) {
#ifdef SLAP_NVALUES
rc = value_match( &ret, a->a_desc, mr,
SLAP_MR_VALUE_OF_ASSERTION_SYNTAX, bv, v, &text );
#else
rc = value_match( &ret, a->a_desc, mr,
SLAP_MR_ASSERTION_SYNTAX_MATCH, bv, v, &text );
#endif
if ( rc != LDAP_SUCCESS ) {
return -1;
}
@ -3249,9 +3231,7 @@ Modifications *slapi_x_ldapmods2modifications (LDAPMod **mods)
}
mod->sml_bvalues[i].bv_val = NULL;
}
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;

View file

@ -1655,7 +1655,6 @@ int slap_mods_check_syncrepl(
return LDAP_CONSTRAINT_VIOLATION;
}
#ifdef SLAP_NVALUES
if( nvals && ad->ad_type->sat_equality &&
ad->ad_type->sat_equality->smr_normalize )
{
@ -1686,7 +1685,6 @@ int slap_mods_check_syncrepl(
ml->sml_nvalues[nvals].bv_val = NULL;
ml->sml_nvalues[nvals].bv_len = 0;
}
#endif
}
prevml = ml;
ml = ml->sml_next;
@ -1704,9 +1702,7 @@ int slap_mods_opattrs_syncrepl(
char *textbuf, size_t textlen )
{
struct berval name, timestamp, csn;
#ifdef SLAP_NVALUES
struct berval nname;
#endif
char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
Modifications *mod;
@ -1736,14 +1732,10 @@ int slap_mods_opattrs_syncrepl(
if( op->o_dn.bv_len == 0 ) {
name.bv_val = SLAPD_ANONYMOUS;
name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
#ifdef SLAP_NVALUES
nname = name;
#endif
} else {
name = op->o_dn;
#ifdef SLAP_NVALUES
nname = op->o_ndn;
#endif
}
}
@ -1767,14 +1759,12 @@ int slap_mods_opattrs_syncrepl(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &tmpval );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
assert( mod->sml_nvalues[0].bv_val );
#endif
*modtail = mod;
modtail = &mod->sml_next;
}
@ -1789,14 +1779,12 @@ int slap_mods_opattrs_syncrepl(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &nname );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
assert( mod->sml_nvalues[0].bv_val );
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -1809,9 +1797,7 @@ int slap_mods_opattrs_syncrepl(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
}
@ -1827,9 +1813,7 @@ int slap_mods_opattrs_syncrepl(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -1842,14 +1826,12 @@ int slap_mods_opattrs_syncrepl(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &nname );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
assert( mod->sml_nvalues[0].bv_val );
#endif
*modtail = mod;
modtail = &mod->sml_next;
@ -1862,9 +1844,7 @@ int slap_mods_opattrs_syncrepl(
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
assert( mod->sml_values[0].bv_val );
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
}
@ -1922,7 +1902,6 @@ slap_mods2entry_syncrepl(
AC_MEMCPY( &attr->a_vals[i], mods->sml_values,
sizeof( struct berval ) * j );
#ifdef SLAP_NVALUES
if( attr->a_nvals ) {
attr->a_nvals = ch_realloc( attr->a_nvals,
sizeof( struct berval ) * (i+j) );
@ -1934,7 +1913,6 @@ slap_mods2entry_syncrepl(
ch_free( mods->sml_nvalues );
mods->sml_nvalues = NULL;
}
#endif
continue;
#else
@ -1990,9 +1968,7 @@ slap_mods2entry_syncrepl(
/* should check for duplicates */
attr->a_vals = mods->sml_values;
#ifdef SLAP_NVALUES
attr->a_nvals = mods->sml_nvalues;
#endif
*tail = attr;
tail = &attr->a_next;

View file

@ -151,9 +151,6 @@ syn_add(
ssyn->ssyn_oidlen = strlen(syn->syn_oid);
ssyn->ssyn_flags = def->sd_flags;
ssyn->ssyn_validate = def->sd_validate;
#ifndef SLAP_NVALUES
ssyn->ssyn_normalize = def->sd_normalize;
#endif
ssyn->ssyn_pretty = def->sd_pretty;
#ifdef SLAPD_BINARY_CONVERSION
@ -213,9 +210,7 @@ syn_schema_info( Entry *e )
AttributeDescription *ad_ldapSyntaxes = slap_schema.si_ad_ldapSyntaxes;
Syntax *syn;
struct berval val;
#ifdef SLAP_NVALUES
struct berval nval;
#endif
LDAP_SLIST_FOREACH(syn, &syn_list, ssyn_next ) {
if ( ! syn->ssyn_validate ) {
@ -241,14 +236,10 @@ syn_schema_info( Entry *e )
#endif
#endif
#ifdef SLAP_NVALUES
nval.bv_val = syn->ssyn_oid;
nval.bv_len = strlen(syn->ssyn_oid);
if( attr_merge_one( e, ad_ldapSyntaxes, &val, &nval ) )
#else
if( attr_merge_one( e, ad_ldapSyntaxes, &val ) )
#endif
{
return -1;
}

View file

@ -138,12 +138,8 @@ main( int argc, char **argv )
vals[1].bv_len = 0;
vals[1].bv_val = NULL;
#ifdef SLAP_NVALUES
attr_merge( e, slap_schema.si_ad_structuralObjectClass,
vals, NULL /* FIXME */ );
#else
attr_merge( e, slap_schema.si_ad_structuralObjectClass, vals );
#endif
}
/* check schema */
@ -167,20 +163,16 @@ main( int argc, char **argv )
struct berval name, timestamp, csn;
#ifdef SLAP_NVALUES
struct berval nvals[ 2 ];
struct berval nname;
#endif
char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
vals[1].bv_len = 0;
vals[1].bv_val = NULL;
#ifdef SLAP_NVALUES
nvals[1].bv_len = 0;
nvals[1].bv_val = NULL;
#endif
ltm = gmtime(&now);
lutil_gentime( timebuf, sizeof(timebuf), ltm );
@ -194,15 +186,11 @@ main( int argc, char **argv )
if ( be->be_rootndn.bv_len == 0 ) {
name.bv_val = SLAPD_ANONYMOUS;
name.bv_len = sizeof(SLAPD_ANONYMOUS) - 1;
#ifdef SLAP_NVALUES
nname.bv_val = SLAPD_ANONYMOUS;
nname.bv_len = sizeof(SLAPD_ANONYMOUS) - 1;
#endif
} else {
name = be->be_rootdn;
#ifdef SLAP_NVALUES
nname = be->be_rootndn;
#endif
}
if( attr_find( e->e_attrs, slap_schema.si_ad_entryUUID )
@ -210,68 +198,44 @@ main( int argc, char **argv )
{
vals[0].bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
vals[0].bv_val = uuidbuf;
#ifdef SLAP_NVALUES
attr_merge( e, slap_schema.si_ad_entryUUID, vals, NULL );
#else
attr_merge( e, slap_schema.si_ad_entryUUID, vals );
#endif
}
if( attr_find( e->e_attrs, slap_schema.si_ad_creatorsName )
== NULL )
{
vals[0] = name;
#ifdef SLAP_NVALUES
nvals[0] = nname;
attr_merge( e, slap_schema.si_ad_creatorsName, vals, nvals );
#else
attr_merge( e, slap_schema.si_ad_creatorsName, vals );
#endif
}
if( attr_find( e->e_attrs, slap_schema.si_ad_modifiersName )
== NULL )
{
vals[0] = name;
#ifdef SLAP_NVALUES
nvals[0] = nname;
attr_merge( e, slap_schema.si_ad_modifiersName, vals, nvals );
#else
attr_merge( e, slap_schema.si_ad_modifiersName, vals );
#endif
}
if( attr_find( e->e_attrs, slap_schema.si_ad_createTimestamp )
== NULL )
{
vals[0] = timestamp;
#ifdef SLAP_NVALUES
attr_merge( e, slap_schema.si_ad_createTimestamp, vals, NULL );
#else
attr_merge( e, slap_schema.si_ad_createTimestamp, vals );
#endif
}
if( attr_find( e->e_attrs, slap_schema.si_ad_modifyTimestamp )
== NULL )
{
vals[0] = timestamp;
#ifdef SLAP_NVALUES
attr_merge( e, slap_schema.si_ad_modifyTimestamp, vals, NULL );
#else
attr_merge( e, slap_schema.si_ad_modifyTimestamp, vals );
#endif
}
if( attr_find( e->e_attrs, slap_schema.si_ad_entryCSN )
== NULL )
{
vals[0] = csn;
#ifdef SLAP_NVALUES
attr_merge( e, slap_schema.si_ad_entryCSN, vals, NULL );
#else
attr_merge( e, slap_schema.si_ad_entryCSN, vals );
#endif
}
}

View file

@ -123,7 +123,6 @@ value_add_one(
return LDAP_SUCCESS;
}
#ifdef SLAP_NVALUES
int asserted_value_validate_normalize(
AttributeDescription *ad,
MatchingRule *mr,
@ -171,157 +170,6 @@ int asserted_value_validate_normalize(
return LDAP_SUCCESS;
}
#else
int
value_validate(
MatchingRule *mr,
struct berval *in,
const char **text )
{
int rc;
if( mr == NULL ) {
*text = "inappropriate matching request";
return LDAP_INAPPROPRIATE_MATCHING;
}
if( mr->smr_syntax == NULL ) {
*text = "no assertion syntax";
return LDAP_INVALID_SYNTAX;
}
if( ! mr->smr_syntax->ssyn_validate ) {
*text = "no syntax validator";
return LDAP_INVALID_SYNTAX;
}
rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in );
if( rc != LDAP_SUCCESS ) {
*text = "value is invalid";
return LDAP_INVALID_SYNTAX;
}
return LDAP_SUCCESS;
}
int
value_normalize(
AttributeDescription *ad,
unsigned usage,
struct berval *in,
struct berval *out,
const char **text )
{
int rc;
MatchingRule *mr = ad_mr( ad, usage );
if( mr == NULL ) {
*text = "inappropriate matching request";
return LDAP_INAPPROPRIATE_MATCHING;
}
/* we only support equality matching of binary attributes */
/* This is suspect, flexible certificate matching will hit this */
if( slap_ad_is_binary( ad ) && usage != SLAP_MR_EQUALITY ) {
*text = "inappropriate binary matching";
return LDAP_INAPPROPRIATE_MATCHING;
}
if( mr->smr_normalize ) {
rc = (mr->smr_normalize)( usage,
ad->ad_type->sat_syntax,
mr, in, out );
if( rc != LDAP_SUCCESS ) {
*text = "unable to normalize value";
return LDAP_INVALID_SYNTAX;
}
} else if ( mr->smr_syntax->ssyn_normalize ) {
rc = (mr->smr_syntax->ssyn_normalize)(
ad->ad_type->sat_syntax,
in, out );
if( rc != LDAP_SUCCESS ) {
*text = "unable to normalize value";
return LDAP_INVALID_SYNTAX;
}
} else {
ber_dupbv( out, in );
}
return LDAP_SUCCESS;
}
int
value_validate_normalize(
AttributeDescription *ad,
unsigned usage,
struct berval *in,
struct berval *out,
const char **text )
{
int rc;
MatchingRule *mr = ad_mr( ad, usage );
if( mr == NULL ) {
*text = "inappropriate matching request";
return LDAP_INAPPROPRIATE_MATCHING;
}
if( mr->smr_syntax == NULL ) {
*text = "no assertion syntax";
return LDAP_INVALID_SYNTAX;
}
if( ! mr->smr_syntax->ssyn_validate ) {
*text = "no syntax validator";
return LDAP_INVALID_SYNTAX;
}
rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in );
if( rc != LDAP_SUCCESS ) {
*text = "value is invalid";
return LDAP_INVALID_SYNTAX;
}
/* we only support equality matching of binary attributes */
/* This is suspect, flexible certificate matching will hit this */
if( slap_ad_is_binary( ad ) && usage != SLAP_MR_EQUALITY ) {
*text = "inappropriate binary matching";
return LDAP_INAPPROPRIATE_MATCHING;
}
if( mr->smr_normalize ) {
rc = (mr->smr_normalize)( usage,
ad->ad_type->sat_syntax,
mr, in, out );
if( rc != LDAP_SUCCESS ) {
*text = "unable to normalize value";
return LDAP_INVALID_SYNTAX;
}
} else if ( mr->smr_syntax->ssyn_normalize ) {
rc = (mr->smr_syntax->ssyn_normalize)(
ad->ad_type->sat_syntax,
in, out );
if( rc != LDAP_SUCCESS ) {
*text = "unable to normalize value";
return LDAP_INVALID_SYNTAX;
}
} else {
ber_dupbv( out, in );
}
return LDAP_SUCCESS;
}
#endif
int
value_match(
@ -343,28 +191,6 @@ value_match(
return LDAP_INAPPROPRIATE_MATCHING;
}
#ifndef SLAP_NVALUES
if( ad->ad_type->sat_syntax->ssyn_normalize ) {
rc = ad->ad_type->sat_syntax->ssyn_normalize(
ad->ad_type->sat_syntax, v1, &nv1 );
if( rc != LDAP_SUCCESS ) {
return LDAP_INAPPROPRIATE_MATCHING;
}
}
if ( SLAP_IS_MR_ATTRIBUTE_SYNTAX_NONCONVERTED_MATCH( flags ) &&
mr->smr_convert )
{
rc = (mr->smr_convert)( v2, &nv2 );
if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
}
/* let smr_match know we've converted the value */
flags |= SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH;
}
#endif
rc = (mr->smr_match)( match, flags,
ad->ad_type->sat_syntax,
@ -392,7 +218,6 @@ int value_find_ex(
return LDAP_INAPPROPRIATE_MATCHING;
}
#ifdef SLAP_NVALUES
assert(SLAP_IS_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH( flags ));
if( !SLAP_IS_MR_ASSERTED_VALUE_NORMALIZED_MATCH( flags ) &&
@ -407,38 +232,6 @@ int value_find_ex(
return LDAP_INVALID_SYNTAX;
}
}
#else
/* Take care of this here or ssyn_normalize later will hurt */
if ( SLAP_IS_MR_ATTRIBUTE_SYNTAX_NONCONVERTED_MATCH( flags )
&& mr->smr_convert )
{
rc = (mr->smr_convert)( val, &nval );
if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
}
/* let value_match know we've done the version */
flags |= SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH;
}
if( !(flags & SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH) &&
mr->smr_syntax->ssyn_normalize )
{
struct berval nval_tmp = { 0, NULL };
rc = mr->smr_syntax->ssyn_normalize(
mr->smr_syntax,
nval.bv_val == NULL ? val : &nval, &nval_tmp );
free(nval.bv_val);
nval = nval_tmp;
if( rc != LDAP_SUCCESS ) {
free(nval.bv_val);
return LDAP_INAPPROPRIATE_MATCHING;
}
}
#endif
for ( i = 0; vals[i].bv_val != NULL; i++ ) {
int match;