]> git.sur5r.net Git - openldap/commitdiff
SLAPD_SCHEMA_NOT_COMPAT: equality filters
authorKurt Zeilenga <kurt@openldap.org>
Wed, 24 May 2000 18:49:30 +0000 (18:49 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 24 May 2000 18:49:30 +0000 (18:49 +0000)
(2.5.4.0=2.5.6.0) works! ie: (objectclass=top)

servers/slapd/attr.c
servers/slapd/filterentry.c
servers/slapd/proto-slap.h
servers/slapd/schema_init.c
servers/slapd/slap.h
servers/slapd/value.c

index dd1d3b612e0669562d08143f95fd51d5b5c0a65e..481d1c7adf3353308867ea5f6e25bfe261141363 100644 (file)
@@ -223,7 +223,7 @@ attrs_find(
 )
 {
        for ( ; a != NULL; a = a->a_next ) {
-               if ( is_ad_subtype( a->a_desc, desc ) == 0 ) {
+               if ( is_ad_subtype( a->a_desc, desc ) ) {
                        return( a );
                }
        }
index b60ed6687390a8cb102e417d7649a955c67ce4cc..fe4e1c1b54a5395d00ae1c91b758b595135fb425 100644 (file)
@@ -253,34 +253,39 @@ test_ava_filter(
 #endif
 
                for ( i = 0; a->a_vals[i] != NULL; i++ ) {
-                       int rc;
+                       int ret;
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
+                       int rc;
                        const char *text;
 
-                       rc = value_match( a->a_desc, mr,
+                       rc = value_match( &ret, a->a_desc, mr,
                                a->a_vals[i], ava->aa_value,
                                &text );
+
+                       if( rc != LDAP_SUCCESS ) {
+                               return rc;
+                       }
 #else
-                       rc = value_cmp( a->a_vals[i], &ava->ava_value, a->a_syntax,
+                       ret = value_cmp( a->a_vals[i], &ava->ava_value, a->a_syntax,
                                3 );
 #endif
 
                        switch ( type ) {
                        case LDAP_FILTER_EQUALITY:
                        case LDAP_FILTER_APPROX:
-                               if ( rc == 0 ) {
+                               if ( ret == 0 ) {
                                        return LDAP_COMPARE_TRUE;
                                }
                                break;
 
                        case LDAP_FILTER_GE:
-                               if ( rc >= 0 ) {
+                               if ( ret >= 0 ) {
                                        return LDAP_COMPARE_TRUE;
                                }
                                break;
 
                        case LDAP_FILTER_LE:
-                               if ( rc <= 0 ) {
+                               if ( ret <= 0 ) {
                                        return LDAP_COMPARE_TRUE;
                                }
                                break;
index 9b9241745c0928af36b4905333ed339cdbb94799..31a4d13573fe697e5052ceb4ce2906d65c1b9bc2 100644 (file)
@@ -686,6 +686,7 @@ LIBSLAPD_F (int) value_normalize LDAP_P((
        struct berval **out,
        const char ** text ));
 LIBSLAPD_F (int) value_match LDAP_P((
+       int *match,
        AttributeDescription *ad,
        MatchingRule *mr,
        struct berval *v1,
index 02beabc58c58af28e08edda62705077ba42ce016..ad9bf48a5e7e35a5566caf4868fcd38d5e87caf8 100644 (file)
@@ -307,30 +307,35 @@ IA5StringNormalize(
 
 static int
 caseExactIA5Match(
+       int *match,
        unsigned use,
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *value,
        void *assertedValue )
 {
-       return strcmp( value->bv_val,
+       *match = strcmp( value->bv_val,
                ((struct berval *) assertedValue)->bv_val );
+       return LDAP_SUCCESS;
 }
 
 static int
 caseIgnoreIA5Match(
+       int *match,
        unsigned use,
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *value,
        void *assertedValue )
 {
-       return strcasecmp( value->bv_val,
+       *match = strcasecmp( value->bv_val,
                ((struct berval *) assertedValue)->bv_val );
+       return LDAP_SUCCESS;
 }
 
 static int
 objectClassMatch(
+       int *match,
        unsigned use,
        Syntax *syntax,
        MatchingRule *mr,
@@ -340,7 +345,8 @@ objectClassMatch(
        ObjectClass *oc = oc_find( value->bv_val );
        ObjectClass *asserted = oc_find( ((struct berval *) assertedValue)->bv_val );
 
-       return oc == NULL || oc != asserted;
+       *match = ( oc == NULL || oc != asserted );
+       return LDAP_SUCCESS;
 }
 
 struct syntax_defs_rec {
index 92978f98617540aa816d3b5e9426c9217d3293a2..fc9644b8d6708f0379a1cb77022e1a47c3b09187 100644 (file)
@@ -191,6 +191,7 @@ typedef int slap_mr_normalize_func LDAP_P((
 
 /* Match (compare) function */
 typedef int slap_mr_match_func LDAP_P((
+       int *match,
        unsigned use,
        struct slap_syntax *syntax,     /* syntax of stored value */
        struct slap_matching_rule *mr,
index ec7bc11f8412cf4a601aa21a38455a676f8075de..753c7240051d37092c4998876421998cfffdead4 100644 (file)
@@ -177,15 +177,27 @@ value_normalize(
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
 int
 value_match(
+       int *match,
        AttributeDescription *ad,
        MatchingRule *mr,
        struct berval *v1, /* (unnormalized) stored value */
        struct berval *v2, /* (normalized) asserted value */
        const char ** text )
 {
-       /* not yet implemented */
-       return 0;
+       int rc;
+       int usage = 0;
+
+       if( !mr->smr_match ) {
+               return LDAP_INAPPROPRIATE_MATCHING;
+       }
+
+       rc = (mr->smr_match)( match, usage,
+               ad->ad_type->sat_syntax,
+               mr, v1, v2 );
+       
+       return rc;
 }
+
 #else
 int
 value_cmp(
@@ -256,7 +268,11 @@ value_find(
 
        for ( i = 0; vals[i] != NULL; i++ ) {
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
-               if ( value_match( ad, mr, vals[i], val, text ) == 0 )
+               int rc;
+               int match;
+               rc = value_match( &match, ad, mr, vals[i], val, text );
+
+               if( rc == LDAP_SUCCESS && match == 0 )
 #else
                if ( value_cmp( vals[i], v, syntax, normalize ) == 0 )
 #endif