]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/backend.c
Fixes for NO_THREADS
[openldap] / servers / slapd / backend.c
index 461fc7a9f5af79c7a20cf4936215356fc948680f..987eb8832c67d62f7126888403fc0df32a47f4b0 100644 (file)
@@ -254,34 +254,32 @@ int backend_startup(Backend *be)
 
                if ( be->bd_info->bi_open ) {
                        rc = be->bd_info->bi_open( be->bd_info );
-               }
-
-               if(rc != 0) {
+                       if ( rc != 0 ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG( BACKEND, CRIT, "backend_startup: bi_open failed!\n", 0, 0, 0 );
+                               LDAP_LOG( BACKEND, CRIT, "backend_startup: bi_open failed!\n", 0, 0, 0 );
 #else
-                       Debug( LDAP_DEBUG_ANY,
-                               "backend_startup: bi_open failed!\n",
-                               0, 0, 0 );
+                               Debug( LDAP_DEBUG_ANY,
+                                       "backend_startup: bi_open failed!\n",
+                                       0, 0, 0 );
 #endif
 
-                       return rc;
+                               return rc;
+                       }
                }
 
                if ( be->bd_info->bi_db_open ) {
                        rc = be->bd_info->bi_db_open( be );
-               }
-
-               if(rc != 0) {
+                       if ( rc != 0 ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG( BACKEND, CRIT, 
-                               "backend_startup: bi_db_open failed! (%d)\n", rc, 0, 0 );
+                               LDAP_LOG( BACKEND, CRIT, 
+                                       "backend_startup: bi_db_open failed! (%d)\n", rc, 0, 0 );
 #else
-                       Debug( LDAP_DEBUG_ANY,
-                               "backend_startup: bi_db_open failed! (%d)\n",
-                               rc, 0, 0 );
+                               Debug( LDAP_DEBUG_ANY,
+                                       "backend_startup: bi_db_open failed! (%d)\n",
+                                       rc, 0, 0 );
 #endif
-                       return rc;
+                               return rc;
+                       }
                }
 
                return rc;
@@ -297,18 +295,17 @@ int backend_startup(Backend *be)
                if( backendInfo[i].bi_open ) {
                        rc = backendInfo[i].bi_open(
                                &backendInfo[i] );
-               }
-
-               if(rc != 0) {
+                       if ( rc != 0 ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG( BACKEND, CRIT, 
-                               "backend_startup: bi_open %d failed!\n", i, 0, 0 );
+                               LDAP_LOG( BACKEND, CRIT, 
+                                       "backend_startup: bi_open %d failed!\n", i, 0, 0 );
 #else
-                       Debug( LDAP_DEBUG_ANY,
-                               "backend_startup: bi_open %d failed!\n",
-                               i, 0, 0 );
+                               Debug( LDAP_DEBUG_ANY,
+                                       "backend_startup: bi_open %d failed!\n",
+                                       i, 0, 0 );
 #endif
-                       return rc;
+                               return rc;
+                       }
                }
        }
 
@@ -320,18 +317,17 @@ int backend_startup(Backend *be)
                if ( backendDB[i].bd_info->bi_db_open ) {
                        rc = backendDB[i].bd_info->bi_db_open(
                                &backendDB[i] );
-               }
-
-               if(rc != 0) {
+                       if ( rc != 0 ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG( BACKEND, CRIT, 
-                               "backend_startup: bi_db_open(%d) failed! (%d)\n", i, rc, 0 );
+                               LDAP_LOG( BACKEND, CRIT, 
+                                       "backend_startup: bi_db_open(%d) failed! (%d)\n", i, rc, 0 );
 #else
-                       Debug( LDAP_DEBUG_ANY,
-                               "backend_startup: bi_db_open(%d) failed! (%d)\n",
-                               i, rc, 0 );
+                               Debug( LDAP_DEBUG_ANY,
+                                       "backend_startup: bi_db_open(%d) failed! (%d)\n",
+                                       i, rc, 0 );
 #endif
-                       return rc;
+                               return rc;
+                       }
                }
        }
 
@@ -589,7 +585,7 @@ be_issuffix(
        int     i;
 
        for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i].bv_val != NULL; i++ ) {
-               if ( ber_bvcmp( &be->be_nsuffix[i], bvsuffix ) == 0 ) {
+               if ( bvmatch( &be->be_nsuffix[i], bvsuffix ) ) {
                        return( 1 );
                }
        }
@@ -746,6 +742,11 @@ backend_check_controls(
                return LDAP_SUCCESS;
        }
 
+       if ( be->be_controls == NULL ) {
+               *text = "control unavailable in context";
+               return LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
+       }
+
        for( ; *ctrls != NULL ; ctrls++ ) {
                if( (*ctrls)->ldctl_iscritical &&
                        !ldap_charray_inlist( be->be_controls, (*ctrls)->ldctl_oid ) )
@@ -820,7 +821,7 @@ backend_check_restrictions(
 
                {
                        struct berval bv = BER_BVC( LDAP_EXOP_START_TLS );
-                       if( ber_bvcmp( opdata, &bv ) == 0 ) {
+                       if( bvmatch( opdata, &bv ) ) {
                                session++;
                                starttls++;
                                break;
@@ -829,7 +830,7 @@ backend_check_restrictions(
 
                {
                        struct berval bv = BER_BVC( LDAP_EXOP_X_WHO_AM_I );
-                       if( ber_bvcmp( opdata, &bv ) == 0 ) {
+                       if( bvmatch( opdata, &bv ) ) {
                                break;
                        }
                }