From: Howard Chu Date: Thu, 3 Jan 2002 05:53:27 +0000 (+0000) Subject: Fix from Jonghyuk Choi jongchoi@us.ibm.com; return 0 IDs when bdb_key_read X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~322 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9ad0c5a2e584396d00b9111da1d83f43fc954805;p=openldap Fix from Jonghyuk Choi jongchoi@us.ibm.com; return 0 IDs when bdb_key_read returns DB_NOTFOUND. --- diff --git a/servers/slapd/back-bdb/filterindex.c b/servers/slapd/back-bdb/filterindex.c index da857b9e0a..b1d0059aee 100644 --- a/servers/slapd/back-bdb/filterindex.c +++ b/servers/slapd/back-bdb/filterindex.c @@ -232,8 +232,8 @@ presence_candidates( rc = bdb_key_read( be, db, NULL, &prefix, ids ); if( rc == DB_NOTFOUND ) { + BDB_IDL_ZERO( ids ); rc = 0; - } else if( rc != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "<= bdb_presense_candidates: key read failed (%d)\n", @@ -319,7 +319,10 @@ equality_candidates( for ( i= 0; keys[i].bv_val != NULL; i++ ) { rc = bdb_key_read( be, db, NULL, &keys[i], tmp ); - if( rc != LDAP_SUCCESS ) { + if( rc == DB_NOTFOUND ) { + BDB_IDL_ZERO( ids ); + rc = 0; + } else if( rc != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "<= bdb_equality_candidates key read failed (%d)\n", rc, 0, 0 ); @@ -424,7 +427,11 @@ approx_candidates( for ( i= 0; keys[i].bv_val != NULL; i++ ) { rc = bdb_key_read( be, db, NULL, &keys[i], tmp ); - if( rc != LDAP_SUCCESS ) { + if( rc == DB_NOTFOUND ) { + BDB_IDL_ZERO( ids ); + rc = 0; + break; + } else if( rc != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates key read failed (%d)\n", rc, 0, 0 ); break; @@ -523,7 +530,11 @@ substring_candidates( for ( i= 0; keys[i].bv_val != NULL; i++ ) { rc = bdb_key_read( be, db, NULL, &keys[i], tmp ); - if( rc != LDAP_SUCCESS ) { + if( rc == DB_NOTFOUND ) { + BDB_IDL_ZERO( ids ); + rc = 0; + break; + } else if( rc != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates key read failed (%d)\n", rc, 0, 0 ); break;