1 /* init.c - initialize bdb backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2000-2006 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
20 #include <ac/string.h>
21 #include <ac/unistd.h>
22 #include <ac/stdlib.h>
30 static const struct bdbi_database {
35 } bdbi_databases[] = {
36 { "id2entry" BDB_SUFFIX, "id2entry", DB_BTREE, 0 },
37 { "dn2id" BDB_SUFFIX, "dn2id", DB_BTREE, 0 },
41 typedef void * db_malloc(size_t);
42 typedef void * db_realloc(void *, size_t);
45 bdb_db_init( BackendDB *be )
49 Debug( LDAP_DEBUG_TRACE,
50 LDAP_XSTRING(bdb_db_init) ": Initializing " BDB_UCTYPE " database\n",
53 /* allocate backend-database-specific stuff */
54 bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
56 /* DBEnv parameters */
57 bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR );
58 bdb->bi_dbenv_xflags = 0;
59 bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
61 bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
63 bdb->bi_lock_detect = DB_LOCK_DEFAULT;
64 bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
65 bdb->bi_search_stack = NULL;
67 ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
68 ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
70 ldap_pvt_thread_mutex_init( &bdb->bi_modrdns_mutex );
72 ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_head_mutex );
73 ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_tail_mutex );
74 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
75 ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
76 ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
77 ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
80 be->be_cf_ocs = be->bd_info->bi_cf_ocs;
86 bdb_db_close( BackendDB *be );
89 bdb_db_open( BackendDB *be )
92 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
93 struct stat stat1, stat2;
95 char path[MAXPATHLEN];
97 int do_recover = 0, do_alock_recover = 0, open_env = 1, got_env = 0;
99 if ( be->be_suffix == NULL ) {
100 Debug( LDAP_DEBUG_ANY,
101 "bdb_db_open: need suffix\n",
106 Debug( LDAP_DEBUG_ARGS,
108 be->be_suffix[0].bv_val, 0, 0 );
110 #ifndef BDB_MULTIPLE_SUFFIXES
111 if ( be->be_suffix[1].bv_val ) {
112 Debug( LDAP_DEBUG_ANY,
113 "bdb_db_open: only one suffix allowed\n", 0, 0, 0 );
118 /* Check existence of dbenv_home. Any error means trouble */
119 rc = stat( bdb->bi_dbenv_home, &stat1 );
121 Debug( LDAP_DEBUG_ANY,
122 "bdb_db_open: Cannot access database directory %s (%d)\n",
123 bdb->bi_dbenv_home, errno, 0 );
127 /* Perform database use arbitration/recovery logic */
128 rc = alock_open( &bdb->bi_alock_info,
131 slapMode & SLAP_TOOL_READONLY ?
132 ALOCK_LOCKED : ALOCK_UNIQUE );
134 if( rc == ALOCK_RECOVER ) {
135 Debug( LDAP_DEBUG_ANY,
136 "bdb_db_open: unclean shutdown detected;"
137 " attempting recovery.\n",
139 do_alock_recover = 1;
141 } else if( rc == ALOCK_BUSY ) {
142 Debug( LDAP_DEBUG_ANY,
143 "bdb_db_open: database already in use\n",
146 } else if( rc != ALOCK_CLEAN ) {
147 Debug( LDAP_DEBUG_ANY,
148 "bdb_db_open: alock package is unstable\n",
154 * The DB_CONFIG file may have changed. If so, recover the
155 * database so that new settings are put into effect. Also
156 * note the possible absence of DB_CONFIG in the log.
158 if( stat( bdb->bi_db_config_path, &stat1 ) == 0 ) {
160 char *ptr = lutil_strcopy(path, bdb->bi_dbenv_home);
161 *ptr++ = LDAP_DIRSEP[0];
162 strcpy( ptr, "__db.001" );
163 if( stat( path, &stat2 ) == 0 ) {
164 if( stat2.st_mtime <= stat1.st_mtime ) {
165 Debug( LDAP_DEBUG_ANY,
166 "bdb_db_open: DB_CONFIG for suffix %s has changed.\n"
167 "Performing database recovery to activate new settings.\n",
168 be->be_suffix[0].bv_val, 0, 0 );
175 Debug( LDAP_DEBUG_ANY,
176 "bdb_db_open: Warning - No DB_CONFIG file found "
177 "in directory %s: (%d)\n"
178 "Expect poor performance for suffix %s.\n",
179 bdb->bi_dbenv_home, errno, be->be_suffix[0].bv_val );
182 rc = db_env_create( &bdb->bi_dbenv, 0 );
184 Debug( LDAP_DEBUG_ANY,
185 "bdb_db_open: db_env_create failed: %s (%d)\n",
186 db_strerror(rc), rc, 0 );
190 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
191 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
193 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
195 /* One long-lived TXN per thread, two TXNs per write op */
196 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
198 if( bdb->bi_dbenv_xflags != 0 ) {
199 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
200 bdb->bi_dbenv_xflags, 1);
202 Debug( LDAP_DEBUG_ANY,
203 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
204 db_strerror(rc), rc, 0 );
209 #define BDB_TXN_FLAGS (DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN)
212 strcpy( path, bdb->bi_dbenv_home );
216 dbhome = bdb->bi_dbenv_home;
219 Debug( LDAP_DEBUG_TRACE,
220 "bdb_db_open: dbenv_open(%s)\n",
221 bdb->bi_dbenv_home, 0, 0);
223 /* Check if there is a usable existing environment */
224 flags = DB_JOINENV | DB_THREAD;
226 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
227 flags, bdb->bi_dbenv_mode );
233 rc = bdb->bi_dbenv->get_open_flags( bdb->bi_dbenv, &flags );
235 int flag2 = flags & BDB_TXN_FLAGS;
237 /* In quick mode, none of these flags are allowed */
238 if ( slapMode & SLAP_TOOL_QUICK ) {
242 /* In normal mode, all of these flags are required */
243 if ( flag2 == BDB_TXN_FLAGS )
248 /* In Quick mode, we cannot Recover... */
249 if ( slapMode & SLAP_TOOL_QUICK ) {
250 /* If we need to recover but we had no TXNs, just fail */
251 if ( do_recover && flags_ok ) {
252 Debug( LDAP_DEBUG_ANY,
253 "bdb_db_open: Database cannot be recovered. "
254 "Restore from backup!\n", 0, 0, 0);
258 /* We need to recover, and we had TXN support before:
259 * Close this env, open a new one with recovery flags.
262 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
263 bdb->bi_dbenv = NULL;
264 rc = db_env_create( &bdb->bi_dbenv, 0 );
266 Debug( LDAP_DEBUG_ANY,
267 "bdb_db_open: db_env_create failed: %s (%d)\n",
268 db_strerror(rc), rc, 0 );
271 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv,
272 be->be_suffix[0].bv_val );
273 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
274 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
275 flags | DB_RECOVER, bdb->bi_dbenv_mode );
277 Debug( LDAP_DEBUG_ANY,
278 "bdb_db_open: recovery failed: %s (%d)\n",
279 db_strerror(rc), rc, 0 );
284 /* Prev environment had TXN support, get rid of it */
286 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
287 bdb->bi_dbenv = NULL;
288 rc = db_env_create( &bdb->bi_dbenv, 0 );
290 Debug( LDAP_DEBUG_ANY,
291 "bdb_db_open: db_env_create failed: %s (%d)\n",
292 db_strerror(rc), rc, 0 );
295 bdb->bi_dbenv->remove( bdb->bi_dbenv, dbhome, 0 );
296 bdb->bi_dbenv = NULL;
298 /* Normal TXN mode */
300 /* If we need to recover but we had no TXNs, just fail */
301 if ( do_recover && !flags_ok ) {
302 Debug( LDAP_DEBUG_ANY,
303 "bdb_db_open: Database cannot be recovered. "
304 "Restore from backup!\n", 0, 0, 0);
308 /* Prev environment had no TXN support, close it */
310 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
311 bdb->bi_dbenv = NULL;
316 if ( flags_ok && !do_recover ) {
317 /* This environment is fine, don't reopen it */
320 /* Create a new env that can take the desired settings */
321 if ( bdb->bi_dbenv != NULL ) {
322 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
323 bdb->bi_dbenv = NULL;
325 rc = db_env_create( &bdb->bi_dbenv, 0 );
327 Debug( LDAP_DEBUG_ANY,
328 "bdb_db_open: db_env_create failed: %s (%d)\n",
329 db_strerror(rc), rc, 0 );
333 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
334 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
335 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
337 /* One long-lived TXN per thread, two TXNs per write op */
338 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
340 if( bdb->bi_dbenv_xflags != 0 ) {
341 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
342 bdb->bi_dbenv_xflags, 1);
344 Debug( LDAP_DEBUG_ANY,
345 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
346 db_strerror(rc), rc, 0 );
353 /* If we need to recover but there was no existing environment,
354 * then we assume that someone has already manually recovered using
355 * db_recover. Just ignore it.
357 if ( do_recover && !got_env ) {
359 Debug( LDAP_DEBUG_TRACE,
360 "bdb_db_open: Recovery needed but environment is missing - "
361 "assuming recovery was done manually...\n", 0, 0, 0 );
365 flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE;
366 if ( !( slapMode & SLAP_TOOL_QUICK ))
367 flags |= BDB_TXN_FLAGS;
372 /* If a key was set, use shared memory for the BDB environment */
373 if ( bdb->bi_shm_key ) {
374 bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
375 flags |= DB_SYSTEM_MEM;
378 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
379 flags, bdb->bi_dbenv_mode );
381 Debug( LDAP_DEBUG_ANY,
382 "bdb_db_open: dbenv_open failed: %s (%d)\n",
383 db_strerror(rc), rc, 0 );
388 if ( do_alock_recover && alock_recover (&bdb->bi_alock_info) != 0 ) {
389 Debug( LDAP_DEBUG_ANY,
390 "bdb_db_open: alock_recover failed\n",
396 #ifdef SLAP_ZONE_ALLOC
397 if ( bdb->bi_cache.c_maxsize ) {
398 bdb->bi_cache.c_zctx = slap_zn_mem_create(
406 if ( bdb->bi_idl_cache_max_size ) {
407 bdb->bi_idl_tree = NULL;
408 bdb->bi_idl_cache_size = 0;
411 flags = DB_THREAD | bdb->bi_db_opflags;
413 #ifdef DB_AUTO_COMMIT
414 if ( !( slapMode & SLAP_TOOL_QUICK ))
415 flags |= DB_AUTO_COMMIT;
418 bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
419 BDB_INDICES * sizeof(struct bdb_db_info *) );
421 /* open (and create) main database */
422 for( i = 0; bdbi_databases[i].name; i++ ) {
423 struct bdb_db_info *db;
425 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
427 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
429 Debug( LDAP_DEBUG_ANY,
430 "bdb_db_open: db_create(%s) failed: %s (%d)\n",
431 bdb->bi_dbenv_home, db_strerror(rc), rc );
435 if( i == BDB_ID2ENTRY ) {
436 if ( slapMode & SLAP_TOOL_MODE )
437 db->bdi_db->mpf->set_priority( db->bdi_db->mpf,
438 DB_PRIORITY_VERY_LOW );
440 rc = db->bdi_db->set_pagesize( db->bdi_db,
441 BDB_ID2ENTRY_PAGESIZE );
442 if ( slapMode & SLAP_TOOL_READMAIN ) {
448 rc = db->bdi_db->set_flags( db->bdi_db,
449 DB_DUP | DB_DUPSORT );
451 if ( slapMode & SLAP_TOOL_READONLY ) {
457 if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
463 rc = db->bdi_db->set_pagesize( db->bdi_db,
468 strcpy( path, bdbi_databases[i].file );
470 rc = DB_OPEN( db->bdi_db,
472 /* bdbi_databases[i].name, */ NULL,
473 bdbi_databases[i].type,
474 bdbi_databases[i].flags | flags,
475 bdb->bi_dbenv_mode );
477 rc = DB_OPEN( db->bdi_db,
478 bdbi_databases[i].file,
479 /* bdbi_databases[i].name, */ NULL,
480 bdbi_databases[i].type,
481 bdbi_databases[i].flags | flags,
482 bdb->bi_dbenv_mode );
486 char buf[SLAP_TEXT_BUFLEN];
488 snprintf( buf, sizeof(buf), "%s/%s",
489 bdb->bi_dbenv_home, bdbi_databases[i].file );
490 Debug( LDAP_DEBUG_ANY,
491 "bdb_db_open: db_open(%s) failed: %s (%d)\n",
492 buf, db_strerror(rc), rc );
493 db->bdi_db->close( db->bdi_db, 0 );
497 flags &= ~(DB_CREATE | DB_RDONLY);
498 db->bdi_name = bdbi_databases[i].name;
499 bdb->bi_databases[i] = db;
502 bdb->bi_databases[i] = NULL;
503 bdb->bi_ndatabases = i;
506 rc = bdb_last_id( be, NULL );
508 Debug( LDAP_DEBUG_ANY,
509 "bdb_db_open: last_id(%s) failed: %s (%d)\n",
510 bdb->bi_dbenv_home, db_strerror(rc), rc );
514 if ( !( slapMode & SLAP_TOOL_QUICK )) {
515 XLOCK_ID(bdb->bi_dbenv, &bdb->bi_cache.c_locker);
518 bdb->bi_flags |= BDB_IS_OPEN;
528 bdb_db_close( BackendDB *be )
531 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
532 struct bdb_db_info *db;
533 bdb_idl_cache_entry_t *entry, *next_entry;
535 bdb->bi_flags &= ~BDB_IS_OPEN;
537 ber_bvarray_free( bdb->bi_db_config );
538 bdb->bi_db_config = NULL;
540 while( bdb->bi_databases && bdb->bi_ndatabases-- ) {
541 db = bdb->bi_databases[bdb->bi_ndatabases];
542 rc = db->bdi_db->close( db->bdi_db, 0 );
543 /* Lower numbered names are not strdup'd */
544 if( bdb->bi_ndatabases >= BDB_NDB )
545 free( db->bdi_name );
548 free( bdb->bi_databases );
549 bdb->bi_databases = NULL;
551 bdb_cache_release_all (&bdb->bi_cache);
553 if ( bdb->bi_idl_cache_max_size ) {
554 avl_free( bdb->bi_idl_tree, NULL );
555 bdb->bi_idl_tree = NULL;
556 entry = bdb->bi_idl_lru_head;
557 while ( entry != NULL ) {
558 next_entry = entry->idl_lru_next;
561 free( entry->kstr.bv_val );
565 bdb->bi_idl_lru_head = bdb->bi_idl_lru_tail = NULL;
568 /* close db environment */
569 if( bdb->bi_dbenv ) {
570 /* Free cache locker if we enabled locking */
571 if ( !( slapMode & SLAP_TOOL_QUICK )) {
572 XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
573 bdb->bi_cache.c_locker = 0;
576 /* force a checkpoint, but not if we were ReadOnly,
577 * and not in Quick mode since there are no transactions there.
579 if ( !( slapMode & ( SLAP_TOOL_QUICK|SLAP_TOOL_READONLY ))) {
580 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
582 Debug( LDAP_DEBUG_ANY,
583 "bdb_db_close: txn_checkpoint failed: %s (%d)\n",
584 db_strerror(rc), rc, 0 );
588 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
589 bdb->bi_dbenv = NULL;
591 Debug( LDAP_DEBUG_ANY,
592 "bdb_db_close: close failed: %s (%d)\n",
593 db_strerror(rc), rc, 0 );
598 rc = alock_close( &bdb->bi_alock_info );
600 Debug( LDAP_DEBUG_ANY,
601 "bdb_db_close: alock_close failed\n", 0, 0, 0 );
609 bdb_db_destroy( BackendDB *be )
611 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
613 if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
614 if( bdb->bi_db_config_path ) ch_free( bdb->bi_db_config_path );
616 bdb_attr_index_destroy( bdb );
618 ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
619 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_head_mutex );
620 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_tail_mutex );
621 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
623 ldap_pvt_thread_mutex_destroy( &bdb->bi_modrdns_mutex );
625 ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
626 ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
627 ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
628 ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
631 be->be_private = NULL;
642 static char *controls[] = {
644 LDAP_CONTROL_MANAGEDSAIT,
646 LDAP_CONTROL_PAGEDRESULTS,
647 LDAP_CONTROL_SUBENTRIES,
648 LDAP_CONTROL_X_PERMISSIVE_MODIFY,
652 /* initialize the underlying database system */
653 Debug( LDAP_DEBUG_TRACE,
654 LDAP_XSTRING(bdb_back_initialize) ": initialize "
655 BDB_UCTYPE " backend\n", 0, 0, 0 );
658 SLAP_BFLAG_INCREMENT |
659 SLAP_BFLAG_SUBENTRIES |
661 SLAP_BFLAG_REFERRALS;
663 bi->bi_controls = controls;
665 { /* version check */
666 int major, minor, patch, ver;
667 char *version = db_version( &major, &minor, &patch );
671 /* All our stdio does an ASCII to EBCDIC conversion on
672 * the output. Strings from the BDB library are already
673 * in EBCDIC; we have to go back and forth...
675 strcpy( v2, version );
680 ver = (major << 24) | (minor << 16) | patch;
681 if( ver != DB_VERSION_FULL ) {
682 /* fail if a versions don't match */
683 Debug( LDAP_DEBUG_ANY,
684 LDAP_XSTRING(bdb_back_initialize) ": "
685 "BDB library version mismatch:"
686 " expected " DB_VERSION_STRING ","
687 " got %s\n", version, 0, 0 );
691 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_back_initialize)
692 ": %s\n", version, 0, 0 );
695 db_env_set_func_free( ber_memfree );
696 db_env_set_func_malloc( (db_malloc *)ber_memalloc );
697 db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
699 /* This is a no-op on a NO_THREAD build. Leave the default
700 * alone so that BDB will sleep on interprocess conflicts.
702 db_env_set_func_yield( ldap_pvt_thread_yield );
710 bi->bi_db_init = bdb_db_init;
711 bi->bi_db_config = config_generic_wrapper;
712 bi->bi_db_open = bdb_db_open;
713 bi->bi_db_close = bdb_db_close;
714 bi->bi_db_destroy = bdb_db_destroy;
716 bi->bi_op_add = bdb_add;
717 bi->bi_op_bind = bdb_bind;
718 bi->bi_op_compare = bdb_compare;
719 bi->bi_op_delete = bdb_delete;
720 bi->bi_op_modify = bdb_modify;
721 bi->bi_op_modrdn = bdb_modrdn;
722 bi->bi_op_search = bdb_search;
724 bi->bi_op_unbind = 0;
726 bi->bi_extended = bdb_extended;
728 bi->bi_chk_referrals = bdb_referrals;
729 bi->bi_operational = bdb_operational;
730 bi->bi_has_subordinates = bdb_hasSubordinates;
731 bi->bi_entry_release_rw = bdb_entry_release;
732 bi->bi_entry_get_rw = bdb_entry_get;
735 * hooks for slap tools
737 bi->bi_tool_entry_open = bdb_tool_entry_open;
738 bi->bi_tool_entry_close = bdb_tool_entry_close;
739 bi->bi_tool_entry_first = bdb_tool_entry_next;
740 bi->bi_tool_entry_next = bdb_tool_entry_next;
741 bi->bi_tool_entry_get = bdb_tool_entry_get;
742 bi->bi_tool_entry_put = bdb_tool_entry_put;
743 bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
744 bi->bi_tool_sync = 0;
745 bi->bi_tool_dn2id_get = bdb_tool_dn2id_get;
746 bi->bi_tool_id2entry_get = bdb_tool_id2entry_get;
747 bi->bi_tool_entry_modify = bdb_tool_entry_modify;
749 bi->bi_connection_init = 0;
750 bi->bi_connection_destroy = 0;
752 rc = bdb_back_init_cf( bi );
757 #if (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \
758 (SLAPD_HDB == SLAPD_MOD_DYNAMIC && defined(BDB_HIER))
760 /* conditionally define the init_module() function */
762 SLAP_BACKEND_INIT_MODULE( hdb )
763 #else /* !BDB_HIER */
764 SLAP_BACKEND_INIT_MODULE( bdb )
765 #endif /* !BDB_HIER */
767 #endif /* SLAPD_[BH]DB == SLAPD_MOD_DYNAMIC */