From 93a45a02aaaf0d2b09535476d3be1a7701b457a0 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 4 Mar 2002 22:32:33 +0000 Subject: [PATCH] Update handling of AND/OR indexing where element is undefined. --- servers/slapd/back-bdb/filterindex.c | 28 ++++++++++++++++++++-------- servers/slapd/back-bdb/search.c | 21 +++++++++++++++------ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/servers/slapd/back-bdb/filterindex.c b/servers/slapd/back-bdb/filterindex.c index 2e420fd442..c2993677c9 100644 --- a/servers/slapd/back-bdb/filterindex.c +++ b/servers/slapd/back-bdb/filterindex.c @@ -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 diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 34197d090b..0c1d283c56 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -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; } -- 2.39.5