]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/init.c
Revert ITS#3353 patch, it needs to be reworked.
[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-2004 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 "external.h"
26 #include <lutil.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                 "bdb_db_init: Initializing %s database\n",
72                 be->bd_info->bi_type, 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_LIST_INIT (&bdb->bi_psearch_list);
89
90         ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
91         ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
92         ldap_pvt_thread_rdwr_init ( &bdb->bi_pslist_rwlock );
93         ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
94         ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
95         ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
96
97         be->be_private = bdb;
98
99         return 0;
100 }
101
102 int
103 bdb_bt_compare(
104         DB *db, 
105         const DBT *usrkey,
106         const DBT *curkey )
107 {
108         unsigned char *u, *c;
109         int i, x;
110
111         u = usrkey->data;
112         c = curkey->data;
113
114 #ifdef WORDS_BIGENDIAN
115         for( i = 0; i < (int)sizeof(ID); i++)
116 #else
117         for( i = sizeof(ID)-1; i >= 0; i--)
118 #endif
119         {
120                 x = u[i] - c[i];
121                 if( x ) return x;
122         }
123
124         return 0;
125 }
126
127 static int
128 bdb_db_open( BackendDB *be )
129 {
130         int rc, i;
131         struct bdb_info *bdb = (struct bdb_info *) be->be_private;
132         u_int32_t flags;
133 #ifdef HAVE_EBCDIC
134         char path[MAXPATHLEN];
135 #endif
136
137         Debug( LDAP_DEBUG_ARGS,
138                 "bdb_db_open: %s\n",
139                 be->be_suffix[0].bv_val, 0, 0 );
140
141 #ifndef BDB_MULTIPLE_SUFFIXES
142         if ( be->be_suffix[1].bv_val ) {
143         Debug( LDAP_DEBUG_ANY,
144                 "bdb_db_open: only one suffix allowed\n", 0, 0, 0 );
145                 return -1;
146         }
147 #endif
148         /* we should check existance of dbenv_home and db_directory */
149
150         rc = db_env_create( &bdb->bi_dbenv, 0 );
151         if( rc != 0 ) {
152                 Debug( LDAP_DEBUG_ANY,
153                         "bdb_db_open: db_env_create failed: %s (%d)\n",
154                         db_strerror(rc), rc, 0 );
155                 return rc;
156         }
157
158         flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE
159                 | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN;
160         
161 #if 0
162         /* Never do automatic recovery, must perform it manually.
163          * Otherwise restarting with gentlehup will corrupt the
164          * database.
165          */
166         if( !(slapMode & SLAP_TOOL_MODE) ) flags |= DB_RECOVER;
167 #endif
168
169         /* If a key was set, use shared memory for the BDB environment */
170         if ( bdb->bi_shm_key ) {
171                 bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
172                 flags |= DB_SYSTEM_MEM;
173         }
174
175         bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
176         bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
177         bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
178
179         /* One long-lived TXN per thread, two TXNs per write op */
180         bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
181
182         if ( bdb->bi_idl_cache_max_size ) {
183                 bdb->bi_idl_tree = NULL;
184                 ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
185                 ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
186                 bdb->bi_idl_cache_size = 0;
187         }
188
189 #ifdef BDB_SUBDIRS
190         {
191                 char dir[MAXPATHLEN], *ptr;
192                 
193                 if (bdb->bi_dbenv_home[0] == '.') {
194                         /* If home is a relative path, relative subdirs
195                          * are just concat'd by BDB. We don't want the
196                          * path to be concat'd twice, e.g.
197                          * ./test-db/./test-db/tmp
198                          */
199                         ptr = dir;
200                 } else {
201                         ptr = lutil_strcopy( dir, bdb->bi_dbenv_home );
202                         *ptr++ = LDAP_DIRSEP[0];
203 #ifdef HAVE_EBCDIC
204                         __atoe( dir );
205 #endif
206                 }
207
208                 strcpy( ptr, BDB_TMP_SUBDIR );
209 #ifdef HAVE_EBCDIC
210                 __atoe( ptr );
211 #endif
212                 rc = bdb->bi_dbenv->set_tmp_dir( bdb->bi_dbenv, dir );
213                 if( rc != 0 ) {
214                         Debug( LDAP_DEBUG_ANY,
215                                 "bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n",
216                                 dir, db_strerror(rc), rc );
217                         return rc;
218                 }
219
220                 strcpy( ptr, BDB_LG_SUBDIR );
221 #ifdef HAVE_EBCDIC
222                 __atoe( ptr );
223 #endif
224                 rc = bdb->bi_dbenv->set_lg_dir( bdb->bi_dbenv, dir );
225                 if( rc != 0 ) {
226                         Debug( LDAP_DEBUG_ANY,
227                                 "bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n",
228                                 dir, db_strerror(rc), rc );
229                         return rc;
230                 }
231
232                 strcpy( ptr, BDB_DATA_SUBDIR );
233 #ifdef HAVE_EBCDIC
234                 __atoe( ptr );
235 #endif
236                 rc = bdb->bi_dbenv->set_data_dir( bdb->bi_dbenv, dir );
237                 if( rc != 0 ) {
238                         Debug( LDAP_DEBUG_ANY,
239                                 "bdb_db_open: set_data_dir(%s) failed: %s (%d)\n",
240                                 dir, db_strerror(rc), rc );
241                         return rc;
242                 }
243         }
244 #endif
245
246         Debug( LDAP_DEBUG_TRACE,
247                 "bdb_db_open: dbenv_open(%s)\n",
248                 bdb->bi_dbenv_home, 0, 0);
249
250 #ifdef HAVE_EBCDIC
251         strcpy( path, bdb->bi_dbenv_home );
252         __atoe( path );
253         rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
254                 path,
255                 flags,
256                 bdb->bi_dbenv_mode );
257 #else
258         rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
259                 bdb->bi_dbenv_home,
260                 flags,
261                 bdb->bi_dbenv_mode );
262 #endif
263         if( rc != 0 ) {
264                 Debug( LDAP_DEBUG_ANY,
265                         "bdb_db_open: dbenv_open failed: %s (%d)\n",
266                         db_strerror(rc), rc, 0 );
267                 return rc;
268         }
269
270         if( bdb->bi_dbenv_xflags != 0 ) {
271                 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
272                         bdb->bi_dbenv_xflags, 1);
273                 if( rc != 0 ) {
274                         Debug( LDAP_DEBUG_ANY,
275                                 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
276                                 db_strerror(rc), rc, 0 );
277                         return rc;
278                 }
279         }
280
281         flags = DB_THREAD | bdb->bi_db_opflags;
282
283         bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
284                 BDB_INDICES * sizeof(struct bdb_db_info *) );
285
286         /* open (and create) main database */
287         for( i = 0; bdbi_databases[i].name; i++ ) {
288                 struct bdb_db_info *db;
289
290                 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
291
292                 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
293                 if( rc != 0 ) {
294                         Debug( LDAP_DEBUG_ANY,
295                                 "bdb_db_open: db_create(%s) failed: %s (%d)\n",
296                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
297                         return rc;
298                 }
299
300                 if( i == BDB_ID2ENTRY ) {
301                         rc = db->bdi_db->set_bt_compare( db->bdi_db,
302                                 bdb_bt_compare );
303                         rc = db->bdi_db->set_pagesize( db->bdi_db,
304                                 BDB_ID2ENTRY_PAGESIZE );
305                         if ( slapMode & SLAP_TOOL_READMAIN ) {
306                                 flags |= DB_RDONLY;
307                         } else {
308                                 flags |= DB_CREATE;
309                         }
310                 } else {
311                         rc = db->bdi_db->set_flags( db->bdi_db, 
312                                 DB_DUP | DB_DUPSORT );
313 #ifndef BDB_HIER
314                         rc = db->bdi_db->set_dup_compare( db->bdi_db,
315                                 bdb_bt_compare );
316                         if ( slapMode & SLAP_TOOL_READONLY ) {
317                                 flags |= DB_RDONLY;
318                         } else {
319                                 flags |= DB_CREATE;
320                         }
321 #else
322                         rc = db->bdi_db->set_dup_compare( db->bdi_db,
323                                 bdb_dup_compare );
324                         rc = db->bdi_db->set_bt_compare( db->bdi_db,
325                                 bdb_bt_compare );
326                         if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
327                                 flags |= DB_RDONLY;
328                         } else {
329                                 flags |= DB_CREATE;
330                         }
331 #endif
332                         rc = db->bdi_db->set_pagesize( db->bdi_db,
333                                 BDB_PAGESIZE );
334                 }
335
336 #ifdef HAVE_EBCDIC
337                 strcpy( path, bdbi_databases[i].file );
338                 __atoe( path );
339                 rc = DB_OPEN( db->bdi_db,
340                         path,
341                 /*      bdbi_databases[i].name, */ NULL,
342                         bdbi_databases[i].type,
343                         bdbi_databases[i].flags | flags,
344                         bdb->bi_dbenv_mode );
345 #else
346                 rc = DB_OPEN( db->bdi_db,
347                         bdbi_databases[i].file,
348                 /*      bdbi_databases[i].name, */ NULL,
349                         bdbi_databases[i].type,
350                         bdbi_databases[i].flags | flags,
351                         bdb->bi_dbenv_mode );
352 #endif
353
354                 if( rc != 0 ) {
355                         Debug( LDAP_DEBUG_ANY,
356                                 "bdb_db_open: db_open(%s) failed: %s (%d)\n",
357                                 bdb->bi_dbenv_home, db_strerror(rc), rc );
358                         return rc;
359                 }
360
361                 flags &= ~(DB_CREATE | DB_RDONLY);
362                 db->bdi_name = bdbi_databases[i].name;
363                 bdb->bi_databases[i] = db;
364         }
365
366         bdb->bi_databases[i] = NULL;
367         bdb->bi_ndatabases = i;
368
369         /* get nextid */
370         rc = bdb_last_id( be, NULL );
371         if( rc != 0 ) {
372                 Debug( LDAP_DEBUG_ANY,
373                         "bdb_db_open: last_id(%s) failed: %s (%d)\n",
374                         bdb->bi_dbenv_home, db_strerror(rc), rc );
375                 return rc;
376         }
377
378         XLOCK_ID(bdb->bi_dbenv, &bdb->bi_cache.c_locker);
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
433         /* close db environment */
434         if( bdb->bi_dbenv ) {
435                 /* force a checkpoint */
436                 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
437                 if( rc != 0 ) {
438                         Debug( LDAP_DEBUG_ANY,
439                                 "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
440                                 db_strerror(rc), rc, 0 );
441                 }
442
443                 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
444                 bdb->bi_dbenv = NULL;
445                 if( rc != 0 ) {
446                         Debug( LDAP_DEBUG_ANY,
447                                 "bdb_db_destroy: close failed: %s (%d)\n",
448                                 db_strerror(rc), rc, 0 );
449                         return rc;
450                 }
451         }
452
453         if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
454
455         ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
456         ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
457         ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
458         ldap_pvt_thread_rdwr_destroy ( &bdb->bi_pslist_rwlock );
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         ps = LDAP_LIST_FIRST( &bdb->bi_psearch_list );
467
468         if ( ps ) {
469                 psn = LDAP_LIST_NEXT( ps, o_ps_link );
470                 slap_op_free( ps );
471                 if ( ps->o_tmpmemctx )
472                         slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
473         }
474
475         while ( psn ) {
476                 ps = psn;
477                 psn = LDAP_LIST_NEXT( ps, o_ps_link );
478                 slap_op_free( ps );
479                 if ( ps->o_tmpmemctx )
480                         slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
481         }
482
483         ch_free( bdb );
484         be->be_private = NULL;
485
486         return 0;
487 }
488
489 #if     (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \
490         (SLAPD_HDB == SLAPD_MOD_DYNAMIC && defined(BDB_HIER))
491 int init_module( int argc, char *argv[] ) {
492         BackendInfo bi;
493
494         memset( &bi, '\0', sizeof(bi) );
495 #ifdef BDB_HIER
496         bi.bi_type = "hdb";
497 #else
498         bi.bi_type = "bdb";
499 #endif
500         bi.bi_init = bdb_initialize;
501
502         backend_add( &bi );
503         return 0;
504 }
505 #endif /* SLAPD_BDB */
506
507 int
508 bdb_initialize(
509         BackendInfo     *bi )
510 {
511         static char *controls[] = {
512                 LDAP_CONTROL_ASSERT,
513                 LDAP_CONTROL_MANAGEDSAIT,
514                 LDAP_CONTROL_NOOP,
515                 LDAP_CONTROL_PAGEDRESULTS,
516 #ifdef LDAP_CONTROL_SUBENTRIES
517                 LDAP_CONTROL_SUBENTRIES,
518 #endif
519                 LDAP_CONTROL_VALUESRETURNFILTER,
520                 NULL
521         };
522
523         /* initialize the underlying database system */
524         Debug( LDAP_DEBUG_TRACE, "bdb_initialize: initialize BDB backend\n",
525                 0, 0, 0 );
526
527         bi->bi_flags |=
528                 SLAP_BFLAG_INCREMENT |
529 #ifdef BDB_SUBENTRIES
530                 SLAP_BFLAG_SUBENTRIES |
531 #endif
532 #ifdef BDB_ALIASES
533                 SLAP_BFLAG_ALIASES |
534 #endif
535                 SLAP_BFLAG_REFERRALS;
536
537         bi->bi_controls = controls;
538
539         {       /* version check */
540                 int major, minor, patch;
541                 char *version = db_version( &major, &minor, &patch );
542 #ifdef HAVE_EBCDIC
543                 char v2[1024];
544
545                 /* All our stdio does an ASCII to EBCDIC conversion on
546                  * the output. Strings from the BDB library are already
547                  * in EBCDIC; we have to go back and forth...
548                  */
549                 strcpy( v2, version );
550                 __etoa( v2 );
551                 version = v2;
552 #endif
553
554                 if( major != DB_VERSION_MAJOR ||
555                         minor != DB_VERSION_MINOR ||
556                         patch < DB_VERSION_PATCH )
557                 {
558                         Debug( LDAP_DEBUG_ANY,
559                                 "bdb_initialize: BDB library version mismatch:"
560                                 " expected " DB_VERSION_STRING ","
561                                 " got %s\n", version, 0, 0 );
562                 }
563
564                 Debug( LDAP_DEBUG_ANY, "bdb_initialize: %s\n",
565                         version, 0, 0 );
566         }
567
568         db_env_set_func_free( ber_memfree );
569         db_env_set_func_malloc( (db_malloc *)ber_memalloc );
570         db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
571 #ifndef NO_THREAD
572         /* This is a no-op on a NO_THREAD build. Leave the default
573          * alone so that BDB will sleep on interprocess conflicts.
574          */
575         db_env_set_func_yield( ldap_pvt_thread_yield );
576 #endif
577
578         {
579                 static char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
580
581                 bdb_uuid.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ));
582                 bdb_uuid.bv_val = uuidbuf;
583         }
584
585         bi->bi_open = 0;
586         bi->bi_close = 0;
587         bi->bi_config = 0;
588         bi->bi_destroy = 0;
589
590         bi->bi_db_init = bdb_db_init;
591         bi->bi_db_config = bdb_db_config;
592         bi->bi_db_open = bdb_db_open;
593         bi->bi_db_close = bdb_db_close;
594         bi->bi_db_destroy = bdb_db_destroy;
595
596         bi->bi_op_add = bdb_add;
597         bi->bi_op_bind = bdb_bind;
598         bi->bi_op_compare = bdb_compare;
599         bi->bi_op_delete = bdb_delete;
600         bi->bi_op_modify = bdb_modify;
601         bi->bi_op_modrdn = bdb_modrdn;
602         bi->bi_op_search = bdb_search;
603
604         bi->bi_op_unbind = 0;
605
606         bi->bi_op_abandon = bdb_abandon;
607         bi->bi_op_cancel = bdb_cancel;
608
609         bi->bi_extended = bdb_extended;
610
611         bi->bi_chk_referrals = bdb_referrals;
612         bi->bi_operational = bdb_operational;
613         bi->bi_has_subordinates = bdb_hasSubordinates;
614         bi->bi_entry_release_rw = bdb_entry_release;
615         bi->bi_entry_get_rw = bdb_entry_get;
616
617         /*
618          * hooks for slap tools
619          */
620         bi->bi_tool_entry_open = bdb_tool_entry_open;
621         bi->bi_tool_entry_close = bdb_tool_entry_close;
622         bi->bi_tool_entry_first = bdb_tool_entry_next;
623         bi->bi_tool_entry_next = bdb_tool_entry_next;
624         bi->bi_tool_entry_get = bdb_tool_entry_get;
625         bi->bi_tool_entry_put = bdb_tool_entry_put;
626         bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
627         bi->bi_tool_sync = 0;
628         bi->bi_tool_dn2id_get = bdb_tool_dn2id_get;
629         bi->bi_tool_id2entry_get = bdb_tool_id2entry_get;
630         bi->bi_tool_entry_modify = bdb_tool_entry_modify;
631
632         bi->bi_connection_init = 0;
633         bi->bi_connection_destroy = 0;
634
635         return 0;
636 }