]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/filterentry.c
ITS#2368 - fix deleting key from range IDL
[openldap] / servers / slapd / filterentry.c
index 3cf1d88f2251d941b6769b23d5eb7a86a2634b4a..b523c756fde833a90c565fc2b09167a245fc734b 100644 (file)
@@ -1,7 +1,7 @@
 /* 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
  */
 
@@ -232,13 +232,18 @@ static int test_mra_filter(
                        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 ) {
@@ -266,9 +271,15 @@ 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;
                        }
@@ -280,12 +291,17 @@ static int test_mra_filter(
                        }
 
                        /* 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 ) {
@@ -341,8 +357,15 @@ 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;
                                        }
@@ -355,8 +378,7 @@ static int test_mra_filter(
                                }
 
                                /* 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 ) {
@@ -424,13 +446,18 @@ test_ava_filter(
                        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 ) {
@@ -656,13 +683,18 @@ test_substrings_filter(
                        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 ) {