1 /* init.c - initialize bdb backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2000-2005 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_mutex );
73 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
74 ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
75 ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
76 ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
79 be->be_cf_ocs = be->bd_info->bi_cf_ocs;
85 bdb_db_open( BackendDB *be )
88 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
89 struct stat stat1, stat2;
91 char path[MAXPATHLEN];
93 int do_recover = 0, do_alock_recover = 0, open_env = 1, got_env = 0;
95 if ( be->be_suffix == NULL ) {
96 Debug( LDAP_DEBUG_ANY,
97 "bdb_db_open: need suffix\n",
102 Debug( LDAP_DEBUG_ARGS,
104 be->be_suffix[0].bv_val, 0, 0 );
106 #ifndef BDB_MULTIPLE_SUFFIXES
107 if ( be->be_suffix[1].bv_val ) {
108 Debug( LDAP_DEBUG_ANY,
109 "bdb_db_open: only one suffix allowed\n", 0, 0, 0 );
114 /* Check existence of dbenv_home. Any error means trouble */
115 rc = stat( bdb->bi_dbenv_home, &stat1 );
117 Debug( LDAP_DEBUG_ANY,
118 "bdb_db_open: Cannot access database directory %s (%d)\n",
119 bdb->bi_dbenv_home, errno, 0 );
123 /* Perform database use arbitration/recovery logic */
124 rc = alock_open( &bdb->bi_alock_info,
127 slapMode & SLAP_TOOL_READONLY ?
128 ALOCK_LOCKED : ALOCK_UNIQUE );
130 if( rc == ALOCK_RECOVER ) {
131 Debug( LDAP_DEBUG_ANY,
132 "bdb_db_open: unclean shutdown detected;"
133 " attempting recovery.\n",
135 do_alock_recover = 1;
137 } else if( rc == ALOCK_BUSY ) {
138 Debug( LDAP_DEBUG_ANY,
139 "bdb_db_open: database already in use\n",
142 } else if( rc != ALOCK_CLEAN ) {
143 Debug( LDAP_DEBUG_ANY,
144 "bdb_db_open: alock package is unstable\n",
150 * The DB_CONFIG file may have changed. If so, recover the
151 * database so that new settings are put into effect. Also
152 * note the possible absence of DB_CONFIG in the log.
154 if( stat( bdb->bi_db_config_path, &stat1 ) == 0 ) {
156 char *ptr = lutil_strcopy(path, bdb->bi_dbenv_home);
157 *ptr++ = LDAP_DIRSEP[0];
158 strcpy( ptr, "__db.001" );
159 if( stat( path, &stat2 ) == 0 ) {
160 if( stat2.st_mtime <= stat1.st_mtime ) {
161 Debug( LDAP_DEBUG_ANY,
162 "bdb_db_open: DB_CONFIG for suffix %s has changed.\n"
163 "Performing database recovery to activate new settings.\n",
164 be->be_suffix[0].bv_val, 0, 0 );
171 Debug( LDAP_DEBUG_ANY,
172 "bdb_db_open: Warning - No DB_CONFIG file found "
173 "in directory %s: (%d)\n"
174 "Expect poor performance for suffix %s.\n",
175 bdb->bi_dbenv_home, errno, be->be_suffix[0].bv_val );
178 rc = db_env_create( &bdb->bi_dbenv, 0 );
180 Debug( LDAP_DEBUG_ANY,
181 "bdb_db_open: db_env_create failed: %s (%d)\n",
182 db_strerror(rc), rc, 0 );
186 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
187 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
189 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
191 /* One long-lived TXN per thread, two TXNs per write op */
192 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
194 if( bdb->bi_dbenv_xflags != 0 ) {
195 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
196 bdb->bi_dbenv_xflags, 1);
198 Debug( LDAP_DEBUG_ANY,
199 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
200 db_strerror(rc), rc, 0 );
205 #define BDB_TXN_FLAGS (DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN)
208 strcpy( path, bdb->bi_dbenv_home );
212 dbhome = bdb->bi_dbenv_home;
215 Debug( LDAP_DEBUG_TRACE,
216 "bdb_db_open: dbenv_open(%s)\n",
217 bdb->bi_dbenv_home, 0, 0);
219 /* Check if there is a usable existing environment */
220 flags = DB_JOINENV | DB_THREAD;
222 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
223 flags, bdb->bi_dbenv_mode );
229 rc = bdb->bi_dbenv->get_open_flags( bdb->bi_dbenv, &flags );
231 int flag2 = flags & BDB_TXN_FLAGS;
233 /* In quick mode, none of these flags are allowed */
234 if ( slapMode & SLAP_TOOL_QUICK ) {
238 /* In normal mode, all of these flags are required */
239 if ( flag2 == BDB_TXN_FLAGS )
244 /* In Quick mode, we cannot Recover... */
245 if ( slapMode & SLAP_TOOL_QUICK ) {
246 /* If we need to recover but we had no TXNs, just fail */
247 if ( do_recover && flags_ok ) {
248 Debug( LDAP_DEBUG_ANY,
249 "bdb_db_open: Database cannot be recovered. "
250 "Restore from backup!\n", 0, 0, 0);
253 /* We need to recover, and we had TXN support before:
254 * Close this env, open a new one with recovery flags.
257 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
258 bdb->bi_dbenv = NULL;
259 rc = db_env_create( &bdb->bi_dbenv, 0 );
261 Debug( LDAP_DEBUG_ANY,
262 "bdb_db_open: db_env_create failed: %s (%d)\n",
263 db_strerror(rc), rc, 0 );
266 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv,
267 be->be_suffix[0].bv_val );
268 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
269 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
270 flags | DB_RECOVER, bdb->bi_dbenv_mode );
272 Debug( LDAP_DEBUG_ANY,
273 "bdb_db_open: recovery failed: %s (%d)\n",
274 db_strerror(rc), rc, 0 );
279 /* Prev environment had TXN support, get rid of it */
281 bdb->bi_dbenv->remove( bdb->bi_dbenv, dbhome, 0 );
282 bdb->bi_dbenv = NULL;
284 /* Normal TXN mode */
286 /* If we need to recover but we had no TXNs, just fail */
287 if ( do_recover && !flags_ok ) {
288 Debug( LDAP_DEBUG_ANY,
289 "bdb_db_open: Database cannot be recovered. "
290 "Restore from backup!\n", 0, 0, 0);
293 /* Prev environment had no TXN support, close it */
295 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
296 bdb->bi_dbenv = NULL;
301 if ( flags_ok && !do_recover ) {
302 /* This environment is fine, don't reopen it */
305 /* Create a new env that can take the desired settings */
306 rc = db_env_create( &bdb->bi_dbenv, 0 );
308 Debug( LDAP_DEBUG_ANY,
309 "bdb_db_open: db_env_create failed: %s (%d)\n",
310 db_strerror(rc), rc, 0 );
314 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
315 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
316 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
318 /* One long-lived TXN per thread, two TXNs per write op */
319 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
321 if( bdb->bi_dbenv_xflags != 0 ) {
322 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
323 bdb->bi_dbenv_xflags, 1);
325 Debug( LDAP_DEBUG_ANY,
326 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
327 db_strerror(rc), rc, 0 );
334 /* If we need to recover but there was no existing environment,
335 * then we assume that someone has already manually recovered using
336 * db_recover. Just ignore it.
338 if ( do_recover && !got_env ) {
340 Debug( LDAP_DEBUG_TRACE,
341 "bdb_db_open: Recovery needed but environment is missing - "
342 "assuming recovery was done manually...\n", 0, 0, 0 );
346 flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE;
347 if ( !( slapMode & SLAP_TOOL_QUICK ))
348 flags |= BDB_TXN_FLAGS;
353 /* If a key was set, use shared memory for the BDB environment */
354 if ( bdb->bi_shm_key ) {
355 bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
356 flags |= DB_SYSTEM_MEM;
359 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
360 flags, bdb->bi_dbenv_mode );
362 Debug( LDAP_DEBUG_ANY,
363 "bdb_db_open: dbenv_open failed: %s (%d)\n",
364 db_strerror(rc), rc, 0 );
369 if ( do_alock_recover && alock_recover (&bdb->bi_alock_info) != 0 ) {
370 Debug( LDAP_DEBUG_ANY,
371 "bdb_db_open: alock_recover failed\n",
376 #ifdef SLAP_ZONE_ALLOC
377 if ( bdb->bi_cache.c_maxsize ) {
378 bdb->bi_cache.c_zctx = slap_zn_mem_create(
386 if ( bdb->bi_idl_cache_max_size ) {
387 bdb->bi_idl_tree = NULL;
388 bdb->bi_idl_cache_size = 0;
391 flags = DB_THREAD | bdb->bi_db_opflags;
393 #ifdef DB_AUTO_COMMIT
394 if ( !( slapMode & SLAP_TOOL_QUICK ))
395 flags |= DB_AUTO_COMMIT;
398 bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
399 BDB_INDICES * sizeof(struct bdb_db_info *) );
401 /* open (and create) main database */
402 for( i = 0; bdbi_databases[i].name; i++ ) {
403 struct bdb_db_info *db;
405 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
407 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
409 Debug( LDAP_DEBUG_ANY,
410 "bdb_db_open: db_create(%s) failed: %s (%d)\n",
411 bdb->bi_dbenv_home, db_strerror(rc), rc );
415 if( i == BDB_ID2ENTRY ) {
416 rc = db->bdi_db->set_pagesize( db->bdi_db,
417 BDB_ID2ENTRY_PAGESIZE );
418 if ( slapMode & SLAP_TOOL_READMAIN ) {
424 rc = db->bdi_db->set_flags( db->bdi_db,
425 DB_DUP | DB_DUPSORT );
427 if ( slapMode & SLAP_TOOL_READONLY ) {
433 if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
439 rc = db->bdi_db->set_pagesize( db->bdi_db,
444 strcpy( path, bdbi_databases[i].file );
446 rc = DB_OPEN( db->bdi_db,
448 /* bdbi_databases[i].name, */ NULL,
449 bdbi_databases[i].type,
450 bdbi_databases[i].flags | flags,
451 bdb->bi_dbenv_mode );
453 rc = DB_OPEN( db->bdi_db,
454 bdbi_databases[i].file,
455 /* bdbi_databases[i].name, */ NULL,
456 bdbi_databases[i].type,
457 bdbi_databases[i].flags | flags,
458 bdb->bi_dbenv_mode );
462 char buf[SLAP_TEXT_BUFLEN];
464 snprintf( buf, sizeof(buf), "%s/%s",
465 bdb->bi_dbenv_home, bdbi_databases[i].file );
466 Debug( LDAP_DEBUG_ANY,
467 "bdb_db_open: db_open(%s) failed: %s (%d)\n",
468 buf, db_strerror(rc), rc );
473 if( i == BDB_ID2ENTRY && ( slapMode & SLAP_TOOL_MODE )) {
474 db->bdi_db->mpf->set_priority( db->bdi_db->mpf,
475 DB_PRIORITY_VERY_LOW );
479 flags &= ~(DB_CREATE | DB_RDONLY);
480 db->bdi_name = bdbi_databases[i].name;
481 bdb->bi_databases[i] = db;
484 bdb->bi_databases[i] = NULL;
485 bdb->bi_ndatabases = i;
488 rc = bdb_last_id( be, NULL );
490 Debug( LDAP_DEBUG_ANY,
491 "bdb_db_open: last_id(%s) failed: %s (%d)\n",
492 bdb->bi_dbenv_home, db_strerror(rc), rc );
496 if ( !( slapMode & SLAP_TOOL_QUICK )) {
497 XLOCK_ID(bdb->bi_dbenv, &bdb->bi_cache.c_locker);
500 bdb->bi_flags |= BDB_IS_OPEN;
506 bdb_db_close( BackendDB *be )
509 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
510 struct bdb_db_info *db;
511 bdb_idl_cache_entry_t *entry, *next_entry;
513 /* backend_shutdown closes everything, even if not all were opened */
514 if ( !( bdb->bi_flags & BDB_IS_OPEN ))
517 bdb->bi_flags &= ~BDB_IS_OPEN;
519 ber_bvarray_free( bdb->bi_db_config );
520 bdb->bi_db_config = NULL;
522 while( bdb->bi_databases && bdb->bi_ndatabases-- ) {
523 db = bdb->bi_databases[bdb->bi_ndatabases];
524 rc = db->bdi_db->close( db->bdi_db, 0 );
525 /* Lower numbered names are not strdup'd */
526 if( bdb->bi_ndatabases >= BDB_NDB )
527 free( db->bdi_name );
530 free( bdb->bi_databases );
531 bdb->bi_databases = NULL;
533 bdb_cache_release_all (&bdb->bi_cache);
535 if ( bdb->bi_idl_cache_max_size ) {
536 ldap_pvt_thread_rdwr_wlock ( &bdb->bi_idl_tree_rwlock );
537 avl_free( bdb->bi_idl_tree, NULL );
538 bdb->bi_idl_tree = NULL;
539 entry = bdb->bi_idl_lru_head;
540 while ( entry != NULL ) {
541 next_entry = entry->idl_lru_next;
544 free( entry->kstr.bv_val );
548 bdb->bi_idl_lru_head = bdb->bi_idl_lru_tail = NULL;
549 ldap_pvt_thread_rdwr_wunlock ( &bdb->bi_idl_tree_rwlock );
552 if ( !( slapMode & SLAP_TOOL_QUICK ) && bdb->bi_dbenv ) {
553 XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
554 bdb->bi_cache.c_locker = 0;
557 /* close db environment */
558 if( bdb->bi_dbenv ) {
559 /* force a checkpoint, but not if we were ReadOnly,
560 * and not in Quick mode since there are no transactions there.
562 if ( !( slapMode & ( SLAP_TOOL_QUICK|SLAP_TOOL_READONLY ))) {
563 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
565 Debug( LDAP_DEBUG_ANY,
566 "bdb_db_close: txn_checkpoint failed: %s (%d)\n",
567 db_strerror(rc), rc, 0 );
571 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
572 bdb->bi_dbenv = NULL;
574 Debug( LDAP_DEBUG_ANY,
575 "bdb_db_close: close failed: %s (%d)\n",
576 db_strerror(rc), rc, 0 );
581 rc = alock_close( &bdb->bi_alock_info );
583 Debug( LDAP_DEBUG_ANY,
584 "bdb_db_close: alock_close failed\n", 0, 0, 0 );
592 bdb_db_destroy( BackendDB *be )
594 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
596 if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
597 if( bdb->bi_db_config_path ) ch_free( bdb->bi_db_config_path );
599 bdb_attr_index_destroy( bdb->bi_attrs );
601 ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
602 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
603 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
605 ldap_pvt_thread_mutex_destroy( &bdb->bi_modrdns_mutex );
607 ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
608 ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
609 ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
610 ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
613 be->be_private = NULL;
624 static char *controls[] = {
626 LDAP_CONTROL_MANAGEDSAIT,
628 LDAP_CONTROL_PAGEDRESULTS,
629 #ifdef LDAP_CONTROL_SUBENTRIES
630 LDAP_CONTROL_SUBENTRIES,
632 #ifdef LDAP_CONTROL_X_PERMISSIVE_MODIFY
633 LDAP_CONTROL_X_PERMISSIVE_MODIFY,
638 /* initialize the underlying database system */
639 Debug( LDAP_DEBUG_TRACE,
640 LDAP_XSTRING(bdb_back_initialize) ": initialize "
641 BDB_UCTYPE " backend\n", 0, 0, 0 );
644 SLAP_BFLAG_INCREMENT |
645 #ifdef BDB_SUBENTRIES
646 SLAP_BFLAG_SUBENTRIES |
649 SLAP_BFLAG_REFERRALS;
651 bi->bi_controls = controls;
653 { /* version check */
654 int major, minor, patch, ver;
655 char *version = db_version( &major, &minor, &patch );
659 /* All our stdio does an ASCII to EBCDIC conversion on
660 * the output. Strings from the BDB library are already
661 * in EBCDIC; we have to go back and forth...
663 strcpy( v2, version );
668 ver = (major << 24) | (minor << 16) | patch;
669 if( ver != DB_VERSION_FULL ) {
670 /* fail if a versions don't match */
671 Debug( LDAP_DEBUG_ANY,
672 LDAP_XSTRING(bdb_back_initialize) ": "
673 "BDB library version mismatch:"
674 " expected " DB_VERSION_STRING ","
675 " got %s\n", version, 0, 0 );
679 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_back_initialize)
680 ": %s\n", version, 0, 0 );
683 db_env_set_func_free( ber_memfree );
684 db_env_set_func_malloc( (db_malloc *)ber_memalloc );
685 db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
687 /* This is a no-op on a NO_THREAD build. Leave the default
688 * alone so that BDB will sleep on interprocess conflicts.
690 db_env_set_func_yield( ldap_pvt_thread_yield );
698 bi->bi_db_init = bdb_db_init;
699 bi->bi_db_config = config_generic_wrapper;
700 bi->bi_db_open = bdb_db_open;
701 bi->bi_db_close = bdb_db_close;
702 bi->bi_db_destroy = bdb_db_destroy;
704 bi->bi_op_add = bdb_add;
705 bi->bi_op_bind = bdb_bind;
706 bi->bi_op_compare = bdb_compare;
707 bi->bi_op_delete = bdb_delete;
708 bi->bi_op_modify = bdb_modify;
709 bi->bi_op_modrdn = bdb_modrdn;
710 bi->bi_op_search = bdb_search;
712 bi->bi_op_unbind = 0;
714 bi->bi_extended = bdb_extended;
716 bi->bi_chk_referrals = bdb_referrals;
717 bi->bi_operational = bdb_operational;
718 bi->bi_has_subordinates = bdb_hasSubordinates;
719 bi->bi_entry_release_rw = bdb_entry_release;
720 bi->bi_entry_get_rw = bdb_entry_get;
723 * hooks for slap tools
725 bi->bi_tool_entry_open = bdb_tool_entry_open;
726 bi->bi_tool_entry_close = bdb_tool_entry_close;
727 bi->bi_tool_entry_first = bdb_tool_entry_next;
728 bi->bi_tool_entry_next = bdb_tool_entry_next;
729 bi->bi_tool_entry_get = bdb_tool_entry_get;
730 bi->bi_tool_entry_put = bdb_tool_entry_put;
731 bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
732 bi->bi_tool_sync = 0;
733 bi->bi_tool_dn2id_get = bdb_tool_dn2id_get;
734 bi->bi_tool_id2entry_get = bdb_tool_id2entry_get;
735 bi->bi_tool_entry_modify = bdb_tool_entry_modify;
737 bi->bi_connection_init = 0;
738 bi->bi_connection_destroy = 0;
740 rc = bdb_back_init_cf( bi );
745 #if (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \
746 (SLAPD_HDB == SLAPD_MOD_DYNAMIC && defined(BDB_HIER))
748 /* conditionally define the init_module() function */
750 SLAP_BACKEND_INIT_MODULE( hdb )
751 #else /* !BDB_HIER */
752 SLAP_BACKEND_INIT_MODULE( bdb )
753 #endif /* !BDB_HIER */
755 #endif /* SLAPD_[BH]DB == SLAPD_MOD_DYNAMIC */