]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/filterentry.c
Another concurrency typo.
[openldap] / servers / slapd / filterentry.c
index 495fcb2ca624b324b545c592dcc215e0da2d4a20..a6528b2877bc4a11841dc6aa5c258c9ee51d6aa9 100644 (file)
@@ -3,22 +3,18 @@
 #include "portable.h"
 
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <regex.h>
-#include "slap.h"
 
-extern Attribute       *attr_find();
-extern char            *first_word();
-extern char            *next_word();
-extern char            *phonetic();
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/regex.h>
+
+#include "slap.h"
 
-static int     test_filter_list();
-static int     test_substring_filter();
-static int     test_ava_filter();
-static int     test_approx_filter();
-static int     test_presence_filter();
+static int     test_filter_list(Backend *be, Connection *conn, Operation *op, Entry *e, Filter *flist, int ftype);
+static int     test_substring_filter(Backend *be, Connection *conn, Operation *op, Entry *e, Filter *f);
+static int     test_ava_filter(Backend *be, Connection *conn, Operation *op, Entry *e, Ava *ava, int type);
+static int     test_approx_filter(Backend *be, Connection *conn, Operation *op, Entry *e, Ava *ava);
+static int     test_presence_filter(Backend *be, Connection *conn, Operation *op, Entry *e, char *type);
 
 /*
  * test_filter - test a filter against a single entry.
@@ -92,7 +88,7 @@ test_filter(
                break;
 
        default:
-               Debug( LDAP_DEBUG_ANY, "    unknown filter type %d\n",
+               Debug( LDAP_DEBUG_ANY, "    unknown filter type %lu\n",
                    f->f_choice, 0, 0 );
                rc = -1;
        }
@@ -114,8 +110,9 @@ test_ava_filter(
        int             i, rc;
        Attribute       *a;
 
-       if ( be != NULL && ! access_allowed( be, conn, op, e, ava->ava_type,
-           &ava->ava_value, op->o_dn, ACL_SEARCH ) ) {
+       if ( be != NULL && ! access_allowed( be, conn, op, e,
+               ava->ava_type, &ava->ava_value, ACL_SEARCH ) )
+       {
                return( -2 );
        }
 
@@ -138,13 +135,13 @@ test_ava_filter(
                        break;
 
                case LDAP_FILTER_GE:
-                       if ( rc > 0 ) {
+                       if ( rc >= 0 ) {
                                return( 0 );
                        }
                        break;
 
                case LDAP_FILTER_LE:
-                       if ( rc < 0 ) {
+                       if ( rc <= 0 ) {
                                return( 0 );
                        }
                        break;
@@ -163,8 +160,9 @@ test_presence_filter(
     char       *type
 )
 {
-       if ( be != NULL && ! access_allowed( be, conn, op, e, type, NULL,
-           op->o_dn, ACL_SEARCH ) ) {
+       if ( be != NULL && ! access_allowed( be, conn, op, e,
+               type, NULL, ACL_SEARCH ) )
+       {
                return( -2 );
        }
 
@@ -184,8 +182,9 @@ test_approx_filter(
        int             i, rc, match;
        Attribute       *a;
 
-       if ( be != NULL && ! access_allowed( be, conn, op, e, ava->ava_type,
-           NULL, op->o_dn, ACL_SEARCH ) ) {
+       if ( be != NULL && ! access_allowed( be, conn, op, e,
+               ava->ava_type, NULL, ACL_SEARCH ) )
+       {
                return( -2 );
        }
 
@@ -320,8 +319,9 @@ test_substring_filter(
 
        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, op->o_dn, ACL_SEARCH ) ) {
+       if ( be != NULL && ! access_allowed( be, conn, op, e,
+               f->f_sub_type, NULL, ACL_SEARCH ) )
+       {
                return( -2 );
        }