]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/config.c
fcee27c978c579aecb46973cce10a8df5ab02921
[openldap] / servers / slapd / back-bdb / config.c
1 /* config.c - bdb backend configuration file routine */
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
22 #include "back-bdb.h"
23
24 #include "config.h"
25
26 #include "lutil.h"
27 #include "ldap_rq.h"
28
29 #ifdef DB_DIRTY_READ
30 #       define  SLAP_BDB_ALLOW_DIRTY_READ
31 #endif
32
33 static ObjectClass *bdb_oc;
34
35 static ConfigDriver bdb_cf_oc, bdb_cf_gen;
36
37 enum {
38         BDB_CHKPT = 1,
39         BDB_CONFIG,
40         BDB_DIRECTORY,
41         BDB_NOSYNC,
42         BDB_DIRTYR,
43         BDB_INDEX,
44         BDB_LOCKD,
45         BDB_SSTACK
46 };
47
48 static ConfigTable bdbcfg[] = {
49         { "", "", 0, 0, 0, ARG_MAGIC,
50                 bdb_cf_oc, NULL, NULL, NULL },
51         { "directory", "dir", 2, 2, 0, ARG_STRING|ARG_MAGIC|BDB_DIRECTORY,
52                 bdb_cf_gen, "( OLcfgDbAt:0.1 NAME 'olcDbDirectory' "
53                         "DESC 'Directory for database content' "
54                         "EQUALITY caseIgnoreMatch "
55                         "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
56         { "cachesize", "size", 2, 2, 0, ARG_INT|ARG_OFFSET,
57                 (void *)offsetof(struct bdb_info, bi_cache.c_maxsize),
58                 "( OLcfgDbAt:1.1 NAME 'olcDbCacheSize' "
59                         "DESC 'Entry cache size in entries' "
60                         "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
61         { "checkpoint", "kbyte> <min", 3, 3, 0, ARG_MAGIC|BDB_CHKPT,
62                 bdb_cf_gen, "( OLcfgDbAt:1.2 NAME 'olcDbCheckpoint' "
63                         "DESC 'Database checkpoint interval in kbytes and minutes' "
64                         "SYNTAX OMsDirectoryString SINGLE-VALUE )",NULL, NULL },
65         { "dbconfig", "DB_CONFIG setting", 3, 0, 0, ARG_MAGIC|BDB_CONFIG,
66                 bdb_cf_gen, "( OLcfgDbAt:1.3 NAME 'olcDbConfig' "
67                         "DESC 'BerkeleyDB DB_CONFIG configuration directives' "
68                         "SYNTAX OMsDirectoryString )",NULL, NULL },
69         { "dbnosync", NULL, 1, 2, 0, ARG_ON_OFF|ARG_MAGIC|BDB_NOSYNC,
70                 bdb_cf_gen, "( OLcfgDbAt:1.4 NAME 'olcDbNoSync' "
71                         "DESC 'Disable synchronous database writes' "
72                         "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
73         { "dirtyread", NULL, 1, 2, 0,
74 #ifdef SLAP_BDB_ALLOW_DIRTY_READ
75                 ARG_ON_OFF|ARG_MAGIC|BDB_DIRTYR, bdb_cf_gen,
76 #else
77                 ARG_IGNORED, NULL,
78 #endif
79                 "( OLcfgDbAt:1.5 NAME 'olcDbDirtyRead' "
80                 "DESC 'Allow reads of uncommitted data' "
81                 "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
82         { "idlcachesize", "size", 2, 2, 0, ARG_INT|ARG_OFFSET,
83                 (void *)offsetof(struct bdb_info,bi_idl_cache_max_size),
84                 "( OLcfgDbAt:1.6 NAME 'olcDbIDLcacheSize' "
85                 "DESC 'IDL cache size in IDLs' "
86                 "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
87         { "index", "attr> <[pres,eq,approx,sub]", 2, 3, 0, ARG_MAGIC|BDB_INDEX,
88                 bdb_cf_gen, "( OLcfgDbAt:0.2 NAME 'olcDbIndex' "
89                 "DESC 'Attribute index parameters' "
90                 "EQUALITY caseIgnoreMatch "
91                 "SYNTAX OMsDirectoryString )", NULL, NULL },
92         { "linearindex", NULL, 1, 2, 0, ARG_ON_OFF|ARG_OFFSET,
93                 (void *)offsetof(struct bdb_info, bi_linear_index), 
94                 "( OLcfgDbAt:1.7 NAME 'olcDbLinearIndex' "
95                 "DESC 'Index attributes one at a time' "
96                 "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
97         { "lockdetect", "policy", 2, 2, 0, ARG_MAGIC|BDB_LOCKD,
98                 bdb_cf_gen, "( OLcfgDbAt:1.8 NAME 'olcDbLockDetect' "
99                 "DESC 'Deadlock detection algorithm' "
100                 "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
101         { "mode", "mode", 2, 2, 0, ARG_INT|ARG_OFFSET,
102                 (void *)offsetof(struct bdb_info, bi_dbenv_mode),
103                 "( OLcfgDbAt:0.3 NAME 'olcDbMode' "
104                 "DESC 'Unix permissions of database files' "
105                 "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
106         { "searchstack", "depth", 2, 2, 0, ARG_INT|ARG_MAGIC|BDB_SSTACK,
107                 bdb_cf_gen, "( OLcfgDbAt:1.9 NAME 'olcDbSearchStack' "
108                 "DESC 'Depth of search stack in IDLs' "
109                 "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
110         { "shm_key", "key", 2, 2, 0, ARG_INT|ARG_OFFSET,
111                 (void *)offsetof(struct bdb_info, bi_shm_key), 
112                 "( OLcfgDbAt:1.10 NAME 'olcDbShmKey' "
113                 "DESC 'Key for shared memory region' "
114                 "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
115         { NULL, NULL, 0, 0, 0, ARG_IGNORED,
116                 NULL, NULL, NULL, NULL }
117 };
118
119 static ConfigOCs bdbocs[] = {
120         { "( OLcfgDbOc:1.1 "
121                 "NAME 'olcBdbConfig' "
122                 "DESC 'BDB backend configuration' "
123                 "SUP olcDatabaseConfig "
124                 "MUST olcDbDirectory "
125                 "MAY ( olcDbCacheSize $ olcDbCheckpoint $ olcDbConfig $ "
126                 "olcDbNoSync $ olcDbDirtyRead $ olcDbIDLcacheSize $ "
127                 "olcDbIndex $ olcDbLinearIndex $ olcDbLockDetect $ "
128                 "olcDbMode $ olcDbSearchStack $ olcDbShmKey ) )",
129                         Cft_Database, &bdb_oc },
130         { NULL, 0, NULL }
131 };
132
133 static int
134 bdb_cf_oc(ConfigArgs *c)
135 {
136         if ( c->op == SLAP_CONFIG_EMIT ) {
137                 value_add_one( &c->rvalue_vals, &bdb_oc->soc_cname );
138                 return 0;
139         }
140         return 1;
141 }
142
143 static slap_verbmasks bdb_lockd[] = {
144         { BER_BVC("default"), DB_LOCK_DEFAULT },
145         { BER_BVC("oldest"), DB_LOCK_OLDEST },
146         { BER_BVC("random"), DB_LOCK_RANDOM },
147         { BER_BVC("youngest"), DB_LOCK_YOUNGEST },
148         { BER_BVC("fewest"), DB_LOCK_MINLOCKS },
149         { BER_BVNULL, 0 }
150 };
151
152 /* perform periodic checkpoints */
153 static void *
154 bdb_checkpoint( void *ctx, void *arg )
155 {
156         struct re_s *rtask = arg;
157         struct bdb_info *bdb = rtask->arg;
158         
159         TXN_CHECKPOINT( bdb->bi_dbenv, bdb->bi_txn_cp_kbyte,
160                 bdb->bi_txn_cp_min, 0 );
161         ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
162         ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
163         ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
164         return NULL;
165 }
166
167 /* reindex entries on the fly */
168 static void *
169 bdb_online_index( void *ctx, void *arg )
170 {
171         struct re_s *rtask = arg;
172         BackendDB *be = rtask->arg;
173         struct bdb_info *bdb = be->be_private;
174
175         Connection conn = {0};
176         char opbuf[OPERATION_BUFFER_SIZE];
177         Operation *op = (Operation *)opbuf;
178
179         DBC *curs;
180         DBT key, data;
181         DB_TXN *txn;
182         DB_LOCK lock;
183         u_int32_t locker;
184         ID id, nid;
185         EntryInfo *ei;
186         int rc, getnext = 1;
187
188         connection_fake_init( &conn, op, ctx );
189
190         op->o_bd = be;
191
192         DBTzero( &key );
193         DBTzero( &data );
194         
195         id = 1;
196         key.data = &nid;
197         key.size = key.ulen = sizeof(ID);
198         key.flags = DB_DBT_USERMEM;
199
200         data.flags = DB_DBT_USERMEM | DB_DBT_PARTIAL;
201         data.dlen = data.ulen = 0;
202
203         while ( 1 ) {
204                 if ( slapd_shutdown )
205                         break;
206
207                 rc = TXN_BEGIN( bdb->bi_dbenv, NULL, &txn, bdb->bi_db_opflags );
208                 if ( rc ) 
209                         break;
210                 locker = TXN_ID( txn );
211                 if ( getnext ) {
212                         getnext = 0;
213                         BDB_ID2DISK( id, &nid );
214                         rc = bdb->bi_id2entry->bdi_db->cursor(
215                                 bdb->bi_id2entry->bdi_db, txn, &curs, bdb->bi_db_opflags );
216                         if ( rc ) {
217                                 TXN_ABORT( txn );
218                                 break;
219                         }
220                         rc = curs->c_get( curs, &key, &data, DB_SET_RANGE );
221                         curs->c_close( curs );
222                         if ( rc ) {
223                                 TXN_ABORT( txn );
224                                 if ( rc == DB_NOTFOUND )
225                                         rc = 0;
226                                 if ( rc == DB_LOCK_DEADLOCK ) {
227                                         ldap_pvt_thread_yield();
228                                         continue;
229                                 }
230                                 break;
231                         }
232                         BDB_DISK2ID( &nid, &id );
233                 }
234
235                 ei = NULL;
236                 rc = bdb_cache_find_id( op, txn, id, &ei, 0, locker, &lock );
237                 if ( rc ) {
238                         TXN_ABORT( txn );
239                         if ( rc == DB_LOCK_DEADLOCK ) {
240                                 ldap_pvt_thread_yield();
241                                 continue;
242                         }
243                         if ( rc == DB_NOTFOUND ) {
244                                 id++;
245                                 getnext = 1;
246                                 continue;
247                         }
248                         break;
249                 }
250                 if ( ei->bei_e ) {
251                         rc = bdb_index_entry( op, txn, BDB_INDEX_UPDATE_OP, ei->bei_e );
252                         if ( rc == DB_LOCK_DEADLOCK ) {
253                                 TXN_ABORT( txn );
254                                 ldap_pvt_thread_yield();
255                                 continue;
256                         }
257                         if ( rc == 0 ) {
258                                 rc = TXN_COMMIT( txn, 0 );
259                                 txn = NULL;
260                         }
261                         if ( rc )
262                                 break;
263                 }
264                 id++;
265                 getnext = 1;
266         }
267 out:
268         ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
269         ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
270         ldap_pvt_runqueue_remove( &slapd_rq, rtask );
271         ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
272
273         return NULL;
274 }
275
276 /* Cleanup loose ends after Modify completes */
277 static int
278 bdb_cf_cleanup( ConfigArgs *c )
279 {
280         struct bdb_info *bdb = c->be->be_private;
281         int rc = 0;
282
283         if ( bdb->bi_flags & BDB_UPD_CONFIG ) {
284                 if ( bdb->bi_db_config ) {
285                         int i;
286                         FILE *f = fopen( bdb->bi_db_config_path, "w" );
287                         if ( f ) {
288                                 for (i=0; bdb->bi_db_config[i].bv_val; i++)
289                                         fprintf( f, "%s\n", bdb->bi_db_config[i].bv_val );
290                                 fclose( f );
291                         }
292                 } else {
293                         unlink( bdb->bi_db_config_path );
294                 }
295                 bdb->bi_flags ^= BDB_UPD_CONFIG;
296         }
297
298         if ( bdb->bi_flags & BDB_DEL_INDEX ) {
299                 bdb_attr_flush( bdb );
300                 bdb->bi_flags ^= BDB_DEL_INDEX;
301         }
302
303         if ( bdb->bi_flags & BDB_RE_OPEN ) {
304                 bdb->bi_flags ^= BDB_RE_OPEN;
305                 rc = c->be->bd_info->bi_db_close( c->be );
306                 if ( rc == 0 )
307                         rc = c->be->bd_info->bi_db_open( c->be );
308                 /* If this fails, we need to restart */
309                 if ( rc ) 
310                         slapd_shutdown = 1;
311         }
312         return rc;
313 }
314
315 static int
316 bdb_cf_gen(ConfigArgs *c)
317 {
318         struct bdb_info *bdb = c->be->be_private;
319         int rc;
320
321         if ( c->op == SLAP_CONFIG_EMIT ) {
322                 rc = 0;
323                 switch( c->type ) {
324                 case BDB_CHKPT:
325                         if (bdb->bi_txn_cp ) {
326                                 char buf[64];
327                                 struct berval bv;
328                                 bv.bv_len = sprintf( buf, "%d %d", bdb->bi_txn_cp_kbyte,
329                                         bdb->bi_txn_cp_min );
330                                 bv.bv_val = buf;
331                                 value_add_one( &c->rvalue_vals, &bv );
332                         } else{
333                                 rc = 1;
334                         }
335                         break;
336
337                 case BDB_DIRECTORY:
338                         if ( bdb->bi_dbenv_home ) {
339                                 c->value_string = ch_strdup( bdb->bi_dbenv_home );
340                         } else {
341                                 rc = 1;
342                         }
343                         break;
344
345                 case BDB_CONFIG:
346                         if ( bdb->bi_db_config ) {
347                                 int i;
348                                 struct berval bv;
349
350                                 bv.bv_val = c->log;
351                                 for (i=0; !BER_BVISNULL(&bdb->bi_db_config[i]); i++) {
352                                         bv.bv_len = sprintf( bv.bv_val, "{%d}%s", i,
353                                                 bdb->bi_db_config[i].bv_val );
354                                         value_add_one( &c->rvalue_vals, &bv );
355                                 }
356                         }
357                         if ( !c->rvalue_vals ) rc = 1;
358                         break;
359
360                 case BDB_NOSYNC:
361                         if ( bdb->bi_dbenv_xflags & DB_TXN_NOSYNC )
362                                 c->value_int = 1;
363                         break;
364                         
365                 case BDB_INDEX:
366                         bdb_attr_index_unparse( bdb, &c->rvalue_vals );
367                         if ( !c->rvalue_vals ) rc = 1;
368                         break;
369
370                 case BDB_LOCKD:
371                         rc = 1;
372                         if ( bdb->bi_lock_detect != DB_LOCK_DEFAULT ) {
373                                 int i;
374                                 for (i=0; !BER_BVISNULL(&bdb_lockd[i].word); i++) {
375                                         if ( bdb->bi_lock_detect == bdb_lockd[i].mask ) {
376                                                 value_add_one( &c->rvalue_vals, &bdb_lockd[i].word );
377                                                 rc = 0;
378                                                 break;
379                                         }
380                                 }
381                         }
382                         break;
383
384                 case BDB_SSTACK:
385                         c->value_int = bdb->bi_search_stack_depth;
386                         break;
387                 }
388                 return rc;
389         } else if ( c->op == LDAP_MOD_DELETE ) {
390                 rc = 0;
391                 switch( c->type ) {
392                 /* single-valued no-ops */
393                 case BDB_LOCKD:
394                 case BDB_SSTACK:
395                         break;
396
397                 case BDB_CHKPT:
398                         if ( bdb->bi_txn_cp_task ) {
399                                 struct re_s *re = bdb->bi_txn_cp_task;
400                                 bdb->bi_txn_cp_task = NULL;
401                                 if ( ldap_pvt_runqueue_isrunning( &slapd_rq, re ))
402                                         ldap_pvt_runqueue_stoptask( &slapd_rq, re );
403                                 ldap_pvt_runqueue_remove( &slapd_rq, re );
404                         }
405                         bdb->bi_txn_cp = 0;
406                         break;
407                 case BDB_CONFIG:
408                         if ( c->valx < 0 ) {
409                                 ber_bvarray_free( bdb->bi_db_config );
410                                 bdb->bi_db_config = NULL;
411                         } else {
412                                 int i = c->valx;
413                                 ch_free( bdb->bi_db_config[i].bv_val );
414                                 for (; bdb->bi_db_config[i].bv_val; i++)
415                                         bdb->bi_db_config[i] = bdb->bi_db_config[i+1];
416                         }
417                         bdb->bi_flags |= BDB_UPD_CONFIG;
418                         c->cleanup = bdb_cf_cleanup;
419                         break;
420                 case BDB_DIRECTORY:
421                         bdb->bi_flags |= BDB_RE_OPEN;
422                         bdb->bi_flags ^= BDB_HAS_CONFIG;
423                         ch_free( bdb->bi_dbenv_home );
424                         bdb->bi_dbenv_home = NULL;
425                         ch_free( bdb->bi_db_config_path );
426                         bdb->bi_db_config_path = NULL;
427                         c->cleanup = bdb_cf_cleanup;
428                         ldap_pvt_thread_pool_purgekey( bdb->bi_dbenv );
429                         ldap_pvt_thread_pool_purgekey( ((char *)bdb->bi_dbenv) + 1 );
430                         break;
431                 case BDB_NOSYNC:
432                         bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC, 0 );
433                         break;
434                 case BDB_INDEX: {
435                         AttributeDescription *ad = NULL;
436                         struct berval bv, def = BER_BVC("default");
437                         char *ptr;
438                         const char *text;
439                         for (ptr = c->line; !isspace( *ptr ); ptr++);
440                         bv.bv_val = c->line;
441                         bv.bv_len = ptr - bv.bv_val;
442                         if ( bvmatch( &bv, &def )) {
443                                 bdb->bi_defaultmask = 0;
444                         } else {
445                                 slap_bv2ad( &bv, &ad, &text );
446                                 if ( ad ) {
447                                         AttrInfo *ai = bdb_attr_mask( bdb, ad );
448                                         ai->ai_indexmask |= BDB_INDEX_DELETING;
449                                         bdb->bi_flags |= BDB_DEL_INDEX;
450                                         c->cleanup = bdb_cf_cleanup;
451                                 }
452                         }
453                         }
454                         break;
455                 }
456                 return rc;
457         }
458
459         switch( c->type ) {
460         case BDB_CHKPT:
461                 bdb->bi_txn_cp = 1;
462                 bdb->bi_txn_cp_kbyte = strtol( c->argv[1], NULL, 0 );
463                 bdb->bi_txn_cp_min = strtol( c->argv[2], NULL, 0 );
464                 /* If we're in server mode and time-based checkpointing is enabled,
465                  * submit a task to perform periodic checkpoints.
466                  */
467                 if ((slapMode & SLAP_SERVER_MODE) && bdb->bi_txn_cp_min ) {
468                         struct re_s *re = bdb->bi_txn_cp_task;
469                         if ( re )
470                                 re->interval.tv_sec = bdb->bi_txn_cp_min * 60;
471                         else
472                                 bdb->bi_txn_cp_task = ldap_pvt_runqueue_insert( &slapd_rq,
473                                         bdb->bi_txn_cp_min * 60, bdb_checkpoint, bdb,
474                                         "bdb_checkpoint", c->be->be_suffix[0].bv_val );
475                 }
476                 break;
477
478         case BDB_CONFIG: {
479                 char *ptr = c->line + STRLENOF("dbconfig");
480                 struct berval bv;
481                 while (!isspace(*ptr)) ptr++;
482                 while (isspace(*ptr)) ptr++;
483                 
484                 if ( bdb->bi_flags & BDB_IS_OPEN ) {
485                         bdb->bi_flags |= BDB_UPD_CONFIG;
486                         c->cleanup = bdb_cf_cleanup;
487                 } else {
488                 /* If we're just starting up...
489                  */
490                         FILE *f;
491                         /* If a DB_CONFIG file exists, or we don't know the path
492                          * to the DB_CONFIG file, ignore these directives
493                          */
494                         if (( bdb->bi_flags & BDB_HAS_CONFIG ) || !bdb->bi_db_config_path )
495                                 break;
496                         f = fopen( bdb->bi_db_config_path, "a" );
497                         if ( f ) {
498                                 /* FIXME: EBCDIC probably needs special handling */
499                                 fprintf( f, "%s\n", ptr );
500                                 fclose( f );
501                         }
502                 }
503                 ber_str2bv( ptr, 0, 1, &bv );
504                 ber_bvarray_add( &bdb->bi_db_config, &bv );
505                 }
506                 break;
507
508         case BDB_DIRECTORY: {
509                 FILE *f;
510                 char *ptr;
511
512                 if ( bdb->bi_dbenv_home )
513                         ch_free( bdb->bi_dbenv_home );
514                 bdb->bi_dbenv_home = c->value_string;
515
516                 /* See if a DB_CONFIG file already exists here */
517                 if ( bdb->bi_db_config_path )
518                         ch_free( bdb->bi_db_config_path );
519                 bdb->bi_db_config_path = ch_malloc( strlen( bdb->bi_dbenv_home ) +
520                         STRLENOF(LDAP_DIRSEP) + STRLENOF("DB_CONFIG") + 1 );
521                 ptr = lutil_strcopy( bdb->bi_db_config_path, bdb->bi_dbenv_home );
522                 *ptr++ = LDAP_DIRSEP[0];
523                 strcpy( ptr, "DB_CONFIG" );
524
525                 f = fopen( bdb->bi_db_config_path, "r" );
526                 if ( f ) {
527                         bdb->bi_flags |= BDB_HAS_CONFIG;
528                         fclose(f);
529                 }
530                 }
531                 break;
532
533         case BDB_NOSYNC:
534                 if ( c->value_int )
535                         bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
536                 else
537                         bdb->bi_dbenv_xflags &= ~DB_TXN_NOSYNC;
538                 if ( bdb->bi_flags & BDB_IS_OPEN ) {
539                         bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC,
540                                 c->value_int );
541                 }
542                 break;
543
544         case BDB_INDEX:
545                 rc = bdb_attr_index_config( bdb, c->fname, c->lineno,
546                         c->argc - 1, &c->argv[1] );
547
548                 if( rc != LDAP_SUCCESS ) return 1;
549                 if ( bdb->bi_flags & BDB_IS_OPEN ) {
550                         /* Start the task as soon as we finish here */
551                         ldap_pvt_runqueue_insert( &slapd_rq, 60,
552                                 bdb_online_index, c->be,
553                                 "bdb_online_index", c->be->be_suffix[0].bv_val );
554                 }
555                 break;
556
557         case BDB_LOCKD:
558                 rc = verb_to_mask( c->argv[1], bdb_lockd );
559                 if ( BER_BVISNULL(&bdb_lockd[rc].word) ) {
560                         fprintf( stderr, "%s: "
561                                 "bad policy (%s) in \"lockDetect <policy>\" line\n",
562                                 c->log, c->argv[1] );
563                         return 1;
564                 }
565                 bdb->bi_lock_detect = rc;
566                 break;
567
568         case BDB_SSTACK:
569                 if ( c->value_int < MINIMUM_SEARCH_STACK_DEPTH ) {
570                         fprintf( stderr,
571                 "%s: depth %d too small, using %d\n",
572                         c->log, c->value_int, MINIMUM_SEARCH_STACK_DEPTH );
573                         c->value_int = MINIMUM_SEARCH_STACK_DEPTH;
574                 }
575                 bdb->bi_search_stack_depth = c->value_int;
576                 break;
577         }
578         return 0;
579 }
580
581 int bdb_back_init_cf( BackendInfo *bi )
582 {
583         int rc;
584         bi->bi_cf_table = bdbcfg;
585
586         rc = config_register_schema( bdbcfg, bdbocs );
587         if ( rc ) return rc;
588         bdbcfg[0].ad = slap_schema.si_ad_objectClass;
589         return 0;
590 }