]> git.sur5r.net Git - openldap/commitdiff
Update handling of AND/OR indexing where element is undefined.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 4 Mar 2002 22:32:33 +0000 (22:32 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 4 Mar 2002 22:32:33 +0000 (22:32 +0000)
servers/slapd/back-bdb/filterindex.c
servers/slapd/back-bdb/search.c

index 2e420fd442195fcf4205eb15785742de64bbb4ce..c2993677c9db6df9c9f478a634f54cfbc830dbc3 100644 (file)
@@ -158,8 +158,11 @@ list_candidates(
                rc = bdb_filter_candidates( be, f, save, tmp );
 
                if ( rc != 0 ) {
-                       /* Error: treat as undefined */
-                       continue;
+                       if ( ftype == LDAP_FILTER_AND ) {
+                               rc = 0;
+                               continue;
+                       }
+                       break;
                }
                
                if ( ftype == LDAP_FILTER_AND ) {
@@ -171,16 +174,25 @@ list_candidates(
                        BDB_IDL_ALL( bdb, save );
                }
        }
+
 #if !defined(LDAP_PVT_THREAD_STACK_SIZE) || (LDAP_PVT_THREAD_STACK_SIZE == 0)
        free(save);
 #endif
 
-       Debug( LDAP_DEBUG_FILTER,
-               "<= bdb_list_candidates: id=%ld first=%ld last=%ld\n",
-               (long) ids[0],
-               (long) BDB_IDL_FIRST(ids),
-               (long) BDB_IDL_LAST(ids) );
-       return 0;
+       if( rc ) {
+               Debug( LDAP_DEBUG_FILTER,
+                       "<= bdb_list_candidates: id=%ld first=%ld last=%ld\n",
+                       (long) ids[0],
+                       (long) BDB_IDL_FIRST(ids),
+                       (long) BDB_IDL_LAST(ids) );
+
+       } else {
+               Debug( LDAP_DEBUG_FILTER,
+                       "<= bdb_list_candidates: undefined rc=%d\n",
+                       rc, 0, 0 );
+       }
+
+       return rc;
 }
 
 static int
index 34197d090b9f921cd8b33dfae5cb49bbc909fe27..0c1d283c56c6eb8c4f67f03ec04e15756cb4622f 100644 (file)
@@ -247,7 +247,9 @@ bdb_search(
        ber_dupbv( &realbase, &e->e_nname );
 
        /* start cursor at base entry's id 
-        * FIXME: hack to make "" base work */
+        * FIXME: hack to make "" base work
+        * FIXME: moddn needs to assign new ID for this to work
+        */
        cursor = e->e_id == NOID ? 1 : e->e_id;
 
        if ( e != &slap_entry_root ) {
@@ -627,11 +629,18 @@ static int search_candidates(
 
        rc = bdb_filter_candidates( be, &f, ids, tmp );
 
-       Debug(LDAP_DEBUG_TRACE,
-               "bdb_search_candidates: id=%ld first=%ld last=%ld\n",
-               (long) ids[0],
-               (long) BDB_IDL_FIRST(ids),
-               (long) BDB_IDL_LAST(ids) );
+       if( rc ) {
+               Debug(LDAP_DEBUG_TRACE,
+                       "bdb_search_candidates: failed (rc=%d)\n",
+                       rc, NULL, NULL );
+
+       } else {
+               Debug(LDAP_DEBUG_TRACE,
+                       "bdb_search_candidates: id=%ld first=%ld last=%ld\n",
+                       (long) ids[0],
+                       (long) BDB_IDL_FIRST(ids),
+                       (long) BDB_IDL_LAST(ids) );
+       }
 
        return rc;
 }