/* filterentry.c - apply a filter to an entry */
/* $OpenLDAP$ */
/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
a = attrs_find( a->a_next, mra->ma_desc ) )
{
struct berval *bv;
- for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
+#ifdef SLAP_NVALUES
+ for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
+ bv->bv_val != NULL; bv++ )
+#else
+ for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
+#endif
+ {
int ret;
int rc;
const char *text;
- rc = value_match( &ret, a->a_desc, mra->ma_rule,
- SLAP_MR_ASSERTION_SYNTAX_MATCH,
+ rc = value_match( &ret, a->a_desc, mra->ma_rule, 0,
bv, &mra->ma_value, &text );
if( rc != LDAP_SUCCESS ) {
}
/* 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;
}
}
/* check match */
- for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
+#ifdef SLAP_NVALUES
+ for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
+ bv->bv_val != NULL; bv++ )
+#else
+ for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
+#endif
+ {
int ret;
int rc;
- rc = value_match( &ret, a->a_desc, mra->ma_rule,
- SLAP_MR_ASSERTION_SYNTAX_MATCH,
+ rc = value_match( &ret, a->a_desc, mra->ma_rule, 0,
bv, &value, &text );
if( rc != LDAP_SUCCESS ) {
}
/* 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;
}
}
/* check match */
- rc = value_match( &ret, ad, mra->ma_rule,
- SLAP_MR_ASSERTION_SYNTAX_MATCH,
+ rc = value_match( &ret, ad, mra->ma_rule, 0,
bv, &value, &text );
if( rc != LDAP_SUCCESS ) {
continue;
}
- for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
+#ifdef SLAP_NVALUES
+ for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
+ bv->bv_val != NULL; bv++ )
+#else
+ for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
+#endif
+ {
int ret;
int rc;
const char *text;
- rc = value_match( &ret, a->a_desc, mr,
- SLAP_MR_ASSERTION_SYNTAX_MATCH,
+ rc = value_match( &ret, a->a_desc, mr, 0,
bv, &ava->aa_value, &text );
if( rc != LDAP_SUCCESS ) {
}
}
-#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( ava->aa_desc == slap_schema.si_ad_hasSubordinates
&& be && be->be_has_subordinates ) {
int hasSubordinates;
return LDAP_COMPARE_FALSE;
}
-#endif /* SLAP_X_FILTER_HASSUBORDINATES */
return( LDAP_COMPARE_FALSE );
}
a = attrs_find( e->e_attrs, desc );
-#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( a == NULL && desc == slap_schema.si_ad_hasSubordinates ) {
/*
return LDAP_COMPARE_FALSE;
}
-#endif /* SLAP_X_FILTER_HASSUBORDINATES */
return a != NULL ? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE;
}
continue;
}
- for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
+#ifdef SLAP_NVALUES
+ for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
+ bv->bv_val != NULL; bv++ )
+#else
+ for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
+#endif
+ {
int ret;
int rc;
const char *text;
- rc = value_match( &ret, a->a_desc, mr,
- SLAP_MR_ASSERTION_SYNTAX_MATCH,
+ rc = value_match( &ret, a->a_desc, mr, 0,
bv, f->f_sub, &text );
if( rc != LDAP_SUCCESS ) {