]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/filterentry.c
Install *.schema only
[openldap] / servers / slapd / filterentry.c
index b60ed6687390a8cb102e417d7649a955c67ce4cc..a751cca054d73efb491db6b87fddab6a82a3cc6c 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;
@@ -496,27 +501,59 @@ test_substring_filter(
     Filter     *f
 )
 {
-#ifndef SLAPD_SCHEMA_NOT_COMPAT
        Attribute       *a;
+#ifndef SLAPD_SCHEMA_NOT_COMPAT
        int             i, rc;
        char            *p, *end, *realval, *tmp;
        char            pat[BUFSIZ];
        char            buf[BUFSIZ];
        struct berval   *val;
        regex_t         re;
+#endif
 
        Debug( LDAP_DEBUG_FILTER, "begin test_substring_filter\n", 0, 0, 0 );
 
        if ( be != NULL && ! access_allowed( be, conn, op, e,
-               f->f_sub_type, NULL, ACL_SEARCH ) )
+               f->f_sub_desc, NULL, ACL_SEARCH ) )
        {
                return LDAP_INSUFFICIENT_ACCESS;
        }
 
-       if ( (a = attr_find( e->e_attrs, f->f_sub_type )) == NULL ) {
-               return LDAP_COMPARE_FALSE;
-       }
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+       for(a = attrs_find( e->e_attrs, f->f_sub_desc );
+               a != NULL;
+               a = attrs_find( a->a_next, f->f_sub_desc ) )
+#else
+       a = attr_find( e->e_attrs, f->f_sub_type );
+       if ( a != NULL )
+#endif
+       {
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+               int i;
+               MatchingRule *mr = a->a_desc->ad_type->sat_substr;
+
+               if( mr == NULL ) {
+                       continue;
+               }
+
+               for ( i = 0; a->a_vals[i] != NULL; i++ ) {
+                       int ret;
+                       int rc;
+                       const char *text;
+
+                       rc = value_match( &ret, a->a_desc, mr,
+                               a->a_vals[i], f->f_sub,
+                               &text );
+
+                       if( rc != LDAP_SUCCESS ) {
+                               return rc;
+                       }
 
+                       if ( ret == 0 ) {
+                               return LDAP_COMPARE_TRUE;
+                       }
+               }
+#else
        if ( a->a_syntax & SYNTAX_BIN ) {
                Debug( LDAP_DEBUG_FILTER, "test_substring_filter bin attr\n",
                    0, 0, 0 );
@@ -611,6 +648,7 @@ test_substring_filter(
 
        regfree(&re);
 #endif
+       }
 
        Debug( LDAP_DEBUG_FILTER, "end test_substring_filter 1\n", 0, 0, 0 );
        return LDAP_COMPARE_FALSE;