1 /* config.c - bdb backend configuration file routine */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
23 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
26 fprintf( stderr, "%s: line %d: "
27 "bdb database info is null!\n",
32 /* directory is the DB_HOME */
33 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
35 fprintf( stderr, "%s: line %d: "
36 "missing dir in \"directory <dir>\" line\n",
40 if ( bdb->bi_dbenv_home ) {
41 free( bdb->bi_dbenv_home );
43 bdb->bi_dbenv_home = ch_strdup( argv[1] );
45 /* turn off transactions, use CDB mode instead */
46 } else if ( strcasecmp( argv[0], "dbnotxn" ) == 0 ) {
49 /* transaction checkpoint configuration */
50 } else if ( strcasecmp( argv[0], "dbnosync" ) == 0 ) {
51 bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
53 /* transaction checkpoint configuration */
54 } else if ( strcasecmp( argv[0], "checkpoint" ) == 0 ) {
56 fprintf( stderr, "%s: line %d: "
57 "missing parameters in \"checkpoint <kbyte> <min>\" line\n",
62 bdb->bi_txn_cp_kbyte = strtol( argv[1], NULL, 0 );
63 bdb->bi_txn_cp_min = strtol( argv[2], NULL, 0 );
65 /* lock detect configuration */
66 } else if ( strcasecmp( argv[0], "lockdetect" ) == 0 ) {
69 fprintf( stderr, "%s: line %d: "
70 "missing parameters in \"lockDetect <policy> <seconds>\" line\n",
75 if( strcasecmp( argv[1], "default" ) == 0 ) {
76 bdb->bi_lock_detect = DB_LOCK_DEFAULT;
78 } else if( strcasecmp( argv[1], "oldest" ) == 0 ) {
79 bdb->bi_lock_detect = DB_LOCK_OLDEST;
81 } else if( strcasecmp( argv[1], "random" ) == 0 ) {
82 bdb->bi_lock_detect = DB_LOCK_RANDOM;
84 } else if( strcasecmp( argv[1], "youngest" ) == 0 ) {
85 bdb->bi_lock_detect = DB_LOCK_YOUNGEST;
88 fprintf( stderr, "%s: line %d: "
89 "bad policy (%s) in \"lockDetect <policy> <seconds>\" line\n",
90 fname, lineno, argv[1] );
94 bdb->bi_lock_detect_seconds = strtol( argv[2], NULL, 0 );
95 if( bdb->bi_lock_detect_seconds < 1 ) {
96 fprintf( stderr, "%s: line %d: "
97 "bad seconds (%s) in \"lockDetect <policy> <seconds>\" line\n",
98 fname, lineno, argv[2] );
102 fprintf( stderr, "%s: line %d: "
103 "NO THREADS: lockDetect line ignored\n",
107 /* mode with which to create new database files */
108 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
110 fprintf( stderr, "%s: line %d: "
111 "missing mode in \"mode <mode>\" line\n",
115 bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 );
117 #if BDB_FILTER_INDICES
118 /* attribute to index */
119 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
122 fprintf( stderr, "%s: line %d: "
123 "missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
126 } else if ( argc > 3 ) {
127 fprintf( stderr, "%s: line %d: "
128 "extra junk after \"index <attr> [pres,eq,approx,sub]\" "
132 rc = bdb_attr_index_config( bdb, fname, lineno, argc - 1, &argv[1] );
134 if( rc != LDAP_SUCCESS ) return 1;
139 fprintf( stderr, "%s: line %d: "
140 "unknown directive \"%s\" in bdb database definition (ignored)\n",
141 fname, lineno, argv[0] );