]> git.sur5r.net Git - openldap/commitdiff
Misc extensible match clean up.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 11 Mar 2002 01:48:37 +0000 (01:48 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 11 Mar 2002 01:48:37 +0000 (01:48 +0000)
servers/slapd/filter.c
servers/slapd/filterentry.c
servers/slapd/schema_init.c

index 701a6140930cb048da929ef6a57adeb1eade1f60..1242a6091f6fbe13094e2d85c048ac267164a1e9 100644 (file)
@@ -736,6 +736,24 @@ filter2bv( Filter *f, struct berval *fstr )
 
                break;
 
+       case LDAP_FILTER_EXT:
+               filter_escape_value( &f->f_mr_value, &tmp );
+
+               fstr->bv_len = f->f_mr_desc->ad_cname.bv_len +
+                       ( f->f_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
+                       ( f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_len+1 : 0 ) +
+                       tmp.bv_len + ( sizeof("(:=)") - 1 );
+               fstr->bv_val = malloc( fstr->bv_len + 1 );
+
+               snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
+                       f->f_mr_desc->ad_cname.bv_val,
+                       f->f_mr_dnattrs ? ":dn" : "",
+                       f->f_mr_rule_text.bv_len ? ":" : "",
+                       f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_val : "",
+                       tmp.bv_val );
+               ber_memfree( tmp.bv_val );
+               break;
+
        case SLAPD_FILTER_COMPUTED:
                ber_str2bv(
                        f->f_result == LDAP_COMPARE_FALSE ? "(?=false)" :
index d808ea71542aedba7d509adc4e429b6cf6ee0a9d..34bc6f1b773ec4cabced71ab806a8a8e7ed9d6be 100644 (file)
@@ -227,23 +227,30 @@ static int test_mra_filter(
 {
        Attribute       *a;
 
+       if( mra->ma_desc == NULL || mra->ma_dnattrs ) {
+               return LDAP_INAPPROPRIATE_MATCHING;
+       }
+
        if( !access_allowed( be, conn, op, e,
                mra->ma_desc, &mra->ma_value, ACL_SEARCH, NULL ) )
        {
                return LDAP_INSUFFICIENT_ACCESS;
        }
 
+       if( mra->ma_rule == NULL ) {
+               mra->ma_rule = mra->ma_desc->ad_type->sat_equality;
+       }
+
+       if( mra->ma_rule == NULL ) {
+               return LDAP_INAPPROPRIATE_MATCHING;
+       }
+
        if( strcmp(mra->ma_rule->smr_syntax->ssyn_oid,
                mra->ma_desc->ad_type->sat_syntax->ssyn_oid) != 0)
        {
                return LDAP_INVALID_SYNTAX;
        }
 
-       if( mra->ma_rule == NULL )
-       {
-               return LDAP_INAPPROPRIATE_MATCHING;
-       }
-
        for(a = attrs_find( e->e_attrs, mra->ma_desc );
                a != NULL;
                a = attrs_find( a->a_next, mra->ma_desc ) )
@@ -263,7 +270,7 @@ static int test_mra_filter(
                                return rc;
                        }
 
-                       if ( ret ) {
+                       if ( ret == 0 ) {
                                return LDAP_COMPARE_TRUE;
                        }
                }
index ca94bbb14e4b1c6dbe79f1a273575a6785fd38f8..3b185581425f261270e622367ac24076ec44e28a 100644 (file)
@@ -999,7 +999,9 @@ caseExactMatch(
        struct berval *value,
        void *assertedValue )
 {
-       *matchp = UTF8bvnormcmp( value, (struct berval *) assertedValue, LDAP_UTF8_NOCASEFOLD );
+       *matchp = UTF8bvnormcmp( value,
+               (struct berval *) assertedValue,
+               LDAP_UTF8_NOCASEFOLD );
        return LDAP_SUCCESS;
 }
 
@@ -1645,7 +1647,9 @@ caseIgnoreMatch(
        struct berval *value,
        void *assertedValue )
 {
-       *matchp = UTF8bvnormcmp( value, (struct berval *) assertedValue, LDAP_UTF8_CASEFOLD );
+       *matchp = UTF8bvnormcmp( value,
+               (struct berval *) assertedValue,
+               LDAP_UTF8_CASEFOLD );
        return LDAP_SUCCESS;
 }