}
}
+/* startup a specific backend database */
+int backend_startup_one(Backend *be)
+{
+ int rc = 0;
+
+ assert(be);
+
+ be->be_pending_csn_list = (struct be_pcl *)
+ ch_calloc( 1, sizeof( struct be_pcl ));
+ build_new_dn( &be->be_context_csn, be->be_nsuffix,
+ (struct berval *)&slap_ldapsync_cn_bv, NULL );
+
+ LDAP_TAILQ_INIT( be->be_pending_csn_list );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( BACKEND, DETAIL1, "backend_startup: starting \"%s\"\n",
+ be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)",
+ 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE,
+ "backend_startup: starting \"%s\"\n",
+ be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)",
+ 0, 0 );
+#endif
+ if ( be->bd_info->bi_db_open ) {
+ rc = be->bd_info->bi_db_open( be );
+ if ( rc != 0 ) {
+#ifdef NEW_LOGGING
+ 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 );
+#endif
+ }
+ }
+ return rc;
+}
+
int backend_startup(Backend *be)
{
int i;
}
if(be != NULL) {
- /* startup a specific backend database */
- be->be_pending_csn_list = (struct be_pcl *)
- ch_calloc( 1, sizeof( struct be_pcl ));
- build_new_dn( &be->be_context_csn, be->be_nsuffix,
- (struct berval *)&slap_ldapsync_cn_bv, NULL );
-
- LDAP_TAILQ_INIT( be->be_pending_csn_list );
-
-#ifdef NEW_LOGGING
- LDAP_LOG( BACKEND, DETAIL1, "backend_startup: starting \"%s\"\n",
- be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)",
- 0, 0 );
-#else
- Debug( LDAP_DEBUG_TRACE,
- "backend_startup: starting \"%s\"\n",
- be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)",
- 0, 0 );
-#endif
-
if ( be->bd_info->bi_open ) {
rc = be->bd_info->bi_open( be->bd_info );
if ( rc != 0 ) {
}
}
- if ( be->bd_info->bi_db_open ) {
- rc = be->bd_info->bi_db_open( be );
- if ( rc != 0 ) {
-#ifdef NEW_LOGGING
- 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 );
-#endif
- return rc;
- }
- }
-
- return rc;
+ return backend_startup_one( be );
}
/* open each backend type */
/* open each backend database */
for( i = 0; i < nBackendDB; i++ ) {
- /* append global access controls */
- acl_append( &backendDB[i].be_acl, global_acl );
-
- backendDB[i].be_pending_csn_list = (struct be_pcl *)
- ch_calloc( 1, sizeof( struct be_pcl ));
- LDAP_TAILQ_INIT( backendDB[i].be_pending_csn_list );
-
if ( backendDB[i].be_suffix == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( BACKEND, CRIT,
i, backendDB[i].bd_info->bi_type, 0 );
#endif
}
- build_new_dn( &backendDB[i].be_context_csn, backendDB[i].be_nsuffix,
- (struct berval *)&slap_ldapsync_cn_bv, NULL );
+ /* append global access controls */
+ acl_append( &backendDB[i].be_acl, global_acl );
+
+ rc = backend_startup_one( &backendDB[i] );
+
+ if ( rc ) return rc;
- if ( backendDB[i].bd_info->bi_db_open ) {
- rc = backendDB[i].bd_info->bi_db_open(
- &backendDB[i] );
- if ( rc != 0 ) {
-#ifdef NEW_LOGGING
- 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 );
-#endif
- return rc;
- }
- }
if ( !LDAP_STAILQ_EMPTY( &backendDB[i].be_syncinfo )) {
syncinfo_t *si;