Move db == NULL check to correct spot
This commit is contained in:
Quanah Gibson-Mount 2007-07-09 21:28:14 +00:00
parent 6165439a98
commit 88a4ffe5be

View File

@ -341,10 +341,11 @@ comp_equality_candidates (
rc = bdb_index_param( op->o_bd, mra->ma_desc, LDAP_FILTER_EQUALITY,
&db, &mask, &prefix );
if( rc != LDAP_SUCCESS ) {
if ( db == NULL ) {
return 0;
}
if ( db == NULL ) {
if( rc != LDAP_SUCCESS ) {
return 0;
}
@ -650,14 +651,6 @@ presence_candidates(
rc = bdb_index_param( op->o_bd, desc, LDAP_FILTER_PRESENT,
&db, &mask, &prefix );
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
"<= bdb_presence_candidates: (%s) index_param "
"returned=%d\n",
desc->ad_cname.bv_val, rc, 0 );
return 0;
}
if( db == NULL ) {
/* not indexed */
Debug( LDAP_DEBUG_TRACE,
@ -666,6 +659,14 @@ presence_candidates(
return 0;
}
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
"<= bdb_presence_candidates: (%s) index_param "
"returned=%d\n",
desc->ad_cname.bv_val, rc, 0 );
return 0;
}
if( prefix.bv_val == NULL ) {
Debug( LDAP_DEBUG_TRACE,
"<= bdb_presence_candidates: (%s) no prefix\n",
@ -721,6 +722,13 @@ equality_candidates(
rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_EQUALITY,
&db, &mask, &prefix );
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_equality_candidates: (%s) not indexed\n",
ava->aa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_equality_candidates: (%s) "
@ -729,13 +737,6 @@ equality_candidates(
return 0;
}
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_equality_candidates: (%s) not indexed\n",
ava->aa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
mr = ava->aa_desc->ad_type->sat_equality;
if( !mr ) {
return 0;
@ -838,6 +839,13 @@ approx_candidates(
rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_APPROX,
&db, &mask, &prefix );
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_approx_candidates: (%s) not indexed\n",
ava->aa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_approx_candidates: (%s) "
@ -846,13 +854,6 @@ approx_candidates(
return 0;
}
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_approx_candidates: (%s) not indexed\n",
ava->aa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
mr = ava->aa_desc->ad_type->sat_approx;
if( !mr ) {
/* no approx matching rule, try equality matching rule */
@ -958,6 +959,13 @@ substring_candidates(
rc = bdb_index_param( op->o_bd, sub->sa_desc, LDAP_FILTER_SUBSTRINGS,
&db, &mask, &prefix );
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_substring_candidates: (%s) not indexed\n",
sub->sa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_substring_candidates: (%s) "
@ -966,13 +974,6 @@ substring_candidates(
return 0;
}
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_substring_candidates: (%s) not indexed\n",
sub->sa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
mr = sub->sa_desc->ad_type->sat_substr;
if( !mr ) {
@ -1075,6 +1076,13 @@ inequality_candidates(
rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_EQUALITY,
&db, &mask, &prefix );
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_inequality_candidates: (%s) not indexed\n",
ava->aa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_inequality_candidates: (%s) "
@ -1083,13 +1091,6 @@ inequality_candidates(
return 0;
}
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= bdb_inequality_candidates: (%s) not indexed\n",
ava->aa_desc->ad_cname.bv_val, 0, 0 );
return 0;
}
mr = ava->aa_desc->ad_type->sat_equality;
if( !mr ) {
return 0;