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>
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);
44 #define bdb_db_init BDB_SYMBOL(db_init)
45 #define bdb_db_open BDB_SYMBOL(db_open)
46 #define bdb_db_close BDB_SYMBOL(db_close)
49 bdb_db_init( BackendDB *be )
54 Debug( LDAP_DEBUG_TRACE,
55 LDAP_XSTRING(bdb_db_init) ": Initializing " BDB_UCTYPE " database\n",
58 /* allocate backend-database-specific stuff */
59 bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
61 /* DBEnv parameters */
62 bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR );
63 bdb->bi_dbenv_xflags = 0;
64 bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
66 bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
67 bdb->bi_cache.c_minfree = 1;
69 bdb->bi_lock_detect = DB_LOCK_DEFAULT;
70 bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
71 bdb->bi_search_stack = NULL;
73 ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
74 ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
76 ldap_pvt_thread_mutex_init( &bdb->bi_modrdns_mutex );
78 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_lru_mutex );
79 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_count_mutex );
80 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_eifree_mutex );
81 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
82 ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
83 ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
84 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 );
99 bdb_db_open( BackendDB *be )
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 ) {
124 Debug( LDAP_DEBUG_ANY,
125 LDAP_XSTRING(bdb_db_open) ": only one suffix allowed\n", 0, 0, 0 );
130 /* Check existence of dbenv_home. Any error means trouble */
131 rc = stat( bdb->bi_dbenv_home, &stat1 );
133 Debug( LDAP_DEBUG_ANY,
134 LDAP_XSTRING(bdb_db_open) ": Cannot access database directory %s (%d)\n",
135 bdb->bi_dbenv_home, errno, 0 );
139 /* Perform database use arbitration/recovery logic */
140 alockt = (slapMode & SLAP_TOOL_READONLY) ? ALOCK_LOCKED : ALOCK_UNIQUE;
141 if ( slapMode & SLAP_TOOL_QUICK ) {
142 alockt |= ALOCK_NOSAVE;
146 rc = alock_open( &bdb->bi_alock_info,
148 bdb->bi_dbenv_home, alockt );
150 /* alockt is TRUE if the existing environment was created in Quick mode */
151 alockt = (rc & ALOCK_NOSAVE) ? 1 : 0;
154 if( rc == ALOCK_RECOVER ) {
155 Debug( LDAP_DEBUG_ANY,
156 LDAP_XSTRING(bdb_db_open) ": unclean shutdown detected;"
157 " attempting recovery.\n",
159 do_alock_recover = 1;
160 do_recover = DB_RECOVER;
161 } else if( rc == ALOCK_BUSY ) {
162 Debug( LDAP_DEBUG_ANY,
163 LDAP_XSTRING(bdb_db_open) ": database already in use\n",
166 } else if( rc != ALOCK_CLEAN ) {
167 Debug( LDAP_DEBUG_ANY,
168 LDAP_XSTRING(bdb_db_open) ": alock package is unstable\n",
174 * The DB_CONFIG file may have changed. If so, recover the
175 * database so that new settings are put into effect. Also
176 * note the possible absence of DB_CONFIG in the log.
178 if( stat( bdb->bi_db_config_path, &stat1 ) == 0 ) {
180 char *ptr = lutil_strcopy(path, bdb->bi_dbenv_home);
181 *ptr++ = LDAP_DIRSEP[0];
182 strcpy( ptr, "__db.001" );
183 if( stat( path, &stat2 ) == 0 ) {
184 if( stat2.st_mtime < stat1.st_mtime ) {
185 Debug( LDAP_DEBUG_ANY,
186 LDAP_XSTRING(bdb_db_open) ": DB_CONFIG for suffix %s has changed.\n"
187 "Performing database recovery to activate new settings.\n",
188 be->be_suffix[0].bv_val, 0, 0 );
189 do_recover = DB_RECOVER;
195 Debug( LDAP_DEBUG_ANY,
196 LDAP_XSTRING(bdb_db_open) ": Warning - No DB_CONFIG file found "
197 "in directory %s: (%d)\n"
198 "Expect poor performance for suffix %s.\n",
199 bdb->bi_dbenv_home, errno, be->be_suffix[0].bv_val );
202 /* Always let slapcat run, regardless of environment state.
203 * This can be used to cause a cache flush after an unclean
206 if ( do_recover && ( slapMode & SLAP_TOOL_READONLY )) {
207 Debug( LDAP_DEBUG_ANY,
208 LDAP_XSTRING(bdb_db_open) ": Recovery skipped in read-only mode. "
209 "Run manual recovery if errors are encountered.\n",
215 /* An existing environment in Quick mode has nothing to recover. */
216 if ( alockt && do_recover ) {
217 Debug( LDAP_DEBUG_ANY,
218 LDAP_XSTRING(bdb_db_open) ": cannot recover, database must be reinitialized.\n",
224 rc = db_env_create( &bdb->bi_dbenv, 0 );
226 Debug( LDAP_DEBUG_ANY,
227 LDAP_XSTRING(bdb_db_open) ": db_env_create failed: %s (%d)\n",
228 db_strerror(rc), rc, 0 );
233 strcpy( path, bdb->bi_dbenv_home );
237 dbhome = bdb->bi_dbenv_home;
240 /* If existing environment is clean but doesn't support
241 * currently requested modes, remove it.
243 if ( !do_recover && ( alockt ^ quick )) {
245 rc = bdb->bi_dbenv->remove( bdb->bi_dbenv, dbhome, DB_FORCE );
247 Debug( LDAP_DEBUG_ANY,
248 LDAP_XSTRING(bdb_db_open) ": dbenv remove failed: %s (%d)\n",
249 db_strerror(rc), rc, 0 );
250 bdb->bi_dbenv = NULL;
253 rc = db_env_create( &bdb->bi_dbenv, 0 );
255 Debug( LDAP_DEBUG_ANY,
256 LDAP_XSTRING(bdb_db_open) ": db_env_create failed: %s (%d)\n",
257 db_strerror(rc), rc, 0 );
262 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
263 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
265 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
267 /* One long-lived TXN per thread, two TXNs per write op */
268 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
270 if( bdb->bi_dbenv_xflags != 0 ) {
271 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
272 bdb->bi_dbenv_xflags, 1);
274 Debug( LDAP_DEBUG_ANY,
275 LDAP_XSTRING(bdb_db_open) ": dbenv_set_flags failed: %s (%d)\n",
276 db_strerror(rc), rc, 0 );
281 #define BDB_TXN_FLAGS (DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN)
283 Debug( LDAP_DEBUG_TRACE,
284 LDAP_XSTRING(bdb_db_open) ": dbenv_open(%s)\n",
285 bdb->bi_dbenv_home, 0, 0);
287 flags = DB_INIT_MPOOL | DB_CREATE | DB_THREAD;
290 flags |= BDB_TXN_FLAGS;
292 /* If a key was set, use shared memory for the BDB environment */
293 if ( bdb->bi_shm_key ) {
294 bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
295 flags |= DB_SYSTEM_MEM;
297 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
298 flags | do_recover, bdb->bi_dbenv_mode );
301 /* Regular open faied, probably a missing shm environment.
302 * Start over, do a recovery.
304 if ( !do_recover && bdb->bi_shm_key ) {
305 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
306 rc = db_env_create( &bdb->bi_dbenv, 0 );
308 Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_db_open)
309 ": Shared memory env open failed, assuming stale env\n",
314 Debug( LDAP_DEBUG_ANY,
315 LDAP_XSTRING(bdb_db_open) ": Database cannot be %s, err %d. "
316 "Restore from backup!\n",
317 do_recover ? "recovered" : "opened", rc, 0);
321 if ( do_alock_recover && alock_recover (&bdb->bi_alock_info) != 0 ) {
322 Debug( LDAP_DEBUG_ANY,
323 LDAP_XSTRING(bdb_db_open) ": alock_recover failed\n",
329 #ifdef SLAP_ZONE_ALLOC
330 if ( bdb->bi_cache.c_maxsize ) {
331 bdb->bi_cache.c_zctx = slap_zn_mem_create(
332 SLAP_ZONE_INITSIZE, SLAP_ZONE_MAXSIZE,
333 SLAP_ZONE_DELTA, SLAP_ZONE_SIZE);
337 if ( bdb->bi_idl_cache_max_size ) {
338 bdb->bi_idl_tree = NULL;
339 bdb->bi_idl_cache_size = 0;
342 flags = DB_THREAD | bdb->bi_db_opflags;
344 #ifdef DB_AUTO_COMMIT
346 flags |= DB_AUTO_COMMIT;
349 bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
350 BDB_INDICES * sizeof(struct bdb_db_info *) );
352 /* open (and create) main database */
353 for( i = 0; bdbi_databases[i].name; i++ ) {
354 struct bdb_db_info *db;
356 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
358 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
360 Debug( LDAP_DEBUG_ANY,
361 LDAP_XSTRING(bdb_db_open) ": db_create(%s) failed: %s (%d)\n",
362 bdb->bi_dbenv_home, db_strerror(rc), rc );
366 if( i == BDB_ID2ENTRY ) {
367 if ( slapMode & SLAP_TOOL_MODE )
368 db->bdi_db->mpf->set_priority( db->bdi_db->mpf,
369 DB_PRIORITY_VERY_LOW );
371 rc = db->bdi_db->set_pagesize( db->bdi_db,
372 BDB_ID2ENTRY_PAGESIZE );
373 if ( slapMode & SLAP_TOOL_READMAIN ) {
379 rc = db->bdi_db->set_flags( db->bdi_db,
380 DB_DUP | DB_DUPSORT );
382 if ( slapMode & SLAP_TOOL_READONLY ) {
388 if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
394 rc = db->bdi_db->set_pagesize( db->bdi_db,
399 strcpy( path, bdbi_databases[i].file );
401 rc = DB_OPEN( db->bdi_db,
403 /* bdbi_databases[i].name, */ NULL,
404 bdbi_databases[i].type,
405 bdbi_databases[i].flags | flags,
406 bdb->bi_dbenv_mode );
408 rc = DB_OPEN( db->bdi_db,
409 bdbi_databases[i].file,
410 /* bdbi_databases[i].name, */ NULL,
411 bdbi_databases[i].type,
412 bdbi_databases[i].flags | flags,
413 bdb->bi_dbenv_mode );
417 char buf[SLAP_TEXT_BUFLEN];
419 snprintf( buf, sizeof(buf), "%s/%s",
420 bdb->bi_dbenv_home, bdbi_databases[i].file );
421 Debug( LDAP_DEBUG_ANY,
422 LDAP_XSTRING(bdb_db_open) ": db_open(%s) failed: %s (%d)\n",
423 buf, db_strerror(rc), rc );
424 db->bdi_db->close( db->bdi_db, 0 );
428 flags &= ~(DB_CREATE | DB_RDONLY);
429 db->bdi_name = bdbi_databases[i].name;
430 bdb->bi_databases[i] = db;
433 bdb->bi_databases[i] = NULL;
434 bdb->bi_ndatabases = i;
437 rc = bdb_last_id( be, NULL );
439 Debug( LDAP_DEBUG_ANY,
440 LDAP_XSTRING(bdb_db_open) ": last_id(%s) failed: %s (%d)\n",
441 bdb->bi_dbenv_home, db_strerror(rc), rc );
446 XLOCK_ID(bdb->bi_dbenv, &bdb->bi_cache.c_locker);
449 entry_prealloc( bdb->bi_cache.c_maxsize );
450 attr_prealloc( bdb->bi_cache.c_maxsize * 20 );
452 /* setup for empty-DN contexts */
453 if ( BER_BVISEMPTY( &be->be_nsuffix[0] )) {
454 rc = bdb_id2entry( be, NULL, 0, 0, &e );
459 ber_dupbv( &e->e_name, (struct berval *)&slap_empty_bv );
460 ber_dupbv( &e->e_nname, (struct berval *)&slap_empty_bv );
462 e->e_ocflags = SLAP_OC_GLUE|SLAP_OC__END;
463 e->e_private = &bdb->bi_cache.c_dntree;
464 bdb->bi_cache.c_dntree.bei_e = e;
467 rc = bdb_monitor_db_open( be );
472 bdb->bi_flags |= BDB_IS_OPEN;
482 bdb_db_close( BackendDB *be )
485 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
486 struct bdb_db_info *db;
487 bdb_idl_cache_entry_t *entry, *next_entry;
489 /* monitor handling */
490 (void)bdb_monitor_db_close( be );
493 Entry *e = bdb->bi_cache.c_dntree.bei_e;
495 bdb->bi_cache.c_dntree.bei_e = NULL;
497 bdb_entry_return( e );
501 bdb->bi_flags &= ~BDB_IS_OPEN;
503 ber_bvarray_free( bdb->bi_db_config );
504 bdb->bi_db_config = NULL;
506 while( bdb->bi_databases && bdb->bi_ndatabases-- ) {
507 db = bdb->bi_databases[bdb->bi_ndatabases];
508 rc = db->bdi_db->close( db->bdi_db, 0 );
509 /* Lower numbered names are not strdup'd */
510 if( bdb->bi_ndatabases >= BDB_NDB )
511 free( db->bdi_name );
514 free( bdb->bi_databases );
515 bdb->bi_databases = NULL;
517 bdb_cache_release_all (&bdb->bi_cache);
519 if ( bdb->bi_idl_cache_size ) {
520 avl_free( bdb->bi_idl_tree, NULL );
521 bdb->bi_idl_tree = NULL;
522 entry = bdb->bi_idl_lru_head;
524 next_entry = entry->idl_lru_next;
527 free( entry->kstr.bv_val );
530 } while ( entry != bdb->bi_idl_lru_head );
531 bdb->bi_idl_lru_head = bdb->bi_idl_lru_tail = NULL;
534 /* close db environment */
535 if( bdb->bi_dbenv ) {
536 /* Free cache locker if we enabled locking */
537 if ( !( slapMode & SLAP_TOOL_QUICK )) {
538 XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
539 bdb->bi_cache.c_locker = 0;
541 #ifdef BDB_REUSE_LOCKERS
542 bdb_locker_flush( bdb->bi_dbenv );
544 /* force a checkpoint, but not if we were ReadOnly,
545 * and not in Quick mode since there are no transactions there.
547 if ( !( slapMode & ( SLAP_TOOL_QUICK|SLAP_TOOL_READONLY ))) {
548 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
550 Debug( LDAP_DEBUG_ANY,
551 "bdb_db_close: txn_checkpoint failed: %s (%d)\n",
552 db_strerror(rc), rc, 0 );
556 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
557 bdb->bi_dbenv = NULL;
559 Debug( LDAP_DEBUG_ANY,
560 "bdb_db_close: close failed: %s (%d)\n",
561 db_strerror(rc), rc, 0 );
566 rc = alock_close( &bdb->bi_alock_info );
568 Debug( LDAP_DEBUG_ANY,
569 "bdb_db_close: alock_close failed\n", 0, 0, 0 );
577 bdb_db_destroy( BackendDB *be )
579 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
581 /* monitor handling */
582 (void)bdb_monitor_db_destroy( be );
584 if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
585 if( bdb->bi_db_config_path ) ch_free( bdb->bi_db_config_path );
587 bdb_attr_index_destroy( bdb );
589 ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
590 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_lru_mutex );
591 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_count_mutex );
592 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_eifree_mutex );
593 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
595 ldap_pvt_thread_mutex_destroy( &bdb->bi_modrdns_mutex );
597 ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
598 ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
599 ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
600 ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
603 be->be_private = NULL;
614 static char *controls[] = {
616 LDAP_CONTROL_MANAGEDSAIT,
618 LDAP_CONTROL_PAGEDRESULTS,
619 LDAP_CONTROL_PRE_READ,
620 LDAP_CONTROL_POST_READ,
621 LDAP_CONTROL_SUBENTRIES,
622 LDAP_CONTROL_X_PERMISSIVE_MODIFY,
624 LDAP_CONTROL_X_TXN_SPEC,
629 /* initialize the underlying database system */
630 Debug( LDAP_DEBUG_TRACE,
631 LDAP_XSTRING(bdb_back_initialize) ": initialize "
632 BDB_UCTYPE " backend\n", 0, 0, 0 );
635 SLAP_BFLAG_INCREMENT |
636 SLAP_BFLAG_SUBENTRIES |
638 SLAP_BFLAG_REFERRALS;
640 bi->bi_controls = controls;
642 { /* version check */
643 int major, minor, patch, ver;
644 char *version = db_version( &major, &minor, &patch );
648 /* All our stdio does an ASCII to EBCDIC conversion on
649 * the output. Strings from the BDB library are already
650 * in EBCDIC; we have to go back and forth...
652 strcpy( v2, version );
657 ver = (major << 24) | (minor << 16) | patch;
658 if( ver != DB_VERSION_FULL ) {
659 /* fail if a versions don't match */
660 Debug( LDAP_DEBUG_ANY,
661 LDAP_XSTRING(bdb_back_initialize) ": "
662 "BDB library version mismatch:"
663 " expected " DB_VERSION_STRING ","
664 " got %s\n", version, 0, 0 );
668 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_back_initialize)
669 ": %s\n", version, 0, 0 );
672 db_env_set_func_free( ber_memfree );
673 db_env_set_func_malloc( (db_malloc *)ber_memalloc );
674 db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
676 /* This is a no-op on a NO_THREAD build. Leave the default
677 * alone so that BDB will sleep on interprocess conflicts.
679 db_env_set_func_yield( ldap_pvt_thread_yield );
687 bi->bi_db_init = bdb_db_init;
688 bi->bi_db_config = config_generic_wrapper;
689 bi->bi_db_open = bdb_db_open;
690 bi->bi_db_close = bdb_db_close;
691 bi->bi_db_destroy = bdb_db_destroy;
693 bi->bi_op_add = bdb_add;
694 bi->bi_op_bind = bdb_bind;
695 bi->bi_op_compare = bdb_compare;
696 bi->bi_op_delete = bdb_delete;
697 bi->bi_op_modify = bdb_modify;
698 bi->bi_op_modrdn = bdb_modrdn;
699 bi->bi_op_search = bdb_search;
701 bi->bi_op_unbind = 0;
703 bi->bi_extended = bdb_extended;
705 bi->bi_chk_referrals = bdb_referrals;
706 bi->bi_operational = bdb_operational;
707 bi->bi_has_subordinates = bdb_hasSubordinates;
708 bi->bi_entry_release_rw = bdb_entry_release;
709 bi->bi_entry_get_rw = bdb_entry_get;
712 * hooks for slap tools
714 bi->bi_tool_entry_open = bdb_tool_entry_open;
715 bi->bi_tool_entry_close = bdb_tool_entry_close;
716 bi->bi_tool_entry_first = bdb_tool_entry_next;
717 bi->bi_tool_entry_next = bdb_tool_entry_next;
718 bi->bi_tool_entry_get = bdb_tool_entry_get;
719 bi->bi_tool_entry_put = bdb_tool_entry_put;
720 bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
721 bi->bi_tool_sync = 0;
722 bi->bi_tool_dn2id_get = bdb_tool_dn2id_get;
723 bi->bi_tool_id2entry_get = bdb_tool_id2entry_get;
724 bi->bi_tool_entry_modify = bdb_tool_entry_modify;
726 bi->bi_connection_init = 0;
727 bi->bi_connection_destroy = 0;
729 rc = bdb_back_init_cf( bi );
734 #if (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \
735 (SLAPD_HDB == SLAPD_MOD_DYNAMIC && defined(BDB_HIER))
737 /* conditionally define the init_module() function */
739 SLAP_BACKEND_INIT_MODULE( hdb )
740 #else /* !BDB_HIER */
741 SLAP_BACKEND_INIT_MODULE( bdb )
742 #endif /* !BDB_HIER */
744 #endif /* SLAPD_[BH]DB == SLAPD_MOD_DYNAMIC */