]> git.sur5r.net Git - openldap/commitdiff
ITS#5037
authorQuanah Gibson-Mount <quanah@openldap.org>
Mon, 9 Jul 2007 21:28:14 +0000 (21:28 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 9 Jul 2007 21:28:14 +0000 (21:28 +0000)
Move db == NULL check to correct spot

servers/slapd/back-bdb/filterindex.c

index e88395f784277f0733963635dd86f22f48a0ae82..d64aa3c024df8abfc552f171b435c3d7e4865367 100644 (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,18 +722,18 @@ equality_candidates(
        rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_EQUALITY,
                &db, &mask, &prefix );
 
-       if( rc != LDAP_SUCCESS ) {
+       if ( db == NULL ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_equality_candidates: (%s) "
-                       "index_param failed (%d)\n",
-                       ava->aa_desc->ad_cname.bv_val, rc, 0 );
+                       "<= bdb_equality_candidates: (%s) not indexed\n", 
+                       ava->aa_desc->ad_cname.bv_val, 0, 0 );
                return 0;
        }
 
-       if ( db == NULL ) {
+       if( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_equality_candidates: (%s) not indexed\n", 
-                       ava->aa_desc->ad_cname.bv_val, 0, 0 );
+                       "<= bdb_equality_candidates: (%s) "
+                       "index_param failed (%d)\n",
+                       ava->aa_desc->ad_cname.bv_val, rc, 0 );
                return 0;
        }
 
@@ -838,18 +839,18 @@ approx_candidates(
        rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_APPROX,
                &db, &mask, &prefix );
 
-       if( rc != LDAP_SUCCESS ) {
+       if ( db == NULL ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_approx_candidates: (%s) "
-                       "index_param failed (%d)\n",
-                       ava->aa_desc->ad_cname.bv_val, rc, 0 );
+                       "<= bdb_approx_candidates: (%s) not indexed\n",
+                       ava->aa_desc->ad_cname.bv_val, 0, 0 );
                return 0;
        }
 
-       if ( db == NULL ) {
+       if( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_approx_candidates: (%s) not indexed\n",
-                       ava->aa_desc->ad_cname.bv_val, 0, 0 );
+                       "<= bdb_approx_candidates: (%s) "
+                       "index_param failed (%d)\n",
+                       ava->aa_desc->ad_cname.bv_val, rc, 0 );
                return 0;
        }
 
@@ -958,18 +959,18 @@ substring_candidates(
        rc = bdb_index_param( op->o_bd, sub->sa_desc, LDAP_FILTER_SUBSTRINGS,
                &db, &mask, &prefix );
 
-       if( rc != LDAP_SUCCESS ) {
+       if ( db == NULL ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_substring_candidates: (%s) "
-                       "index_param failed (%d)\n",
-                       sub->sa_desc->ad_cname.bv_val, rc, 0 );
+                       "<= bdb_substring_candidates: (%s) not indexed\n",
+                       sub->sa_desc->ad_cname.bv_val, 0, 0 );
                return 0;
        }
 
-       if ( db == NULL ) {
+       if( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_substring_candidates: (%s) not indexed\n",
-                       sub->sa_desc->ad_cname.bv_val, 0, 0 );
+                       "<= bdb_substring_candidates: (%s) "
+                       "index_param failed (%d)\n",
+                       sub->sa_desc->ad_cname.bv_val, rc, 0 );
                return 0;
        }
 
@@ -1075,18 +1076,18 @@ inequality_candidates(
        rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_EQUALITY,
                &db, &mask, &prefix );
 
-       if( rc != LDAP_SUCCESS ) {
+       if ( db == NULL ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_inequality_candidates: (%s) "
-                       "index_param failed (%d)\n",
-                       ava->aa_desc->ad_cname.bv_val, rc, 0 );
+                       "<= bdb_inequality_candidates: (%s) not indexed\n", 
+                       ava->aa_desc->ad_cname.bv_val, 0, 0 );
                return 0;
        }
 
-       if ( db == NULL ) {
+       if( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= bdb_inequality_candidates: (%s) not indexed\n", 
-                       ava->aa_desc->ad_cname.bv_val, 0, 0 );
+                       "<= bdb_inequality_candidates: (%s) "
+                       "index_param failed (%d)\n",
+                       ava->aa_desc->ad_cname.bv_val, rc, 0 );
                return 0;
        }