1 /* init.c - initialize bdb backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2000-2007 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>
31 static const struct bdbi_database {
36 } bdbi_databases[] = {
37 { "id2entry" BDB_SUFFIX, "id2entry", DB_BTREE, 0 },
38 { "dn2id" BDB_SUFFIX, "dn2id", DB_BTREE, 0 },
42 typedef void * db_malloc(size_t);
43 typedef void * db_realloc(void *, size_t);
45 #define bdb_db_init BDB_SYMBOL(db_init)
46 #define bdb_db_open BDB_SYMBOL(db_open)
47 #define bdb_db_close BDB_SYMBOL(db_close)
50 bdb_db_init( BackendDB *be, ConfigReply *cr )
55 Debug( LDAP_DEBUG_TRACE,
56 LDAP_XSTRING(bdb_db_init) ": Initializing " BDB_UCTYPE " database\n",
59 /* allocate backend-database-specific stuff */
60 bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
62 /* DBEnv parameters */
63 bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR );
64 bdb->bi_dbenv_xflags = 0;
65 bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
67 bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
68 bdb->bi_cache.c_minfree = 1;
70 bdb->bi_lock_detect = DB_LOCK_DEFAULT;
71 bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
72 bdb->bi_search_stack = NULL;
74 ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
75 ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
77 ldap_pvt_thread_mutex_init( &bdb->bi_modrdns_mutex );
79 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_lru_mutex );
80 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_count_mutex );
81 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_eifree_mutex );
82 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
83 ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
84 ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
85 ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
88 be->be_cf_ocs = be->bd_info->bi_cf_ocs;
90 rc = bdb_monitor_db_init( be );
96 bdb_db_close( BackendDB *be, ConfigReply *cr );
99 bdb_db_open( BackendDB *be, ConfigReply *cr )
102 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
103 struct stat stat1, stat2;
105 char path[MAXPATHLEN];
108 int do_recover = 0, do_alock_recover = 0;
109 int alockt, quick = 0;
111 if ( be->be_suffix == NULL ) {
112 Debug( LDAP_DEBUG_ANY,
113 LDAP_XSTRING(bdb_db_open) ": need suffix\n",
118 Debug( LDAP_DEBUG_ARGS,
119 LDAP_XSTRING(bdb_db_open) ": %s\n",
120 be->be_suffix[0].bv_val, 0, 0 );
122 #ifndef BDB_MULTIPLE_SUFFIXES
123 if ( be->be_suffix[1].bv_val ) {
125 snprintf(cr->msg, sizeof(cr->msg), "only one suffix allowed");
126 Debug( LDAP_DEBUG_ANY,
127 LDAP_XSTRING(bdb_db_open) ": %s\n", cr->msg, 0, 0 );
133 /* Check existence of dbenv_home. Any error means trouble */
134 rc = stat( bdb->bi_dbenv_home, &stat1 );
136 Debug( LDAP_DEBUG_ANY,
137 LDAP_XSTRING(bdb_db_open) ": Cannot access database directory %s (%d)\n",
138 bdb->bi_dbenv_home, errno, 0 );
142 /* Perform database use arbitration/recovery logic */
143 alockt = (slapMode & SLAP_TOOL_READONLY) ? ALOCK_LOCKED : ALOCK_UNIQUE;
144 if ( slapMode & SLAP_TOOL_QUICK ) {
145 alockt |= ALOCK_NOSAVE;
149 rc = alock_open( &bdb->bi_alock_info,
151 bdb->bi_dbenv_home, alockt );
153 /* alockt is TRUE if the existing environment was created in Quick mode */
154 alockt = (rc & ALOCK_NOSAVE) ? 1 : 0;
157 if( rc == ALOCK_RECOVER ) {
158 Debug( LDAP_DEBUG_ANY,
159 LDAP_XSTRING(bdb_db_open) ": unclean shutdown detected;"
160 " attempting recovery.\n",
162 do_alock_recover = 1;
163 do_recover = DB_RECOVER;
164 } else if( rc == ALOCK_BUSY ) {
165 Debug( LDAP_DEBUG_ANY,
166 LDAP_XSTRING(bdb_db_open) ": database already in use\n",
169 } else if( rc != ALOCK_CLEAN ) {
170 Debug( LDAP_DEBUG_ANY,
171 LDAP_XSTRING(bdb_db_open) ": alock package is unstable\n",
177 * The DB_CONFIG file may have changed. If so, recover the
178 * database so that new settings are put into effect. Also
179 * note the possible absence of DB_CONFIG in the log.
181 if( stat( bdb->bi_db_config_path, &stat1 ) == 0 ) {
183 char *ptr = lutil_strcopy(path, bdb->bi_dbenv_home);
184 *ptr++ = LDAP_DIRSEP[0];
185 strcpy( ptr, "__db.001" );
186 if( stat( path, &stat2 ) == 0 ) {
187 if( stat2.st_mtime < stat1.st_mtime ) {
188 Debug( LDAP_DEBUG_ANY,
189 LDAP_XSTRING(bdb_db_open) ": DB_CONFIG for suffix %s has changed.\n"
190 "Performing database recovery to activate new settings.\n",
191 be->be_suffix[0].bv_val, 0, 0 );
192 do_recover = DB_RECOVER;
198 Debug( LDAP_DEBUG_ANY,
199 LDAP_XSTRING(bdb_db_open) ": Warning - No DB_CONFIG file found "
200 "in directory %s: (%d)\n"
201 "Expect poor performance for suffix %s.\n",
202 bdb->bi_dbenv_home, errno, be->be_suffix[0].bv_val );
205 /* Always let slapcat run, regardless of environment state.
206 * This can be used to cause a cache flush after an unclean
209 if ( do_recover && ( slapMode & SLAP_TOOL_READONLY )) {
210 Debug( LDAP_DEBUG_ANY,
211 LDAP_XSTRING(bdb_db_open) ": Recovery skipped in read-only mode. "
212 "Run manual recovery if errors are encountered.\n",
218 /* An existing environment in Quick mode has nothing to recover. */
219 if ( alockt && do_recover ) {
220 Debug( LDAP_DEBUG_ANY,
221 LDAP_XSTRING(bdb_db_open) ": cannot recover, database must be reinitialized.\n",
227 rc = db_env_create( &bdb->bi_dbenv, 0 );
229 Debug( LDAP_DEBUG_ANY,
230 LDAP_XSTRING(bdb_db_open) ": db_env_create failed: %s (%d)\n",
231 db_strerror(rc), rc, 0 );
236 strcpy( path, bdb->bi_dbenv_home );
240 dbhome = bdb->bi_dbenv_home;
243 /* If existing environment is clean but doesn't support
244 * currently requested modes, remove it.
246 if ( !do_recover && ( alockt ^ quick )) {
248 rc = bdb->bi_dbenv->remove( bdb->bi_dbenv, dbhome, DB_FORCE );
250 Debug( LDAP_DEBUG_ANY,
251 LDAP_XSTRING(bdb_db_open) ": dbenv remove failed: %s (%d)\n",
252 db_strerror(rc), rc, 0 );
253 bdb->bi_dbenv = NULL;
256 rc = db_env_create( &bdb->bi_dbenv, 0 );
258 Debug( LDAP_DEBUG_ANY,
259 LDAP_XSTRING(bdb_db_open) ": db_env_create failed: %s (%d)\n",
260 db_strerror(rc), rc, 0 );
265 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
266 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
268 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
270 /* One long-lived TXN per thread, two TXNs per write op */
271 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
273 if( bdb->bi_dbenv_xflags != 0 ) {
274 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
275 bdb->bi_dbenv_xflags, 1);
277 Debug( LDAP_DEBUG_ANY,
278 LDAP_XSTRING(bdb_db_open) ": dbenv_set_flags failed: %s (%d)\n",
279 db_strerror(rc), rc, 0 );
284 #define BDB_TXN_FLAGS (DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN)
286 Debug( LDAP_DEBUG_TRACE,
287 LDAP_XSTRING(bdb_db_open) ": dbenv_open(%s)\n",
288 bdb->bi_dbenv_home, 0, 0);
290 flags = DB_INIT_MPOOL | DB_CREATE | DB_THREAD;
293 flags |= BDB_TXN_FLAGS;
295 /* If a key was set, use shared memory for the BDB environment */
296 if ( bdb->bi_shm_key ) {
297 bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
298 flags |= DB_SYSTEM_MEM;
300 rc = (bdb->bi_dbenv->open)( bdb->bi_dbenv, dbhome,
301 flags | do_recover, bdb->bi_dbenv_mode );
304 /* Regular open failed, probably a missing shm environment.
305 * Start over, do a recovery.
307 if ( !do_recover && bdb->bi_shm_key ) {
308 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
309 rc = db_env_create( &bdb->bi_dbenv, 0 );
311 Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_db_open)
312 ": Shared memory env open failed, assuming stale env\n",
317 Debug( LDAP_DEBUG_ANY,
318 LDAP_XSTRING(bdb_db_open) ": Database cannot be %s, err %d. "
319 "Restore from backup!\n",
320 do_recover ? "recovered" : "opened", rc, 0);
324 if ( do_alock_recover && alock_recover (&bdb->bi_alock_info) != 0 ) {
325 Debug( LDAP_DEBUG_ANY,
326 LDAP_XSTRING(bdb_db_open) ": alock_recover failed\n",
332 #ifdef SLAP_ZONE_ALLOC
333 if ( bdb->bi_cache.c_maxsize ) {
334 bdb->bi_cache.c_zctx = slap_zn_mem_create(
335 SLAP_ZONE_INITSIZE, SLAP_ZONE_MAXSIZE,
336 SLAP_ZONE_DELTA, SLAP_ZONE_SIZE);
340 /* Default dncache to 2x entrycache */
341 if ( bdb->bi_cache.c_maxsize && !bdb->bi_cache.c_eimax ) {
342 bdb->bi_cache.c_eimax = bdb->bi_cache.c_maxsize * 2;
345 if ( bdb->bi_idl_cache_max_size ) {
346 bdb->bi_idl_tree = NULL;
347 bdb->bi_idl_cache_size = 0;
350 flags = DB_THREAD | bdb->bi_db_opflags;
352 #ifdef DB_AUTO_COMMIT
354 flags |= DB_AUTO_COMMIT;
357 bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
358 BDB_INDICES * sizeof(struct bdb_db_info *) );
360 /* open (and create) main database */
361 for( i = 0; bdbi_databases[i].name; i++ ) {
362 struct bdb_db_info *db;
364 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
366 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
368 Debug( LDAP_DEBUG_ANY,
369 LDAP_XSTRING(bdb_db_open) ": db_create(%s) failed: %s (%d)\n",
370 bdb->bi_dbenv_home, db_strerror(rc), rc );
374 if( i == BDB_ID2ENTRY ) {
375 if ( slapMode & SLAP_TOOL_MODE )
376 db->bdi_db->mpf->set_priority( db->bdi_db->mpf,
377 DB_PRIORITY_VERY_LOW );
379 rc = db->bdi_db->set_pagesize( db->bdi_db,
380 BDB_ID2ENTRY_PAGESIZE );
381 if ( slapMode & SLAP_TOOL_READMAIN ) {
387 rc = db->bdi_db->set_flags( db->bdi_db,
388 DB_DUP | DB_DUPSORT );
390 if ( slapMode & SLAP_TOOL_READONLY ) {
396 if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
402 rc = db->bdi_db->set_pagesize( db->bdi_db,
407 strcpy( path, bdbi_databases[i].file );
409 rc = DB_OPEN( db->bdi_db,
411 /* bdbi_databases[i].name, */ NULL,
412 bdbi_databases[i].type,
413 bdbi_databases[i].flags | flags,
414 bdb->bi_dbenv_mode );
416 rc = DB_OPEN( db->bdi_db,
417 bdbi_databases[i].file,
418 /* bdbi_databases[i].name, */ NULL,
419 bdbi_databases[i].type,
420 bdbi_databases[i].flags | flags,
421 bdb->bi_dbenv_mode );
425 char buf[SLAP_TEXT_BUFLEN];
427 snprintf( buf, sizeof(buf), "%s/%s",
428 bdb->bi_dbenv_home, bdbi_databases[i].file );
429 Debug( LDAP_DEBUG_ANY,
430 LDAP_XSTRING(bdb_db_open) ": db_open(%s) failed: %s (%d)\n",
431 buf, db_strerror(rc), rc );
432 db->bdi_db->close( db->bdi_db, 0 );
436 flags &= ~(DB_CREATE | DB_RDONLY);
437 db->bdi_name = bdbi_databases[i].name;
438 bdb->bi_databases[i] = db;
441 bdb->bi_databases[i] = NULL;
442 bdb->bi_ndatabases = i;
445 rc = bdb_last_id( be, NULL );
447 Debug( LDAP_DEBUG_ANY,
448 LDAP_XSTRING(bdb_db_open) ": last_id(%s) failed: %s (%d)\n",
449 bdb->bi_dbenv_home, db_strerror(rc), rc );
454 XLOCK_ID(bdb->bi_dbenv, &bdb->bi_cache.c_locker);
457 entry_prealloc( bdb->bi_cache.c_maxsize );
458 attr_prealloc( bdb->bi_cache.c_maxsize * 20 );
460 /* setup for empty-DN contexts */
461 if ( BER_BVISEMPTY( &be->be_nsuffix[0] )) {
462 rc = bdb_id2entry( be, NULL, 0, 0, &e );
467 ber_dupbv( &e->e_name, (struct berval *)&slap_empty_bv );
468 ber_dupbv( &e->e_nname, (struct berval *)&slap_empty_bv );
470 e->e_ocflags = SLAP_OC_GLUE|SLAP_OC__END;
471 e->e_private = &bdb->bi_cache.c_dntree;
472 bdb->bi_cache.c_dntree.bei_e = e;
475 rc = bdb_monitor_db_open( be );
480 bdb->bi_flags |= BDB_IS_OPEN;
485 bdb_db_close( be, NULL );
490 bdb_db_close( BackendDB *be, ConfigReply *cr )
493 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
494 struct bdb_db_info *db;
495 bdb_idl_cache_entry_t *entry, *next_entry;
497 /* monitor handling */
498 (void)bdb_monitor_db_close( be );
501 Entry *e = bdb->bi_cache.c_dntree.bei_e;
503 bdb->bi_cache.c_dntree.bei_e = NULL;
505 bdb_entry_return( e );
509 bdb->bi_flags &= ~BDB_IS_OPEN;
511 ber_bvarray_free( bdb->bi_db_config );
512 bdb->bi_db_config = NULL;
514 while( bdb->bi_databases && bdb->bi_ndatabases-- ) {
515 db = bdb->bi_databases[bdb->bi_ndatabases];
516 rc = db->bdi_db->close( db->bdi_db, 0 );
517 /* Lower numbered names are not strdup'd */
518 if( bdb->bi_ndatabases >= BDB_NDB )
519 free( db->bdi_name );
522 free( bdb->bi_databases );
523 bdb->bi_databases = NULL;
525 bdb_cache_release_all (&bdb->bi_cache);
527 if ( bdb->bi_idl_cache_size ) {
528 avl_free( bdb->bi_idl_tree, NULL );
529 bdb->bi_idl_tree = NULL;
530 entry = bdb->bi_idl_lru_head;
532 next_entry = entry->idl_lru_next;
535 free( entry->kstr.bv_val );
538 } while ( entry != bdb->bi_idl_lru_head );
539 bdb->bi_idl_lru_head = bdb->bi_idl_lru_tail = NULL;
542 /* close db environment */
543 if( bdb->bi_dbenv ) {
544 /* Free cache locker if we enabled locking */
545 if ( !( slapMode & SLAP_TOOL_QUICK )) {
546 XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
547 bdb->bi_cache.c_locker = 0;
549 #ifdef BDB_REUSE_LOCKERS
550 bdb_locker_flush( bdb->bi_dbenv );
552 /* force a checkpoint, but not if we were ReadOnly,
553 * and not in Quick mode since there are no transactions there.
555 if ( !( slapMode & ( SLAP_TOOL_QUICK|SLAP_TOOL_READONLY ))) {
556 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
558 Debug( LDAP_DEBUG_ANY,
559 "bdb_db_close: txn_checkpoint failed: %s (%d)\n",
560 db_strerror(rc), rc, 0 );
564 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
565 bdb->bi_dbenv = NULL;
567 Debug( LDAP_DEBUG_ANY,
568 "bdb_db_close: close failed: %s (%d)\n",
569 db_strerror(rc), rc, 0 );
574 rc = alock_close( &bdb->bi_alock_info );
576 Debug( LDAP_DEBUG_ANY,
577 "bdb_db_close: alock_close failed\n", 0, 0, 0 );
585 bdb_db_destroy( BackendDB *be, ConfigReply *cr )
587 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
589 /* monitor handling */
590 (void)bdb_monitor_db_destroy( be );
592 if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
593 if( bdb->bi_db_config_path ) ch_free( bdb->bi_db_config_path );
595 bdb_attr_index_destroy( bdb );
597 ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
598 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_lru_mutex );
599 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_count_mutex );
600 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_eifree_mutex );
601 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
603 ldap_pvt_thread_mutex_destroy( &bdb->bi_modrdns_mutex );
605 ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
606 ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
607 ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
608 ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
611 be->be_private = NULL;
622 static char *controls[] = {
624 LDAP_CONTROL_MANAGEDSAIT,
626 LDAP_CONTROL_PAGEDRESULTS,
627 LDAP_CONTROL_PRE_READ,
628 LDAP_CONTROL_POST_READ,
629 LDAP_CONTROL_SUBENTRIES,
630 LDAP_CONTROL_X_PERMISSIVE_MODIFY,
632 LDAP_CONTROL_X_TXN_SPEC,
637 /* initialize the underlying database system */
638 Debug( LDAP_DEBUG_TRACE,
639 LDAP_XSTRING(bdb_back_initialize) ": initialize "
640 BDB_UCTYPE " backend\n", 0, 0, 0 );
643 SLAP_BFLAG_INCREMENT |
644 SLAP_BFLAG_SUBENTRIES |
646 SLAP_BFLAG_REFERRALS;
648 bi->bi_controls = controls;
650 { /* version check */
651 int major, minor, patch, ver;
652 char *version = db_version( &major, &minor, &patch );
656 /* All our stdio does an ASCII to EBCDIC conversion on
657 * the output. Strings from the BDB library are already
658 * in EBCDIC; we have to go back and forth...
660 strcpy( v2, version );
665 ver = (major << 24) | (minor << 16) | patch;
666 if( ver != DB_VERSION_FULL ) {
667 /* fail if a versions don't match */
668 Debug( LDAP_DEBUG_ANY,
669 LDAP_XSTRING(bdb_back_initialize) ": "
670 "BDB library version mismatch:"
671 " expected " DB_VERSION_STRING ","
672 " got %s\n", version, 0, 0 );
676 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_back_initialize)
677 ": %s\n", version, 0, 0 );
680 db_env_set_func_free( ber_memfree );
681 db_env_set_func_malloc( (db_malloc *)ber_memalloc );
682 db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
684 /* This is a no-op on a NO_THREAD build. Leave the default
685 * alone so that BDB will sleep on interprocess conflicts.
687 db_env_set_func_yield( ldap_pvt_thread_yield );
695 bi->bi_db_init = bdb_db_init;
696 bi->bi_db_config = config_generic_wrapper;
697 bi->bi_db_open = bdb_db_open;
698 bi->bi_db_close = bdb_db_close;
699 bi->bi_db_destroy = bdb_db_destroy;
701 bi->bi_op_add = bdb_add;
702 bi->bi_op_bind = bdb_bind;
703 bi->bi_op_compare = bdb_compare;
704 bi->bi_op_delete = bdb_delete;
705 bi->bi_op_modify = bdb_modify;
706 bi->bi_op_modrdn = bdb_modrdn;
707 bi->bi_op_search = bdb_search;
709 bi->bi_op_unbind = 0;
711 bi->bi_extended = bdb_extended;
713 bi->bi_chk_referrals = bdb_referrals;
714 bi->bi_operational = bdb_operational;
715 bi->bi_has_subordinates = bdb_hasSubordinates;
716 bi->bi_entry_release_rw = bdb_entry_release;
717 bi->bi_entry_get_rw = bdb_entry_get;
720 * hooks for slap tools
722 bi->bi_tool_entry_open = bdb_tool_entry_open;
723 bi->bi_tool_entry_close = bdb_tool_entry_close;
724 bi->bi_tool_entry_first = bdb_tool_entry_next;
725 bi->bi_tool_entry_next = bdb_tool_entry_next;
726 bi->bi_tool_entry_get = bdb_tool_entry_get;
727 bi->bi_tool_entry_put = bdb_tool_entry_put;
728 bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
729 bi->bi_tool_sync = 0;
730 bi->bi_tool_dn2id_get = bdb_tool_dn2id_get;
731 bi->bi_tool_entry_modify = bdb_tool_entry_modify;
733 bi->bi_connection_init = 0;
734 bi->bi_connection_destroy = 0;
736 rc = bdb_back_init_cf( bi );
741 #if (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \
742 (SLAPD_HDB == SLAPD_MOD_DYNAMIC && defined(BDB_HIER))
744 /* conditionally define the init_module() function */
746 SLAP_BACKEND_INIT_MODULE( hdb )
747 #else /* !BDB_HIER */
748 SLAP_BACKEND_INIT_MODULE( bdb )
749 #endif /* !BDB_HIER */
751 #endif /* SLAPD_[BH]DB == SLAPD_MOD_DYNAMIC */