]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/init.c
Delete dubious use of be_syncinfo - only the consumer can write the
[openldap] / servers / slapd / back-bdb / init.c
1 /* init.c - initialize bdb backend */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2000-2005 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
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>.
15  */
16
17 #include "portable.h"
18
19 #include <stdio.h>
20 #include <ac/string.h>
21 #include <ac/unistd.h>
22 #include <ac/stdlib.h>
23
24 #include "back-bdb.h"
25 #include <lutil.h>
26 #include <ldap_rq.h>
27
28 static const struct bdbi_database {
29         char *file;
30         char *name;
31         int type;
32         int flags;
33 } bdbi_databases[] = {
34         { "id2entry" BDB_SUFFIX, "id2entry", DB_BTREE, 0 },
35         { "dn2id" BDB_SUFFIX, "dn2id", DB_BTREE, 0 },
36         { NULL, NULL, 0, 0 }
37 };
38
39 struct berval bdb_uuid = BER_BVNULL;
40
41 typedef void * db_malloc(size_t);
42 typedef void * db_realloc(void *, size_t);
43
44 #if 0
45 static int
46 bdb_open( BackendInfo *bi )
47 {
48         return 0;
49 }
50
51 static int
52 bdb_destroy( BackendInfo *bi )
53 {
54         return 0;
55 }
56
57 static int
58 bdb_close( BackendInfo *bi )
59 {
60         /* terminate the underlying database system */
61         return 0;
62 }
63 #endif
64
65 static int
66 bdb_db_init( BackendDB *be )
67 {
68         struct bdb_info *bdb;
69
70         Debug( LDAP_DEBUG_ANY,
71                 LDAP_XSTRING(bdb_db_init) ": Initializing "
72                 BDB_UCTYPE " database\n", 0, 0, 0 );
73
74         /* allocate backend-database-specific stuff */
75         bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
76
77         /* DBEnv parameters */
78         bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR );
79         bdb->bi_dbenv_xflags = 0;
80         bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
81
82         bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
83
84         bdb->bi_lock_detect = DB_LOCK_DEFAULT;
85         bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
86         bdb->bi_search_stack = NULL;
87
88         ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
89         ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
90         ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
91         ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
92         ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
93
94         be->be_private = bdb;
95
96         return 0;
97 }
98
99 static void *
100 bdb_checkpoint( void *ctx, void *arg )
101 {
102         struct re_s *rtask = arg;
103         struct bdb_info *bdb = rtask->arg;
104         
105         TXN_CHECKPOINT( bdb->bi_dbenv, bdb->bi_txn_cp_kbyte,
106                 bdb->bi_txn_cp_min, 0 );
107         return NULL;
108 }
109
110 static int
111 bdb_db_open( BackendDB *be )
112 {
113         int rc, i;
114         struct bdb_info *bdb = (struct bdb_info *) be->be_private;
115         u_int32_t flags;
116 #ifdef HAVE_EBCDIC
117         char path[MAXPATHLEN];
118 #endif
119
120         Debug( LDAP_DEBUG_ARGS,
121                 "bdb_db_open: %s\n",
122                 be->be_suffix[0].bv_val, 0, 0 );
123
124 #ifndef BDB_MULTIPLE_SUFFIXES
125         if ( be->be_suffix[1].bv_val ) {
126         Debug( LDAP_DEBUG_ANY,
127                 "bdb_db_open: only one suffix allowed\n", 0, 0, 0 );
128                 return -1;
129         }
130 #endif
131         /* we should check existance of dbenv_home and db_directory */
132
133         rc = db_env_create( &bdb->bi_dbenv, 0 );
134         if( rc != 0 ) {
135                 Debug( LDAP_DEBUG_ANY,
136                         "bdb_db_open: db_env_create failed: %s (%d)\n",
137                         db_strerror(rc), rc, 0 );
138                 return rc;
139         }
140
141         flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE
142                 | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN;
143         
144 #if 0
145         /* Never do automatic recovery, must perform it manually.
146          * Otherwise restarting with gentlehup will corrupt the
147          * database.
148          */
149         if( !(slapMode & SLAP_TOOL_MODE) ) flags |= DB_RECOVER;
150 #endif
151
152         /* If a key was set, use shared memory for the BDB environment */
153         if ( bdb->bi_shm_key ) {
154                 bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
155                 flags |= DB_SYSTEM_MEM;
156         }
157
158         bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
159         bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
160         bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
161
162         /* One long-lived TXN per thread, two TXNs per write op */
163         bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
164
165 #ifdef SLAP_ZONE_ALLOC
166         if ( bdb->bi_cache.c_maxsize ) {
167                 bdb->bi_cache.c_zctx = slap_zn_mem_create(
168                                                                 SLAP_ZONE_INITSIZE,
169                                                                 SLAP_ZONE_MAXSIZE,
170                                                                 SLAP_ZONE_DELTA,
171                                                                 SLAP_ZONE_SIZE);
172         }
173 #endif
174
175         if ( bdb->bi_idl_cache_max_size ) {
176                 bdb->bi_idl_tree = NULL;
177                 ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
178                 ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
179                 bdb->bi_idl_cache_size = 0;
180         }
181
182 #ifdef BDB_SUBDIRS
183         {
184                 char dir[MAXPATHLEN], *ptr;
185                 
186                 if (bdb->bi_dbenv_home[0] == '.') {
187                         /* If home is a relative path, relative subdirs
188                          * are just concat'd by BDB. We don't want the
189                          * path to be concat'd twice, e.g.
190                          * ./test-db/./test-db/tmp
191                          */
192                         ptr = dir;
193                 } else {
194                         ptr = lutil_strcopy( dir, bdb->bi_dbenv_home );
195                         *ptr++ = LDAP_DIRSEP[0];
196 #ifdef HAVE_EBCDIC
197                         __atoe( dir );
198 #endif
199                 }
200
201                 strcpy( ptr, BDB_TMP_SUBDIR );
202 #ifdef HAVE_EBCDIC
203                 __atoe( ptr );
204 #endif
205                 rc = bdb->bi_dbenv->set_tmp_dir( bdb->bi_dbenv, dir );
206                 if( rc != 0 ) {
207                         Debug( LDAP_DEBUG_ANY,
208                                 "bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n",
209                                 dir, db_strerror(rc), rc );
210                         return rc;
211                 }
212
213                 strcpy( ptr, BDB_LG_SUBDIR );
214 #ifdef HAVE_EBCDIC
215                 __atoe( ptr );
216 #endif
217                 rc = bdb->bi_dbenv->set_lg_dir( bdb->bi_dbenv, dir );
218                 if( rc != 0 ) {
219                         Debug( LDAP_DEBUG_ANY,
220                                 "bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n",
221                                 dir, db_strerror(rc), rc );
222                         return rc;
223                 }
224
225                 strcpy( ptr, BDB_DATA_SUBDIR );
226 #ifdef HAVE_EBCDIC
227                 __atoe( ptr );
228 #endif
229                 rc = bdb->bi_dbenv->set_data_dir( bdb->bi_dbenv, dir );
230                 if( rc != 0 ) {
231                         Debug( LDAP_DEBUG_ANY,
232                                 "bdb_db_open: set_data_dir(%s) failed: %s (%d)\n",
233                                 dir, db_strerror(rc), rc );
234                         return rc;
235                 }
236         }
237 #endif
238
239         if( bdb->bi_dbenv_xflags != 0 ) {
240                 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
241                         bdb->bi_dbenv_xflags, 1);
242                 if( rc != 0 ) {
243                         Debug( LDAP_DEBUG_ANY,
244                                 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
245                                 db_strerror(rc), rc, 0 );
246                         return rc;
247                 }
248         }
249
250         Debug( LDAP_DEBUG_TRACE,
251                 "bdb_db_open: dbenv_open(%s)\n",
252                 bdb->bi_dbenv_home, 0, 0);
253
254 #ifdef HAVE_EBCDIC
255         strcpy( path, bdb->bi_dbenv_home );
256         __atoe( path );
257         rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
258                 path,
259                 flags,
260                 bdb->bi_dbenv_mode );
261 #else
262         rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
263                 bdb->bi_dbenv_home,
264                 flags,
265                 bdb->bi_dbenv_mode );
266 #endif
267         if( rc != 0 ) {
268                 Debug( LDAP_DEBUG_ANY,
269                         "bdb_db_open: dbenv_open failed: %s (%d)\n",
270                         db_strerror(rc), rc, 0 );
271                 return rc;
272         }
273
274         flags = DB_THREAD | bdb->bi_db_opflags;
275
276         bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
277                 BDB_INDICES * sizeof(struct bdb_db_info *) );
278
279         /* open (and create) main database */
280         for( i = 0; bdbi_databases[i].name; i++ ) {
281                 struct bdb_db_info *db;
282
283                 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
284
285                 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
286                 if( rc != 0 ) {
287                         Debug( LDAP_DEBUG_ANY,
288                                 "bdb_db_open: db_create(%s) failed: %s (%d)\n",
289                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
290                         return rc;
291                 }
292
293                 if( i == BDB_ID2ENTRY ) {
294                         rc = db->bdi_db->set_pagesize( db->bdi_db,
295                                 BDB_ID2ENTRY_PAGESIZE );
296                         if ( slapMode & SLAP_TOOL_READMAIN ) {
297                                 flags |= DB_RDONLY;
298                         } else {
299                                 flags |= DB_CREATE;
300                         }
301                 } else {
302                         rc = db->bdi_db->set_flags( db->bdi_db, 
303                                 DB_DUP | DB_DUPSORT );
304 #ifndef BDB_HIER
305                         if ( slapMode & SLAP_TOOL_READONLY ) {
306                                 flags |= DB_RDONLY;
307                         } else {
308                                 flags |= DB_CREATE;
309                         }
310 #else
311                         if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
312                                 flags |= DB_RDONLY;
313                         } else {
314                                 flags |= DB_CREATE;
315                         }
316 #endif
317                         rc = db->bdi_db->set_pagesize( db->bdi_db,
318                                 BDB_PAGESIZE );
319                 }
320
321 #ifdef HAVE_EBCDIC
322                 strcpy( path, bdbi_databases[i].file );
323                 __atoe( path );
324                 rc = DB_OPEN( db->bdi_db,
325                         path,
326                 /*      bdbi_databases[i].name, */ NULL,
327                         bdbi_databases[i].type,
328                         bdbi_databases[i].flags | flags,
329                         bdb->bi_dbenv_mode );
330 #else
331                 rc = DB_OPEN( db->bdi_db,
332                         bdbi_databases[i].file,
333                 /*      bdbi_databases[i].name, */ NULL,
334                         bdbi_databases[i].type,
335                         bdbi_databases[i].flags | flags,
336                         bdb->bi_dbenv_mode );
337 #endif
338
339                 if ( rc != 0 ) {
340                         char    buf[SLAP_TEXT_BUFLEN];
341
342                         snprintf( buf, sizeof(buf), "%s/%s", 
343                                 bdb->bi_dbenv_home, bdbi_databases[i].file );
344                         Debug( LDAP_DEBUG_ANY,
345                                 "bdb_db_open: db_open(%s) failed: %s (%d)\n",
346                                 buf, db_strerror(rc), rc );
347                         return rc;
348                 }
349
350                 flags &= ~(DB_CREATE | DB_RDONLY);
351                 db->bdi_name = bdbi_databases[i].name;
352                 bdb->bi_databases[i] = db;
353         }
354
355         bdb->bi_databases[i] = NULL;
356         bdb->bi_ndatabases = i;
357
358         /* get nextid */
359         rc = bdb_last_id( be, NULL );
360         if( rc != 0 ) {
361                 Debug( LDAP_DEBUG_ANY,
362                         "bdb_db_open: last_id(%s) failed: %s (%d)\n",
363                         bdb->bi_dbenv_home, db_strerror(rc), rc );
364                 return rc;
365         }
366
367         XLOCK_ID(bdb->bi_dbenv, &bdb->bi_cache.c_locker);
368
369         /* If we're in server mode and time-based checkpointing is enabled,
370          * submit a task to perform periodic checkpoints.
371          */
372         if ( slapMode & SLAP_SERVER_MODE && bdb->bi_txn_cp &&
373                 bdb->bi_txn_cp_min )  {
374                 ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
375                 ldap_pvt_runqueue_insert( &slapd_rq, bdb->bi_txn_cp_min*60,
376                         bdb_checkpoint, bdb );
377                 ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
378         }
379
380         /* <insert> open (and create) index databases */
381         return 0;
382 }
383
384 static int
385 bdb_db_close( BackendDB *be )
386 {
387         int rc;
388         struct bdb_info *bdb = (struct bdb_info *) be->be_private;
389         struct bdb_db_info *db;
390         bdb_idl_cache_entry_t *entry, *next_entry;
391
392         while( bdb->bi_ndatabases-- ) {
393                 db = bdb->bi_databases[bdb->bi_ndatabases];
394                 rc = db->bdi_db->close( db->bdi_db, 0 );
395                 /* Lower numbered names are not strdup'd */
396                 if( bdb->bi_ndatabases >= BDB_NDB )
397                         free( db->bdi_name );
398                 free( db );
399         }
400         free( bdb->bi_databases );
401         bdb_attr_index_destroy( bdb->bi_attrs );
402
403         bdb_cache_release_all (&bdb->bi_cache);
404
405         if ( bdb->bi_idl_cache_max_size ) {
406                 ldap_pvt_thread_rdwr_wlock ( &bdb->bi_idl_tree_rwlock );
407                 avl_free( bdb->bi_idl_tree, NULL );
408                 entry = bdb->bi_idl_lru_head;
409                 while ( entry != NULL ) {
410                         next_entry = entry->idl_lru_next;
411                         if ( entry->idl )
412                                 free( entry->idl );
413                         free( entry->kstr.bv_val );
414                         free( entry );
415                         entry = next_entry;
416                 }
417                 ldap_pvt_thread_rdwr_wunlock ( &bdb->bi_idl_tree_rwlock );
418         }
419
420         XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
421
422         return 0;
423 }
424
425 static int
426 bdb_db_destroy( BackendDB *be )
427 {
428         int rc;
429         struct bdb_info *bdb = (struct bdb_info *) be->be_private;
430         Operation *ps = NULL;
431         Operation *psn = NULL;
432         void *saved_tmpmemctx = NULL;
433
434         /* close db environment */
435         if( bdb->bi_dbenv ) {
436                 /* force a checkpoint */
437                 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
438                 if( rc != 0 ) {
439                         Debug( LDAP_DEBUG_ANY,
440                                 "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
441                                 db_strerror(rc), rc, 0 );
442                 }
443
444                 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
445                 bdb->bi_dbenv = NULL;
446                 if( rc != 0 ) {
447                         Debug( LDAP_DEBUG_ANY,
448                                 "bdb_db_destroy: close failed: %s (%d)\n",
449                                 db_strerror(rc), rc, 0 );
450                         return rc;
451                 }
452         }
453
454         if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
455
456         ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
457         ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
458         ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
459         ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
460         ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
461         if ( bdb->bi_idl_cache_max_size ) {
462                 ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
463                 ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
464         }
465
466         ch_free( bdb );
467         be->be_private = NULL;
468
469         return 0;
470 }
471
472 int
473 bdb_back_initialize(
474         BackendInfo     *bi )
475 {
476         static char *controls[] = {
477                 LDAP_CONTROL_ASSERT,
478                 LDAP_CONTROL_MANAGEDSAIT,
479                 LDAP_CONTROL_NOOP,
480                 LDAP_CONTROL_PAGEDRESULTS,
481 #ifdef LDAP_CONTROL_SUBENTRIES
482                 LDAP_CONTROL_SUBENTRIES,
483 #endif
484                 LDAP_CONTROL_VALUESRETURNFILTER,
485 #ifdef LDAP_CONTROL_X_PERMISSIVE_MODIFY
486                 LDAP_CONTROL_X_PERMISSIVE_MODIFY,
487 #endif
488                 NULL
489         };
490
491         /* initialize the underlying database system */
492         Debug( LDAP_DEBUG_TRACE,
493                 LDAP_XSTRING(bdb_back_initialize) ": initialize " 
494                 BDB_UCTYPE " backend\n", 0, 0, 0 );
495
496         bi->bi_flags |=
497                 SLAP_BFLAG_INCREMENT |
498 #ifdef BDB_SUBENTRIES
499                 SLAP_BFLAG_SUBENTRIES |
500 #endif
501                 SLAP_BFLAG_ALIASES |
502                 SLAP_BFLAG_REFERRALS;
503
504         bi->bi_controls = controls;
505
506         {       /* version check */
507                 int major, minor, patch, ver;
508                 char *version = db_version( &major, &minor, &patch );
509 #ifdef HAVE_EBCDIC
510                 char v2[1024];
511
512                 /* All our stdio does an ASCII to EBCDIC conversion on
513                  * the output. Strings from the BDB library are already
514                  * in EBCDIC; we have to go back and forth...
515                  */
516                 strcpy( v2, version );
517                 __etoa( v2 );
518                 version = v2;
519 #endif
520
521                 ver = (major << 24) | (minor << 16) | patch;
522                 if( ver < DB_VERSION_FULL )
523                 {
524                         Debug( LDAP_DEBUG_ANY,
525                                 LDAP_XSTRING(bdb_back_initialize) ": "
526                                 "BDB library version mismatch:"
527                                 " expected " DB_VERSION_STRING ","
528                                 " got %s\n", version, 0, 0 );
529                 }
530
531                 Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_back_initialize)
532                         ": %s\n", version, 0, 0 );
533         }
534
535         db_env_set_func_free( ber_memfree );
536         db_env_set_func_malloc( (db_malloc *)ber_memalloc );
537         db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
538 #ifndef NO_THREAD
539         /* This is a no-op on a NO_THREAD build. Leave the default
540          * alone so that BDB will sleep on interprocess conflicts.
541          */
542         db_env_set_func_yield( ldap_pvt_thread_yield );
543 #endif
544
545         {
546                 static char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
547
548                 bdb_uuid.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ));
549                 bdb_uuid.bv_val = uuidbuf;
550         }
551
552         bi->bi_open = 0;
553         bi->bi_close = 0;
554         bi->bi_config = 0;
555         bi->bi_destroy = 0;
556
557         bi->bi_db_init = bdb_db_init;
558         bi->bi_db_config = bdb_db_config;
559         bi->bi_db_open = bdb_db_open;
560         bi->bi_db_close = bdb_db_close;
561         bi->bi_db_destroy = bdb_db_destroy;
562
563         bi->bi_op_add = bdb_add;
564         bi->bi_op_bind = bdb_bind;
565         bi->bi_op_compare = bdb_compare;
566         bi->bi_op_delete = bdb_delete;
567         bi->bi_op_modify = bdb_modify;
568         bi->bi_op_modrdn = bdb_modrdn;
569         bi->bi_op_search = bdb_search;
570
571         bi->bi_op_unbind = 0;
572
573 #if 0   /* DELETE ME */
574         bi->bi_op_abandon = bdb_abandon;
575         bi->bi_op_cancel = bdb_cancel;
576 #endif
577
578         bi->bi_extended = bdb_extended;
579
580         bi->bi_chk_referrals = bdb_referrals;
581         bi->bi_operational = bdb_operational;
582         bi->bi_has_subordinates = bdb_hasSubordinates;
583         bi->bi_entry_release_rw = bdb_entry_release;
584         bi->bi_entry_get_rw = bdb_entry_get;
585
586         /*
587          * hooks for slap tools
588          */
589         bi->bi_tool_entry_open = bdb_tool_entry_open;
590         bi->bi_tool_entry_close = bdb_tool_entry_close;
591         bi->bi_tool_entry_first = bdb_tool_entry_next;
592         bi->bi_tool_entry_next = bdb_tool_entry_next;
593         bi->bi_tool_entry_get = bdb_tool_entry_get;
594         bi->bi_tool_entry_put = bdb_tool_entry_put;
595         bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
596         bi->bi_tool_sync = 0;
597         bi->bi_tool_dn2id_get = bdb_tool_dn2id_get;
598         bi->bi_tool_id2entry_get = bdb_tool_id2entry_get;
599         bi->bi_tool_entry_modify = bdb_tool_entry_modify;
600
601         bi->bi_connection_init = 0;
602         bi->bi_connection_destroy = 0;
603
604         return 0;
605 }
606
607 #if     (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \
608         (SLAPD_HDB == SLAPD_MOD_DYNAMIC && defined(BDB_HIER))
609
610 /* conditionally define the init_module() function */
611 #ifdef BDB_HIER
612 SLAP_BACKEND_INIT_MODULE( hdb )
613 #else /* !BDB_HIER */
614 SLAP_BACKEND_INIT_MODULE( bdb )
615 #endif /* !BDB_HIER */
616
617 #endif /* SLAPD_[BH]DB == SLAPD_MOD_DYNAMIC */
618