]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/init.c
update malloc handlers
[openldap] / servers / slapd / back-bdb / init.c
1 /* init.c - initialize bdb backend */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
5  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6  */
7
8 #include "portable.h"
9
10 #include <stdio.h>
11 #include <ac/string.h>
12 #include <ac/unistd.h>
13 #include <ac/stdlib.h>
14
15 #include <lutil.h>
16
17 #include "back-bdb.h"
18 #include "external.h"
19
20 static struct bdbi_database {
21         char *file;
22         char *name;
23         int type;
24         int flags;
25 } bdbi_databases[] = {
26         { "id2entry" BDB_SUFFIX, "id2entry", DB_BTREE, 0 },
27 #ifdef BDB_HIER
28         { "id2parent" BDB_SUFFIX, "id2parent", DB_BTREE, 0 },
29 #else
30         { "dn2id" BDB_SUFFIX, "dn2id", DB_BTREE, 0 },
31 #endif
32         { NULL, NULL, 0, 0 }
33 };
34
35 struct berval bdb_uuid = { 0, NULL };
36
37 typedef void * db_malloc(size_t);
38 typedef void * db_realloc(void *, size_t);
39
40 static int
41 bdb_open( BackendInfo *bi )
42 {
43         return 0;
44 }
45
46 #if 0
47 static int
48 bdb_destroy( BackendInfo *bi )
49 {
50         return 0;
51 }
52
53 static int
54 bdb_close( BackendInfo *bi )
55 {
56         /* terminate the underlying database system */
57         return 0;
58 }
59 #endif
60
61 static int
62 bdb_db_init( BackendDB *be )
63 {
64         struct bdb_info *bdb;
65
66 #ifdef NEW_LOGGING
67         LDAP_LOG( BACK_BDB, ENTRY, "bdb_db_init", 0, 0, 0 );
68 #else
69         Debug( LDAP_DEBUG_ANY,
70                 "bdb_db_init: Initializing BDB database\n",
71                 0, 0, 0 );
72 #endif
73
74         /* indicate system schema supported */
75         be->be_flags |=
76 #ifdef BDB_SUBENTRIES
77                 SLAP_BFLAG_SUBENTRIES |
78 #endif
79 #ifdef BDB_ALIASES
80                 SLAP_BFLAG_ALIASES |
81 #endif
82                 SLAP_BFLAG_REFERRALS;
83
84         /* allocate backend-database-specific stuff */
85         bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
86
87         /* DBEnv parameters */
88         bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR );
89         bdb->bi_dbenv_xflags = 0;
90         bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
91
92         bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
93
94 #ifndef NO_THREADS
95 #if 0
96         bdb->bi_lock_detect = DB_LOCK_NORUN;
97 #else
98         bdb->bi_lock_detect = DB_LOCK_DEFAULT;
99 #endif
100 #endif
101
102         ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
103         ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
104         ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
105         ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
106 #ifdef BDB_HIER
107         ldap_pvt_thread_rdwr_init( &bdb->bi_tree_rdwr );
108 #endif
109
110         be->be_private = bdb;
111         return 0;
112 }
113
114 #if 0 /* ifndef NO_THREADS */
115 static void *lock_detect_task( void *arg )
116 {
117         struct bdb_info *bdb = (struct bdb_info *) arg;
118
119         while( bdb->bi_dbenv != NULL ) {
120                 int rc;
121                 int aborted;
122                 sleep( bdb->bi_lock_detect_seconds );
123
124                 rc = LOCK_DETECT( bdb->bi_dbenv, 0,
125                         bdb->bi_lock_detect, &aborted );
126
127                 if( rc != 0 ) {
128                         break;
129                 }
130
131 #ifdef NEW_LOGGING
132                 LDAP_LOG( BACK_BDB, ERR, "bdb_db_init: aborted %d locks\n", 
133                         aborted, 0, 0 );
134 #else
135                 Debug( LDAP_DEBUG_ANY,
136                         "bdb_lock_detect: aborted %d locks\n",
137                         aborted, 0, 0 );
138 #endif
139         }
140
141         return NULL;
142 }
143 #endif
144
145 int
146 bdb_bt_compare(
147         DB *db, 
148         const DBT *usrkey,
149         const DBT *curkey
150 )
151 {
152         unsigned char *u, *c;
153         int i;
154
155         u = usrkey->data;
156         c = curkey->data;
157
158 #ifdef WORDS_BIGENDIAN
159         for( i = 0; i < sizeof(ID); i++)
160 #else
161         for( i = sizeof(ID)-1; i >= 0; i--)
162 #endif
163         {
164                 if( u[i] - c[i] )
165                         return u[i] - c[i];
166         }
167         return 0;
168 }
169
170 static int
171 bdb_db_open( BackendDB *be )
172 {
173         int rc, i;
174         struct bdb_info *bdb = (struct bdb_info *) be->be_private;
175         u_int32_t flags;
176 #ifdef HAVE_EBCDIC
177         char path[MAXPATHLEN];
178 #endif
179
180 #ifdef NEW_LOGGING
181         LDAP_LOG( BACK_BDB, ARGS, 
182                 "bdb_db_open: %s\n", be->be_suffix[0].bv_val, 0, 0 );
183 #else
184         Debug( LDAP_DEBUG_ARGS,
185                 "bdb_db_open: %s\n",
186                 be->be_suffix[0].bv_val, 0, 0 );
187 #endif
188
189         db_env_set_func_free( ber_memfree );
190         db_env_set_func_malloc( ber_memalloc );
191         db_env_set_func_realloc( ber_memrealloc );
192
193         /* we should check existance of dbenv_home and db_directory */
194
195         rc = db_env_create( &bdb->bi_dbenv, 0 );
196         if( rc != 0 ) {
197 #ifdef NEW_LOGGING
198                 LDAP_LOG( BACK_BDB, ERR, 
199                         "bdb_db_open: db_env_create failed: %s (%d)\n", 
200                         db_strerror(rc), rc, 0 );
201 #else
202                 Debug( LDAP_DEBUG_ANY,
203                         "bdb_db_open: db_env_create failed: %s (%d)\n",
204                         db_strerror(rc), rc, 0 );
205 #endif
206                 return rc;
207         }
208
209         flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE
210                 | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN;
211         
212 #if 0
213         /* Never do automatic recovery, must perform it manually.
214          * Otherwise restarting with gentlehup will corrupt the
215          * database.
216          */
217         if( !(slapMode & SLAP_TOOL_MODE) ) flags |= DB_RECOVER;
218 #endif
219
220         bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
221         bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
222 #ifndef NO_THREADS
223         bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
224 #endif
225
226 #ifdef BDB_SUBDIRS
227         {
228                 char dir[MAXPATHLEN];
229                 size_t len = strlen( bdb->bi_dbenv_home );
230
231                 strcpy( dir, bdb->bi_dbenv_home );
232                 strcat( &dir[len], BDB_TMP_SUBDIR );
233                 
234                 rc = bdb->bi_dbenv->set_tmp_dir( bdb->bi_dbenv, dir );
235                 if( rc != 0 ) {
236 #ifdef NEW_LOGGING
237                         LDAP_LOG( BACK_BDB, ERR, 
238                                 "bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n", 
239                                 dir, db_strerror(rc), rc );
240 #else
241                         Debug( LDAP_DEBUG_ANY,
242                                 "bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n",
243                                 dir, db_strerror(rc), rc );
244 #endif
245                         return rc;
246                 }
247
248                 strcat( &dir[len], BDB_LG_SUBDIR );
249
250                 rc = bdb->bi_dbenv->set_lg_dir( bdb->bi_dbenv, dir );
251                 if( rc != 0 ) {
252 #ifdef NEW_LOGGING
253                         LDAP_LOG( BACK_BDB, ERR, 
254                                 "bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n", 
255                                 dir, db_strerror(rc), rc );
256 #else
257                         Debug( LDAP_DEBUG_ANY,
258                                 "bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n",
259                                 dir, db_strerror(rc), rc );
260 #endif
261                         return rc;
262                 }
263
264                 strcat( &dir[len], BDB_DATA_SUBDIR );
265
266                 rc = bdb->bi_dbenv->set_data_dir( bdb->bi_dbenv, dir );
267                 if( rc != 0 ) {
268 #ifdef NEW_LOGGING
269                         LDAP_LOG( BACK_BDB, ERR, 
270                                 "bdb_db_open: set_data_dir(%s) failed: %s (%d)\n",
271                                 dir, db_strerror(rc), rc );
272 #else
273                         Debug( LDAP_DEBUG_ANY,
274                                 "bdb_db_open: set_data_dir(%s) failed: %s (%d)\n",
275                                 dir, db_strerror(rc), rc );
276 #endif
277                         return rc;
278                 }
279         }
280 #endif
281
282 #ifdef NEW_LOGGING
283         LDAP_LOG( BACK_BDB, DETAIL1, 
284                 "bdb_db_open: dbenv_open %s\n", bdb->bi_dbenv_home, 0, 0 );
285 #else
286         Debug( LDAP_DEBUG_TRACE,
287                 "bdb_db_open: dbenv_open(%s)\n",
288                 bdb->bi_dbenv_home, 0, 0);
289 #endif
290
291 #ifdef HAVE_EBCDIC
292         strcpy( path, bdb->bi_dbenv_home );
293         __atoe( path );
294         rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
295                 path,
296                 flags,
297                 bdb->bi_dbenv_mode );
298 #else
299         rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
300                 bdb->bi_dbenv_home,
301                 flags,
302                 bdb->bi_dbenv_mode );
303 #endif
304         if( rc != 0 ) {
305 #ifdef NEW_LOGGING
306                 LDAP_LOG( BACK_BDB, ERR, 
307                         "bdb_db_open: dbenv_open failed: %s (%d)\n", 
308                         db_strerror(rc), rc, 0 );
309 #else
310                 Debug( LDAP_DEBUG_ANY,
311                         "bdb_db_open: dbenv_open failed: %s (%d)\n",
312                         db_strerror(rc), rc, 0 );
313 #endif
314                 return rc;
315         }
316
317         if( bdb->bi_dbenv_xflags != 0 ) {
318                 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
319                         bdb->bi_dbenv_xflags, 1);
320                 if( rc != 0 ) {
321 #ifdef NEW_LOGGING
322                         LDAP_LOG( BACK_BDB, ERR, 
323                                 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n", 
324                                 db_strerror(rc), rc, 0 );
325 #else
326                         Debug( LDAP_DEBUG_ANY,
327                                 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
328                                 db_strerror(rc), rc, 0 );
329 #endif
330                         return rc;
331                 }
332         }
333
334         flags = DB_THREAD | DB_CREATE | bdb->bi_db_opflags;
335
336         bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
337                 BDB_INDICES * sizeof(struct bdb_db_info *) );
338
339         /* open (and create) main database */
340         for( i = 0; bdbi_databases[i].name; i++ ) {
341                 struct bdb_db_info *db;
342
343                 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
344
345                 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
346                 if( rc != 0 ) {
347 #ifdef NEW_LOGGING
348                         LDAP_LOG( BACK_BDB, ERR, 
349                                 "bdb_db_open: db_create(%s) failed: %s (%d)\n", 
350                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
351 #else
352                         Debug( LDAP_DEBUG_ANY,
353                                 "bdb_db_open: db_create(%s) failed: %s (%d)\n",
354                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
355 #endif
356                         return rc;
357                 }
358
359                 if( i == BDB_ID2ENTRY ) {
360                         rc = db->bdi_db->set_bt_compare( db->bdi_db,
361                                 bdb_bt_compare );
362                         rc = db->bdi_db->set_pagesize( db->bdi_db,
363                                 BDB_ID2ENTRY_PAGESIZE );
364                 } else {
365 #ifdef BDB_HIER
366                         rc = db->bdi_db->set_bt_compare( db->bdi_db,
367                                 bdb_bt_compare );
368 #else
369                         rc = db->bdi_db->set_flags( db->bdi_db, 
370                                 DB_DUP | DB_DUPSORT );
371                         rc = db->bdi_db->set_dup_compare( db->bdi_db,
372                                 bdb_bt_compare );
373 #endif
374                         rc = db->bdi_db->set_pagesize( db->bdi_db,
375                                 BDB_PAGESIZE );
376                 }
377
378 #ifdef HAVE_EBCDIC
379                 strcpy( path, bdbi_databases[i].file );
380                 __atoe( path );
381                 rc = DB_OPEN( db->bdi_db, 
382                         path,
383                 /*      bdbi_databases[i].name, */ NULL,
384                         bdbi_databases[i].type,
385                         bdbi_databases[i].flags | flags,
386                         bdb->bi_dbenv_mode );
387 #else
388                 rc = DB_OPEN( db->bdi_db, 
389                         bdbi_databases[i].file,
390                 /*      bdbi_databases[i].name, */ NULL,
391                         bdbi_databases[i].type,
392                         bdbi_databases[i].flags | flags,
393                         bdb->bi_dbenv_mode );
394 #endif
395
396                 if( rc != 0 ) {
397 #ifdef NEW_LOGGING
398                         LDAP_LOG( BACK_BDB, ERR, 
399                                 "bdb_db_open: db_create(%s) failed: %s (%d)\n", 
400                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
401 #else
402                         Debug( LDAP_DEBUG_ANY,
403                                 "bdb_db_open: db_open(%s) failed: %s (%d)\n",
404                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
405 #endif
406                         return rc;
407                 }
408
409                 db->bdi_name = bdbi_databases[i].name;
410                 bdb->bi_databases[i] = db;
411         }
412
413         bdb->bi_databases[i] = NULL;
414         bdb->bi_ndatabases = i;
415
416         /* get nextid */
417         rc = bdb_last_id( be, NULL );
418         if( rc != 0 ) {
419 #ifdef NEW_LOGGING
420                         LDAP_LOG( BACK_BDB, ERR, 
421                                 "bdb_db_open: last_id(%s) failed: %s (%d)\n", 
422                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
423 #else
424                 Debug( LDAP_DEBUG_ANY,
425                         "bdb_db_open: last_id(%s) failed: %s (%d)\n",
426                         bdb->bi_dbenv_home, db_strerror(rc), rc );
427 #endif
428                 return rc;
429         }
430
431         /* <insert> open (and create) index databases */
432 #ifdef BDB_HIER
433         rc = bdb_build_tree( be );
434 #endif
435
436 #if 0 /* ifndef NO_THREADS */
437         if( bdb->bi_lock_detect != DB_LOCK_NORUN ) {
438                 /* listener as a separate THREAD */
439                 rc = ldap_pvt_thread_create( &bdb->bi_lock_detect_tid,
440                         1, lock_detect_task, bdb );
441         }
442 #endif
443         return 0;
444 }
445
446 static int
447 bdb_db_close( BackendDB *be )
448 {
449         int rc;
450         struct bdb_info *bdb = (struct bdb_info *) be->be_private;
451         struct bdb_db_info *db;
452
453         while( bdb->bi_ndatabases-- ) {
454                 db = bdb->bi_databases[bdb->bi_ndatabases];
455                 rc = db->bdi_db->close( db->bdi_db, 0 );
456                 /* Lower numbered names are not strdup'd */
457                 if( bdb->bi_ndatabases >= BDB_NDB )
458                         free( db->bdi_name );
459                 free( db );
460         }
461         free( bdb->bi_databases );
462         bdb_attr_index_destroy( bdb->bi_attrs );
463
464         bdb_cache_release_all (&bdb->bi_cache);
465
466         return 0;
467 }
468
469 static int
470 bdb_db_destroy( BackendDB *be )
471 {
472         int rc;
473         struct bdb_info *bdb = (struct bdb_info *) be->be_private;
474
475         /* close db environment */
476         if( bdb->bi_dbenv ) {
477                 /* force a checkpoint */
478                 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
479                 if( rc != 0 ) {
480 #ifdef NEW_LOGGING
481                         LDAP_LOG( BACK_BDB, ERR, 
482                                 "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
483                                 db_strerror(rc), rc, 0 );
484 #else
485                         Debug( LDAP_DEBUG_ANY,
486                                 "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
487                                 db_strerror(rc), rc, 0 );
488 #endif
489                 }
490
491                 bdb_cache_release_all (&bdb->bi_cache);
492
493                 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
494                 bdb->bi_dbenv = NULL;
495                 if( rc != 0 ) {
496 #ifdef NEW_LOGGING
497                         LDAP_LOG( BACK_BDB, ERR, 
498                                 "bdb_db_destroy: close failed: %s (%d)\n", 
499                                 db_strerror(rc), rc, 0 );
500 #else
501                         Debug( LDAP_DEBUG_ANY,
502                                 "bdb_db_destroy: close failed: %s (%d)\n",
503                                 db_strerror(rc), rc, 0 );
504 #endif
505                         return rc;
506                 }
507         }
508
509         if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
510
511 #ifdef BDB_HIER
512         ldap_pvt_thread_rdwr_destroy( &bdb->bi_tree_rdwr );
513 #endif
514         ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
515         ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
516         ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
517         ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
518
519         ch_free( bdb );
520         be->be_private = NULL;
521
522         return 0;
523 }
524
525 #ifdef SLAPD_BDB_DYNAMIC
526 int back_bdb_LTX_init_module( int argc, char *argv[] ) {
527         BackendInfo bi;
528
529         memset( &bi, '\0', sizeof(bi) );
530         bi.bi_type = "bdb";
531         bi.bi_init = bdb_initialize;
532
533         backend_add( &bi );
534         return 0;
535 }
536 #endif /* SLAPD_BDB_DYNAMIC */
537
538 int
539 bdb_initialize(
540         BackendInfo     *bi
541 )
542 {
543         static char *controls[] = {
544                 LDAP_CONTROL_MANAGEDSAIT,
545 #ifdef LDAP_CONTROL_SUBENTRIES
546                 LDAP_CONTROL_SUBENTRIES,
547 #endif
548 #ifdef LDAP_CONTROL_NOOP
549                 LDAP_CONTROL_NOOP,
550 #endif
551 #ifdef LDAP_CONTROL_VALUESRETURNFILTER
552                 LDAP_CONTROL_VALUESRETURNFILTER,
553 #endif
554 #ifdef LDAP_CLIENT_UPDATE
555                 LDAP_CONTROL_CLIENT_UPDATE,
556 #endif
557                 NULL
558         };
559
560         bi->bi_controls = controls;
561
562         /* initialize the underlying database system */
563 #ifdef NEW_LOGGING
564         LDAP_LOG( BACK_BDB, ENTRY, "bdb_db_initialize\n", 0, 0, 0 );
565 #else
566         Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n",
567                 0, 0, 0 );
568 #endif
569
570         {       /* version check */
571                 int major, minor, patch;
572                 char *version = db_version( &major, &minor, &patch );
573 #ifdef HAVE_EBCDIC
574                 char v2[1024];
575
576                 /* All our stdio does an ASCII to EBCDIC conversion on
577                  * the output. Strings from the BDB library are already
578                  * in EBCDIC; we have to go back and forth...
579                  */
580                 strcpy( v2, version );
581                 __etoa( v2 );
582                 version = v2;
583 #endif
584
585                 if( major != DB_VERSION_MAJOR ||
586                         minor != DB_VERSION_MINOR ||
587                         patch < DB_VERSION_PATCH )
588                 {
589 #ifdef NEW_LOGGING
590                         LDAP_LOG( BACK_BDB, ERR, 
591                                 "bdb_db_initialize: version mismatch: "
592                                 "\texpected: %s \tgot: %s\n", DB_VERSION_STRING, version, 0 );
593 #else
594                         Debug( LDAP_DEBUG_ANY,
595                                 "bdb_open: version mismatch\n"
596                                 "\texpected: " DB_VERSION_STRING "\n"
597                                 "\tgot: %s \n", version, 0, 0 );
598 #endif
599                 }
600
601 #ifdef NEW_LOGGING
602                 LDAP_LOG( BACK_BDB, DETAIL1, 
603                         "bdb_db_initialize: bdb_open: %s\n", version, 0, 0 );
604 #else
605                 Debug( LDAP_DEBUG_ANY, "bdb_open: %s\n",
606                         version, 0, 0 );
607 #endif
608         }
609
610 #if 0
611         db_env_set_func_malloc( ch_malloc );
612         db_env_set_func_realloc( ch_realloc );
613         db_env_set_func_free( ch_free );
614 #endif
615
616         db_env_set_func_yield( ldap_pvt_thread_yield );
617
618         {
619                 static char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
620
621                 bdb_uuid.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ));
622                 bdb_uuid.bv_val = uuidbuf;
623         }
624
625         bi->bi_open = 0;
626         bi->bi_close = 0;
627         bi->bi_config = 0;
628         bi->bi_destroy = 0;
629
630         bi->bi_db_init = bdb_db_init;
631         bi->bi_db_config = bdb_db_config;
632         bi->bi_db_open = bdb_db_open;
633         bi->bi_db_close = bdb_db_close;
634         bi->bi_db_destroy = bdb_db_destroy;
635
636         bi->bi_op_add = bdb_add;
637         bi->bi_op_bind = bdb_bind;
638         bi->bi_op_compare = bdb_compare;
639         bi->bi_op_delete = bdb_delete;
640         bi->bi_op_modify = bdb_modify;
641         bi->bi_op_modrdn = bdb_modrdn;
642         bi->bi_op_search = bdb_search;
643
644         bi->bi_op_unbind = 0;
645         bi->bi_op_abandon = 0;
646
647         bi->bi_extended = bdb_extended;
648
649 #if 1
650         /*
651          * these routines (and their callers) are not yet designed
652          * to work with transaction.  Using them may cause deadlock.
653          */
654         bi->bi_acl_group = bdb_group;
655         bi->bi_acl_attribute = bdb_attribute;
656 #else
657         bi->bi_acl_group = 0;
658         bi->bi_acl_attribute = 0;
659 #endif
660
661         bi->bi_chk_referrals = bdb_referrals;
662         bi->bi_operational = bdb_operational;
663         bi->bi_entry_release_rw = bdb_entry_release;
664
665         /*
666          * hooks for slap tools
667          */
668         bi->bi_tool_entry_open = bdb_tool_entry_open;
669         bi->bi_tool_entry_close = bdb_tool_entry_close;
670         bi->bi_tool_entry_first = bdb_tool_entry_next;
671         bi->bi_tool_entry_next = bdb_tool_entry_next;
672         bi->bi_tool_entry_get = bdb_tool_entry_get;
673         bi->bi_tool_entry_put = bdb_tool_entry_put;
674         bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
675         bi->bi_tool_sync = 0;
676
677         bi->bi_connection_init = 0;
678         bi->bi_connection_destroy = 0;
679
680         return 0;
681 }