]> git.sur5r.net Git - openldap/commitdiff
SLAPD_SCHEMA_NOT_COMPAT: framework for substring searching
authorKurt Zeilenga <kurt@openldap.org>
Sat, 27 May 2000 21:41:04 +0000 (21:41 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 27 May 2000 21:41:04 +0000 (21:41 +0000)
servers/slapd/filterentry.c
servers/slapd/proto-slap.h
servers/slapd/value.c

index fe4e1c1b54a5395d00ae1c91b758b595135fb425..a751cca054d73efb491db6b87fddab6a82a3cc6c 100644 (file)
@@ -501,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 );
@@ -616,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;
index bf73fc435ba3b6759dd86a3e8bb305ca41aafe34..f6f6c76fa6ab6fe5fa3135193fbe4ab6c111b57e 100644 (file)
@@ -703,7 +703,7 @@ LIBSLAPD_F (int) value_match LDAP_P((
        AttributeDescription *ad,
        MatchingRule *mr,
        struct berval *v1,
-       struct berval *v2,
+       void *v2,
        const char ** text ));
 LIBSLAPD_F (int) value_find LDAP_P((
        AttributeDescription *ad,
index b90141434099c27a6787e3a5fbfc36ea102a2aa7..05af2ff085603ac08d4a3c26200e0cdcdde66611 100644 (file)
@@ -190,8 +190,8 @@ value_match(
        int *match,
        AttributeDescription *ad,
        MatchingRule *mr,
-       struct berval *v1, /* (unnormalized) stored value */
-       struct berval *v2, /* (normalized) asserted value */
+       struct berval *v1, /* stored value */
+       void *v2, /* assertion */
        const char ** text )
 {
        int rc;