2001-10-05 09:19:58 +08:00
|
|
|
/* config.c - bdb backend configuration file routine */
|
2000-09-26 05:10:21 +08:00
|
|
|
/* $OpenLDAP$ */
|
2003-11-29 05:08:20 +08:00
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2007-01-03 04:00:42 +08:00
|
|
|
* Copyright 2000-2007 The OpenLDAP Foundation.
|
2003-11-29 05:08:20 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted only as authorized by the OpenLDAP
|
|
|
|
* Public License.
|
|
|
|
*
|
|
|
|
* A copy of this license is available in the file LICENSE in the
|
|
|
|
* top-level directory of the distribution or, alternatively, at
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
2000-09-26 05:10:21 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2005-07-04 13:56:45 +08:00
|
|
|
#include <ac/ctype.h>
|
2000-09-26 05:10:21 +08:00
|
|
|
#include <ac/string.h>
|
2007-10-15 18:17:04 +08:00
|
|
|
#include <ac/errno.h>
|
2000-09-26 05:10:21 +08:00
|
|
|
|
|
|
|
#include "back-bdb.h"
|
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2005-04-01 19:26:43 +08:00
|
|
|
#include "lutil.h"
|
2005-04-22 03:04:31 +08:00
|
|
|
#include "ldap_rq.h"
|
2005-04-01 19:26:43 +08:00
|
|
|
|
2001-12-09 10:34:45 +08:00
|
|
|
#ifdef DB_DIRTY_READ
|
|
|
|
# define SLAP_BDB_ALLOW_DIRTY_READ
|
|
|
|
#endif
|
2001-11-27 12:35:58 +08:00
|
|
|
|
2006-09-26 16:43:01 +08:00
|
|
|
#define bdb_cf_gen BDB_SYMBOL(cf_gen)
|
2005-04-24 00:16:54 +08:00
|
|
|
#define bdb_cf_cleanup BDB_SYMBOL(cf_cleanup)
|
|
|
|
#define bdb_checkpoint BDB_SYMBOL(checkpoint)
|
|
|
|
#define bdb_online_index BDB_SYMBOL(online_index)
|
|
|
|
|
2005-05-09 11:42:51 +08:00
|
|
|
static ConfigDriver bdb_cf_gen;
|
2005-03-02 12:46:50 +08:00
|
|
|
|
|
|
|
enum {
|
|
|
|
BDB_CHKPT = 1,
|
2005-04-01 19:26:43 +08:00
|
|
|
BDB_CONFIG,
|
|
|
|
BDB_DIRECTORY,
|
2005-03-02 12:46:50 +08:00
|
|
|
BDB_NOSYNC,
|
|
|
|
BDB_DIRTYR,
|
|
|
|
BDB_INDEX,
|
|
|
|
BDB_LOCKD,
|
|
|
|
BDB_SSTACK
|
|
|
|
};
|
|
|
|
|
|
|
|
static ConfigTable bdbcfg[] = {
|
2005-04-01 19:26:43 +08:00
|
|
|
{ "directory", "dir", 2, 2, 0, ARG_STRING|ARG_MAGIC|BDB_DIRECTORY,
|
2005-04-11 06:27:50 +08:00
|
|
|
bdb_cf_gen, "( OLcfgDbAt:0.1 NAME 'olcDbDirectory' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Directory for database content' "
|
|
|
|
"EQUALITY caseIgnoreMatch "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
|
2007-09-05 03:32:54 +08:00
|
|
|
{ "cachefree", "size", 2, 2, 0, ARG_UINT|ARG_OFFSET,
|
2005-12-09 08:20:18 +08:00
|
|
|
(void *)offsetof(struct bdb_info, bi_cache.c_minfree),
|
|
|
|
"( OLcfgDbAt:1.11 NAME 'olcDbCacheFree' "
|
|
|
|
"DESC 'Number of extra entries to free when max is reached' "
|
|
|
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
2007-09-05 03:32:54 +08:00
|
|
|
{ "cachesize", "size", 2, 2, 0, ARG_UINT|ARG_OFFSET,
|
2005-03-02 12:46:50 +08:00
|
|
|
(void *)offsetof(struct bdb_info, bi_cache.c_maxsize),
|
2005-04-11 06:27:50 +08:00
|
|
|
"( OLcfgDbAt:1.1 NAME 'olcDbCacheSize' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Entry cache size in entries' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
2005-03-02 12:46:50 +08:00
|
|
|
{ "checkpoint", "kbyte> <min", 3, 3, 0, ARG_MAGIC|BDB_CHKPT,
|
2005-04-11 06:27:50 +08:00
|
|
|
bdb_cf_gen, "( OLcfgDbAt:1.2 NAME 'olcDbCheckpoint' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Database checkpoint interval in kbytes and minutes' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsDirectoryString SINGLE-VALUE )",NULL, NULL },
|
2005-05-03 17:44:46 +08:00
|
|
|
{ "dbconfig", "DB_CONFIG setting", 1, 0, 0, ARG_MAGIC|BDB_CONFIG,
|
2005-04-11 06:27:50 +08:00
|
|
|
bdb_cf_gen, "( OLcfgDbAt:1.3 NAME 'olcDbConfig' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"DESC 'BerkeleyDB DB_CONFIG configuration directives' "
|
2007-09-03 08:41:30 +08:00
|
|
|
"SYNTAX OMsIA5String X-ORDERED 'VALUES' )", NULL, NULL },
|
2005-03-02 12:46:50 +08:00
|
|
|
{ "dbnosync", NULL, 1, 2, 0, ARG_ON_OFF|ARG_MAGIC|BDB_NOSYNC,
|
2005-04-11 06:27:50 +08:00
|
|
|
bdb_cf_gen, "( OLcfgDbAt:1.4 NAME 'olcDbNoSync' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Disable synchronous database writes' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
|
2005-03-02 12:46:50 +08:00
|
|
|
{ "dirtyread", NULL, 1, 2, 0,
|
|
|
|
#ifdef SLAP_BDB_ALLOW_DIRTY_READ
|
|
|
|
ARG_ON_OFF|ARG_MAGIC|BDB_DIRTYR, bdb_cf_gen,
|
|
|
|
#else
|
|
|
|
ARG_IGNORED, NULL,
|
|
|
|
#endif
|
2005-04-11 06:27:50 +08:00
|
|
|
"( OLcfgDbAt:1.5 NAME 'olcDbDirtyRead' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Allow reads of uncommitted data' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
|
2007-09-05 03:32:54 +08:00
|
|
|
{ "dncachesize", "size", 2, 2, 0, ARG_UINT|ARG_OFFSET,
|
2007-08-12 03:29:14 +08:00
|
|
|
(void *)offsetof(struct bdb_info, bi_cache.c_eimax),
|
|
|
|
"( OLcfgDbAt:1.12 NAME 'olcDbDNcacheSize' "
|
|
|
|
"DESC 'DN cache size' "
|
|
|
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
2007-09-05 03:32:54 +08:00
|
|
|
{ "idlcachesize", "size", 2, 2, 0, ARG_UINT|ARG_OFFSET,
|
|
|
|
(void *)offsetof(struct bdb_info, bi_idl_cache_max_size),
|
2005-04-11 06:27:50 +08:00
|
|
|
"( OLcfgDbAt:1.6 NAME 'olcDbIDLcacheSize' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'IDL cache size in IDLs' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
2005-04-09 15:32:51 +08:00
|
|
|
{ "index", "attr> <[pres,eq,approx,sub]", 2, 3, 0, ARG_MAGIC|BDB_INDEX,
|
2005-04-11 06:27:50 +08:00
|
|
|
bdb_cf_gen, "( OLcfgDbAt:0.2 NAME 'olcDbIndex' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Attribute index parameters' "
|
2005-04-22 03:04:31 +08:00
|
|
|
"EQUALITY caseIgnoreMatch "
|
2005-03-02 12:46:50 +08:00
|
|
|
"SYNTAX OMsDirectoryString )", NULL, NULL },
|
|
|
|
{ "linearindex", NULL, 1, 2, 0, ARG_ON_OFF|ARG_OFFSET,
|
|
|
|
(void *)offsetof(struct bdb_info, bi_linear_index),
|
2005-04-11 06:27:50 +08:00
|
|
|
"( OLcfgDbAt:1.7 NAME 'olcDbLinearIndex' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Index attributes one at a time' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
|
2005-03-02 12:46:50 +08:00
|
|
|
{ "lockdetect", "policy", 2, 2, 0, ARG_MAGIC|BDB_LOCKD,
|
2005-04-11 06:27:50 +08:00
|
|
|
bdb_cf_gen, "( OLcfgDbAt:1.8 NAME 'olcDbLockDetect' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Deadlock detection algorithm' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
|
2005-03-21 19:14:37 +08:00
|
|
|
{ "mode", "mode", 2, 2, 0, ARG_INT|ARG_OFFSET,
|
2005-03-02 12:46:50 +08:00
|
|
|
(void *)offsetof(struct bdb_info, bi_dbenv_mode),
|
2005-04-11 06:27:50 +08:00
|
|
|
"( OLcfgDbAt:0.3 NAME 'olcDbMode' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Unix permissions of database files' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
2005-03-02 12:46:50 +08:00
|
|
|
{ "searchstack", "depth", 2, 2, 0, ARG_INT|ARG_MAGIC|BDB_SSTACK,
|
2005-04-11 06:27:50 +08:00
|
|
|
bdb_cf_gen, "( OLcfgDbAt:1.9 NAME 'olcDbSearchStack' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Depth of search stack in IDLs' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
2007-09-05 03:32:54 +08:00
|
|
|
{ "shm_key", "key", 2, 2, 0, ARG_LONG|ARG_OFFSET,
|
2005-03-02 12:46:50 +08:00
|
|
|
(void *)offsetof(struct bdb_info, bi_shm_key),
|
2005-04-11 06:27:50 +08:00
|
|
|
"( OLcfgDbAt:1.10 NAME 'olcDbShmKey' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'Key for shared memory region' "
|
2005-04-01 19:26:43 +08:00
|
|
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
2005-03-02 12:46:50 +08:00
|
|
|
{ NULL, NULL, 0, 0, 0, ARG_IGNORED,
|
|
|
|
NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static ConfigOCs bdbocs[] = {
|
2005-07-01 08:17:51 +08:00
|
|
|
{
|
|
|
|
#ifdef BDB_HIER
|
|
|
|
"( OLcfgDbOc:1.2 "
|
|
|
|
"NAME 'olcHdbConfig' "
|
|
|
|
"DESC 'HDB backend configuration' "
|
|
|
|
#else
|
|
|
|
"( OLcfgDbOc:1.1 "
|
2005-04-11 06:27:50 +08:00
|
|
|
"NAME 'olcBdbConfig' "
|
2005-03-02 12:46:50 +08:00
|
|
|
"DESC 'BDB backend configuration' "
|
2005-07-01 08:17:51 +08:00
|
|
|
#endif
|
2005-03-20 17:13:48 +08:00
|
|
|
"SUP olcDatabaseConfig "
|
2005-04-11 06:27:50 +08:00
|
|
|
"MUST olcDbDirectory "
|
|
|
|
"MAY ( olcDbCacheSize $ olcDbCheckpoint $ olcDbConfig $ "
|
|
|
|
"olcDbNoSync $ olcDbDirtyRead $ olcDbIDLcacheSize $ "
|
|
|
|
"olcDbIndex $ olcDbLinearIndex $ olcDbLockDetect $ "
|
2005-12-09 08:20:18 +08:00
|
|
|
"olcDbMode $ olcDbSearchStack $ olcDbShmKey $ "
|
2007-08-12 03:29:14 +08:00
|
|
|
"olcDbCacheFree $ olcDbDNcacheSize ) )",
|
2005-05-09 13:02:23 +08:00
|
|
|
Cft_Database, bdbcfg },
|
2005-03-20 17:13:48 +08:00
|
|
|
{ NULL, 0, NULL }
|
2005-03-02 12:46:50 +08:00
|
|
|
};
|
|
|
|
|
2005-03-02 22:49:54 +08:00
|
|
|
static slap_verbmasks bdb_lockd[] = {
|
2005-03-03 00:35:59 +08:00
|
|
|
{ BER_BVC("default"), DB_LOCK_DEFAULT },
|
|
|
|
{ BER_BVC("oldest"), DB_LOCK_OLDEST },
|
|
|
|
{ BER_BVC("random"), DB_LOCK_RANDOM },
|
|
|
|
{ BER_BVC("youngest"), DB_LOCK_YOUNGEST },
|
|
|
|
{ BER_BVC("fewest"), DB_LOCK_MINLOCKS },
|
|
|
|
{ BER_BVNULL, 0 }
|
2005-03-02 12:46:50 +08:00
|
|
|
};
|
|
|
|
|
2005-04-22 23:32:09 +08:00
|
|
|
/* perform periodic checkpoints */
|
|
|
|
static void *
|
|
|
|
bdb_checkpoint( void *ctx, void *arg )
|
|
|
|
{
|
|
|
|
struct re_s *rtask = arg;
|
|
|
|
struct bdb_info *bdb = rtask->arg;
|
|
|
|
|
|
|
|
TXN_CHECKPOINT( bdb->bi_dbenv, bdb->bi_txn_cp_kbyte,
|
|
|
|
bdb->bi_txn_cp_min, 0 );
|
|
|
|
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
|
|
|
|
ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
|
|
|
|
ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-04-22 03:04:31 +08:00
|
|
|
/* reindex entries on the fly */
|
|
|
|
static void *
|
|
|
|
bdb_online_index( void *ctx, void *arg )
|
|
|
|
{
|
|
|
|
struct re_s *rtask = arg;
|
|
|
|
BackendDB *be = rtask->arg;
|
|
|
|
struct bdb_info *bdb = be->be_private;
|
|
|
|
|
|
|
|
Connection conn = {0};
|
2005-10-13 07:17:28 +08:00
|
|
|
OperationBuffer opbuf;
|
2007-05-19 07:54:26 +08:00
|
|
|
Operation *op;
|
2005-04-22 03:04:31 +08:00
|
|
|
|
|
|
|
DBC *curs;
|
|
|
|
DBT key, data;
|
|
|
|
DB_TXN *txn;
|
|
|
|
DB_LOCK lock;
|
2007-08-18 04:33:46 +08:00
|
|
|
BDB_LOCKER locker;
|
2005-04-22 03:04:31 +08:00
|
|
|
ID id, nid;
|
|
|
|
EntryInfo *ei;
|
|
|
|
int rc, getnext = 1;
|
2005-12-16 08:44:13 +08:00
|
|
|
int i;
|
2005-04-22 03:04:31 +08:00
|
|
|
|
2007-05-19 07:54:26 +08:00
|
|
|
connection_fake_init( &conn, &opbuf, ctx );
|
|
|
|
op = &opbuf.ob_op;
|
2005-04-22 03:04:31 +08:00
|
|
|
|
|
|
|
op->o_bd = be;
|
|
|
|
|
|
|
|
DBTzero( &key );
|
|
|
|
DBTzero( &data );
|
|
|
|
|
|
|
|
id = 1;
|
|
|
|
key.data = &nid;
|
|
|
|
key.size = key.ulen = sizeof(ID);
|
|
|
|
key.flags = DB_DBT_USERMEM;
|
|
|
|
|
|
|
|
data.flags = DB_DBT_USERMEM | DB_DBT_PARTIAL;
|
|
|
|
data.dlen = data.ulen = 0;
|
|
|
|
|
|
|
|
while ( 1 ) {
|
2005-04-22 03:23:33 +08:00
|
|
|
if ( slapd_shutdown )
|
|
|
|
break;
|
|
|
|
|
2005-04-22 03:04:31 +08:00
|
|
|
rc = TXN_BEGIN( bdb->bi_dbenv, NULL, &txn, bdb->bi_db_opflags );
|
|
|
|
if ( rc )
|
|
|
|
break;
|
|
|
|
locker = TXN_ID( txn );
|
|
|
|
if ( getnext ) {
|
|
|
|
getnext = 0;
|
|
|
|
BDB_ID2DISK( id, &nid );
|
|
|
|
rc = bdb->bi_id2entry->bdi_db->cursor(
|
|
|
|
bdb->bi_id2entry->bdi_db, txn, &curs, bdb->bi_db_opflags );
|
|
|
|
if ( rc ) {
|
|
|
|
TXN_ABORT( txn );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
rc = curs->c_get( curs, &key, &data, DB_SET_RANGE );
|
|
|
|
curs->c_close( curs );
|
|
|
|
if ( rc ) {
|
|
|
|
TXN_ABORT( txn );
|
|
|
|
if ( rc == DB_NOTFOUND )
|
|
|
|
rc = 0;
|
|
|
|
if ( rc == DB_LOCK_DEADLOCK ) {
|
|
|
|
ldap_pvt_thread_yield();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
BDB_DISK2ID( &nid, &id );
|
|
|
|
}
|
|
|
|
|
|
|
|
ei = NULL;
|
|
|
|
rc = bdb_cache_find_id( op, txn, id, &ei, 0, locker, &lock );
|
|
|
|
if ( rc ) {
|
|
|
|
TXN_ABORT( txn );
|
|
|
|
if ( rc == DB_LOCK_DEADLOCK ) {
|
|
|
|
ldap_pvt_thread_yield();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ( rc == DB_NOTFOUND ) {
|
2005-04-22 03:46:47 +08:00
|
|
|
id++;
|
2005-04-22 03:04:31 +08:00
|
|
|
getnext = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( ei->bei_e ) {
|
|
|
|
rc = bdb_index_entry( op, txn, BDB_INDEX_UPDATE_OP, ei->bei_e );
|
|
|
|
if ( rc == DB_LOCK_DEADLOCK ) {
|
|
|
|
TXN_ABORT( txn );
|
|
|
|
ldap_pvt_thread_yield();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ( rc == 0 ) {
|
|
|
|
rc = TXN_COMMIT( txn, 0 );
|
|
|
|
txn = NULL;
|
|
|
|
}
|
|
|
|
if ( rc )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
id++;
|
|
|
|
getnext = 1;
|
|
|
|
}
|
2005-07-15 03:52:08 +08:00
|
|
|
|
2005-12-16 08:44:13 +08:00
|
|
|
for ( i = 0; i < bdb->bi_nattrs; i++ ) {
|
2006-01-06 05:22:50 +08:00
|
|
|
if ( bdb->bi_attrs[ i ]->ai_indexmask & BDB_INDEX_DELETING
|
|
|
|
|| bdb->bi_attrs[ i ]->ai_newmask == 0 )
|
|
|
|
{
|
2005-12-16 08:44:13 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
bdb->bi_attrs[ i ]->ai_indexmask = bdb->bi_attrs[ i ]->ai_newmask;
|
|
|
|
bdb->bi_attrs[ i ]->ai_newmask = 0;
|
|
|
|
}
|
|
|
|
|
2005-04-22 03:04:31 +08:00
|
|
|
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
|
|
|
|
ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
|
2005-04-24 00:16:54 +08:00
|
|
|
bdb->bi_index_task = NULL;
|
2005-04-22 03:04:31 +08:00
|
|
|
ldap_pvt_runqueue_remove( &slapd_rq, rtask );
|
|
|
|
ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Cleanup loose ends after Modify completes */
|
|
|
|
static int
|
|
|
|
bdb_cf_cleanup( ConfigArgs *c )
|
|
|
|
{
|
|
|
|
struct bdb_info *bdb = c->be->be_private;
|
2005-04-23 05:35:45 +08:00
|
|
|
int rc = 0;
|
2005-04-22 03:04:31 +08:00
|
|
|
|
|
|
|
if ( bdb->bi_flags & BDB_UPD_CONFIG ) {
|
|
|
|
if ( bdb->bi_db_config ) {
|
|
|
|
int i;
|
|
|
|
FILE *f = fopen( bdb->bi_db_config_path, "w" );
|
|
|
|
if ( f ) {
|
|
|
|
for (i=0; bdb->bi_db_config[i].bv_val; i++)
|
|
|
|
fprintf( f, "%s\n", bdb->bi_db_config[i].bv_val );
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
unlink( bdb->bi_db_config_path );
|
|
|
|
}
|
|
|
|
bdb->bi_flags ^= BDB_UPD_CONFIG;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bdb->bi_flags & BDB_DEL_INDEX ) {
|
|
|
|
bdb_attr_flush( bdb );
|
|
|
|
bdb->bi_flags ^= BDB_DEL_INDEX;
|
|
|
|
}
|
2005-04-24 00:16:54 +08:00
|
|
|
|
2005-04-23 05:35:45 +08:00
|
|
|
if ( bdb->bi_flags & BDB_RE_OPEN ) {
|
|
|
|
bdb->bi_flags ^= BDB_RE_OPEN;
|
2007-07-26 01:21:05 +08:00
|
|
|
rc = c->be->bd_info->bi_db_close( c->be, NULL );
|
2005-04-23 05:35:45 +08:00
|
|
|
if ( rc == 0 )
|
2007-07-26 01:21:05 +08:00
|
|
|
rc = c->be->bd_info->bi_db_open( c->be, NULL );
|
2005-04-23 05:35:45 +08:00
|
|
|
/* If this fails, we need to restart */
|
2005-04-24 00:16:54 +08:00
|
|
|
if ( rc ) {
|
|
|
|
slapd_shutdown = 2;
|
2007-10-15 18:17:04 +08:00
|
|
|
snprintf( c->cr_msg, sizeof( c->cr_msg ),
|
|
|
|
"failed to reopen database, rc=%d", rc );
|
2005-04-24 00:16:54 +08:00
|
|
|
Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_cf_cleanup)
|
2007-10-15 18:17:04 +08:00
|
|
|
": %s\n", c->cr_msg, 0, 0 );
|
|
|
|
rc = LDAP_OTHER;
|
2005-04-24 00:16:54 +08:00
|
|
|
}
|
2005-04-23 05:35:45 +08:00
|
|
|
}
|
|
|
|
return rc;
|
2005-04-22 03:04:31 +08:00
|
|
|
}
|
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
static int
|
2006-09-26 16:43:01 +08:00
|
|
|
bdb_cf_gen( ConfigArgs *c )
|
2005-03-02 12:46:50 +08:00
|
|
|
{
|
|
|
|
struct bdb_info *bdb = c->be->be_private;
|
|
|
|
int rc;
|
|
|
|
|
2005-03-15 16:57:34 +08:00
|
|
|
if ( c->op == SLAP_CONFIG_EMIT ) {
|
2005-03-02 12:46:50 +08:00
|
|
|
rc = 0;
|
|
|
|
switch( c->type ) {
|
|
|
|
case BDB_CHKPT:
|
2006-09-26 16:43:01 +08:00
|
|
|
if ( bdb->bi_txn_cp ) {
|
2005-03-02 12:46:50 +08:00
|
|
|
char buf[64];
|
|
|
|
struct berval bv;
|
|
|
|
bv.bv_len = sprintf( buf, "%d %d", bdb->bi_txn_cp_kbyte,
|
|
|
|
bdb->bi_txn_cp_min );
|
|
|
|
bv.bv_val = buf;
|
|
|
|
value_add_one( &c->rvalue_vals, &bv );
|
|
|
|
} else{
|
|
|
|
rc = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-04-01 19:26:43 +08:00
|
|
|
case BDB_DIRECTORY:
|
|
|
|
if ( bdb->bi_dbenv_home ) {
|
|
|
|
c->value_string = ch_strdup( bdb->bi_dbenv_home );
|
|
|
|
} else {
|
|
|
|
rc = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BDB_CONFIG:
|
2007-09-03 07:53:29 +08:00
|
|
|
if ( !( bdb->bi_flags & BDB_IS_OPEN )
|
2006-09-26 16:43:01 +08:00
|
|
|
&& !bdb->bi_db_config )
|
|
|
|
{
|
2005-04-24 01:21:45 +08:00
|
|
|
char buf[SLAP_TEXT_BUFLEN];
|
|
|
|
FILE *f = fopen( bdb->bi_db_config_path, "r" );
|
|
|
|
struct berval bv;
|
|
|
|
|
|
|
|
if ( f ) {
|
|
|
|
bdb->bi_flags |= BDB_HAS_CONFIG;
|
|
|
|
while ( fgets( buf, sizeof(buf), f )) {
|
|
|
|
ber_str2bv( buf, 0, 1, &bv );
|
2005-07-18 22:11:55 +08:00
|
|
|
if ( bv.bv_len > 0 && bv.bv_val[bv.bv_len-1] == '\n' ) {
|
2005-04-24 01:21:45 +08:00
|
|
|
bv.bv_len--;
|
|
|
|
bv.bv_val[bv.bv_len] = '\0';
|
|
|
|
}
|
|
|
|
/* shouldn't need this, but ... */
|
2005-07-18 22:11:55 +08:00
|
|
|
if ( bv.bv_len > 0 && bv.bv_val[bv.bv_len-1] == '\r' ) {
|
2005-04-24 01:21:45 +08:00
|
|
|
bv.bv_len--;
|
|
|
|
bv.bv_val[bv.bv_len] = '\0';
|
|
|
|
}
|
|
|
|
ber_bvarray_add( &bdb->bi_db_config, &bv );
|
|
|
|
}
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
}
|
2005-04-01 19:26:43 +08:00
|
|
|
if ( bdb->bi_db_config ) {
|
|
|
|
int i;
|
|
|
|
struct berval bv;
|
|
|
|
|
|
|
|
bv.bv_val = c->log;
|
|
|
|
for (i=0; !BER_BVISNULL(&bdb->bi_db_config[i]); i++) {
|
|
|
|
bv.bv_len = sprintf( bv.bv_val, "{%d}%s", i,
|
|
|
|
bdb->bi_db_config[i].bv_val );
|
|
|
|
value_add_one( &c->rvalue_vals, &bv );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !c->rvalue_vals ) rc = 1;
|
|
|
|
break;
|
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
case BDB_NOSYNC:
|
|
|
|
if ( bdb->bi_dbenv_xflags & DB_TXN_NOSYNC )
|
|
|
|
c->value_int = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BDB_INDEX:
|
2005-03-03 00:35:59 +08:00
|
|
|
bdb_attr_index_unparse( bdb, &c->rvalue_vals );
|
|
|
|
if ( !c->rvalue_vals ) rc = 1;
|
2005-03-02 12:46:50 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BDB_LOCKD:
|
|
|
|
rc = 1;
|
|
|
|
if ( bdb->bi_lock_detect != DB_LOCK_DEFAULT ) {
|
|
|
|
int i;
|
2005-03-03 00:35:59 +08:00
|
|
|
for (i=0; !BER_BVISNULL(&bdb_lockd[i].word); i++) {
|
2005-03-02 12:46:50 +08:00
|
|
|
if ( bdb->bi_lock_detect == bdb_lockd[i].mask ) {
|
2005-03-03 00:35:59 +08:00
|
|
|
value_add_one( &c->rvalue_vals, &bdb_lockd[i].word );
|
2005-03-02 12:46:50 +08:00
|
|
|
rc = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BDB_SSTACK:
|
|
|
|
c->value_int = bdb->bi_search_stack_depth;
|
|
|
|
break;
|
2000-09-28 12:09:13 +08:00
|
|
|
}
|
2005-03-02 12:46:50 +08:00
|
|
|
return rc;
|
2005-04-21 20:45:25 +08:00
|
|
|
} else if ( c->op == LDAP_MOD_DELETE ) {
|
|
|
|
rc = 0;
|
|
|
|
switch( c->type ) {
|
|
|
|
/* single-valued no-ops */
|
|
|
|
case BDB_LOCKD:
|
|
|
|
case BDB_SSTACK:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BDB_CHKPT:
|
2005-04-22 23:32:09 +08:00
|
|
|
if ( bdb->bi_txn_cp_task ) {
|
|
|
|
struct re_s *re = bdb->bi_txn_cp_task;
|
|
|
|
bdb->bi_txn_cp_task = NULL;
|
2006-09-26 16:43:01 +08:00
|
|
|
if ( ldap_pvt_runqueue_isrunning( &slapd_rq, re ) )
|
2005-04-22 23:32:09 +08:00
|
|
|
ldap_pvt_runqueue_stoptask( &slapd_rq, re );
|
|
|
|
ldap_pvt_runqueue_remove( &slapd_rq, re );
|
|
|
|
}
|
2005-04-21 20:45:25 +08:00
|
|
|
bdb->bi_txn_cp = 0;
|
|
|
|
break;
|
|
|
|
case BDB_CONFIG:
|
2005-04-22 03:04:31 +08:00
|
|
|
if ( c->valx < 0 ) {
|
|
|
|
ber_bvarray_free( bdb->bi_db_config );
|
|
|
|
bdb->bi_db_config = NULL;
|
|
|
|
} else {
|
|
|
|
int i = c->valx;
|
|
|
|
ch_free( bdb->bi_db_config[i].bv_val );
|
|
|
|
for (; bdb->bi_db_config[i].bv_val; i++)
|
|
|
|
bdb->bi_db_config[i] = bdb->bi_db_config[i+1];
|
|
|
|
}
|
|
|
|
bdb->bi_flags |= BDB_UPD_CONFIG;
|
|
|
|
c->cleanup = bdb_cf_cleanup;
|
2005-04-21 20:45:25 +08:00
|
|
|
break;
|
|
|
|
case BDB_DIRECTORY:
|
2005-04-23 05:35:45 +08:00
|
|
|
bdb->bi_flags |= BDB_RE_OPEN;
|
|
|
|
bdb->bi_flags ^= BDB_HAS_CONFIG;
|
|
|
|
ch_free( bdb->bi_dbenv_home );
|
|
|
|
bdb->bi_dbenv_home = NULL;
|
|
|
|
ch_free( bdb->bi_db_config_path );
|
|
|
|
bdb->bi_db_config_path = NULL;
|
|
|
|
c->cleanup = bdb_cf_cleanup;
|
2005-04-23 07:02:01 +08:00
|
|
|
ldap_pvt_thread_pool_purgekey( bdb->bi_dbenv );
|
2005-04-21 20:45:25 +08:00
|
|
|
break;
|
|
|
|
case BDB_NOSYNC:
|
|
|
|
bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC, 0 );
|
|
|
|
break;
|
2005-12-16 07:46:23 +08:00
|
|
|
case BDB_INDEX:
|
|
|
|
if ( c->valx == -1 ) {
|
2005-12-16 08:04:51 +08:00
|
|
|
int i;
|
|
|
|
|
2005-12-16 07:46:23 +08:00
|
|
|
/* delete all (FIXME) */
|
2005-12-16 08:04:51 +08:00
|
|
|
for ( i = 0; i < bdb->bi_nattrs; i++ ) {
|
|
|
|
bdb->bi_attrs[i]->ai_indexmask |= BDB_INDEX_DELETING;
|
|
|
|
}
|
|
|
|
bdb->bi_flags |= BDB_DEL_INDEX;
|
|
|
|
c->cleanup = bdb_cf_cleanup;
|
2005-12-16 07:46:23 +08:00
|
|
|
|
2005-04-21 20:45:25 +08:00
|
|
|
} else {
|
2005-12-16 07:46:23 +08:00
|
|
|
struct berval bv, def = BER_BVC("default");
|
|
|
|
char *ptr;
|
|
|
|
|
2006-04-02 07:44:42 +08:00
|
|
|
for (ptr = c->line; !isspace( (unsigned char) *ptr ); ptr++);
|
2005-12-16 07:46:23 +08:00
|
|
|
|
|
|
|
bv.bv_val = c->line;
|
|
|
|
bv.bv_len = ptr - bv.bv_val;
|
|
|
|
if ( bvmatch( &bv, &def )) {
|
|
|
|
bdb->bi_defaultmask = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
int i;
|
|
|
|
char **attrs;
|
|
|
|
char sep;
|
|
|
|
|
|
|
|
sep = bv.bv_val[ bv.bv_len ];
|
|
|
|
bv.bv_val[ bv.bv_len ] = '\0';
|
|
|
|
attrs = ldap_str2charray( bv.bv_val, "," );
|
|
|
|
|
|
|
|
for ( i = 0; attrs[ i ]; i++ ) {
|
|
|
|
AttributeDescription *ad = NULL;
|
|
|
|
const char *text;
|
|
|
|
AttrInfo *ai;
|
|
|
|
|
|
|
|
slap_str2ad( attrs[ i ], &ad, &text );
|
|
|
|
/* if we got here... */
|
|
|
|
assert( ad != NULL );
|
|
|
|
|
|
|
|
ai = bdb_attr_mask( bdb, ad );
|
|
|
|
/* if we got here... */
|
|
|
|
assert( ai != NULL );
|
|
|
|
|
|
|
|
ai->ai_indexmask |= BDB_INDEX_DELETING;
|
|
|
|
bdb->bi_flags |= BDB_DEL_INDEX;
|
|
|
|
c->cleanup = bdb_cf_cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
bv.bv_val[ bv.bv_len ] = sep;
|
|
|
|
ldap_charray_free( attrs );
|
2005-04-22 03:04:31 +08:00
|
|
|
}
|
2005-04-21 20:45:25 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return rc;
|
2005-03-02 12:46:50 +08:00
|
|
|
}
|
2005-04-21 20:45:25 +08:00
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
switch( c->type ) {
|
2005-11-24 09:10:05 +08:00
|
|
|
case BDB_CHKPT: {
|
|
|
|
long l;
|
2000-09-28 12:09:13 +08:00
|
|
|
bdb->bi_txn_cp = 1;
|
2005-11-24 09:10:05 +08:00
|
|
|
if ( lutil_atolx( &l, c->argv[1], 0 ) != 0 ) {
|
|
|
|
fprintf( stderr, "%s: "
|
|
|
|
"invalid kbyte \"%s\" in \"checkpoint\".\n",
|
|
|
|
c->log, c->argv[1] );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bdb->bi_txn_cp_kbyte = l;
|
|
|
|
if ( lutil_atolx( &l, c->argv[2], 0 ) != 0 ) {
|
|
|
|
fprintf( stderr, "%s: "
|
|
|
|
"invalid minutes \"%s\" in \"checkpoint\".\n",
|
|
|
|
c->log, c->argv[2] );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bdb->bi_txn_cp_min = l;
|
2005-04-22 23:32:09 +08:00
|
|
|
/* If we're in server mode and time-based checkpointing is enabled,
|
|
|
|
* submit a task to perform periodic checkpoints.
|
|
|
|
*/
|
|
|
|
if ((slapMode & SLAP_SERVER_MODE) && bdb->bi_txn_cp_min ) {
|
|
|
|
struct re_s *re = bdb->bi_txn_cp_task;
|
2005-06-17 04:01:41 +08:00
|
|
|
if ( re ) {
|
2005-04-22 23:32:09 +08:00
|
|
|
re->interval.tv_sec = bdb->bi_txn_cp_min * 60;
|
2005-06-17 04:01:41 +08:00
|
|
|
} else {
|
|
|
|
if ( c->be->be_suffix == NULL || BER_BVISNULL( &c->be->be_suffix[0] ) ) {
|
|
|
|
fprintf( stderr, "%s: "
|
|
|
|
"\"checkpoint\" must occur after \"suffix\".\n",
|
|
|
|
c->log );
|
|
|
|
return 1;
|
|
|
|
}
|
2005-04-22 23:32:09 +08:00
|
|
|
bdb->bi_txn_cp_task = ldap_pvt_runqueue_insert( &slapd_rq,
|
2005-04-23 08:28:43 +08:00
|
|
|
bdb->bi_txn_cp_min * 60, bdb_checkpoint, bdb,
|
2005-04-24 00:16:54 +08:00
|
|
|
LDAP_XSTRING(bdb_checkpoint), c->be->be_suffix[0].bv_val );
|
2005-06-17 04:01:41 +08:00
|
|
|
}
|
2005-04-22 23:32:09 +08:00
|
|
|
}
|
2005-11-24 09:10:05 +08:00
|
|
|
} break;
|
2000-09-29 08:18:29 +08:00
|
|
|
|
2005-04-01 19:26:43 +08:00
|
|
|
case BDB_CONFIG: {
|
2005-07-01 10:08:14 +08:00
|
|
|
char *ptr = c->line;
|
2005-04-01 19:26:43 +08:00
|
|
|
struct berval bv;
|
2005-07-01 10:08:14 +08:00
|
|
|
|
|
|
|
if ( c->op == SLAP_CONFIG_ADD ) {
|
|
|
|
ptr += STRLENOF("dbconfig");
|
2006-04-02 07:44:42 +08:00
|
|
|
while (!isspace((unsigned char)*ptr)) ptr++;
|
|
|
|
while (isspace((unsigned char)*ptr)) ptr++;
|
2005-07-01 10:08:14 +08:00
|
|
|
}
|
2005-07-01 10:18:10 +08:00
|
|
|
|
2005-04-22 03:04:31 +08:00
|
|
|
if ( bdb->bi_flags & BDB_IS_OPEN ) {
|
|
|
|
bdb->bi_flags |= BDB_UPD_CONFIG;
|
|
|
|
c->cleanup = bdb_cf_cleanup;
|
|
|
|
} else {
|
2005-04-01 19:26:43 +08:00
|
|
|
/* If we're just starting up...
|
|
|
|
*/
|
|
|
|
FILE *f;
|
|
|
|
/* If a DB_CONFIG file exists, or we don't know the path
|
|
|
|
* to the DB_CONFIG file, ignore these directives
|
|
|
|
*/
|
2005-04-22 03:04:31 +08:00
|
|
|
if (( bdb->bi_flags & BDB_HAS_CONFIG ) || !bdb->bi_db_config_path )
|
2005-04-01 19:26:43 +08:00
|
|
|
break;
|
|
|
|
f = fopen( bdb->bi_db_config_path, "a" );
|
|
|
|
if ( f ) {
|
|
|
|
/* FIXME: EBCDIC probably needs special handling */
|
|
|
|
fprintf( f, "%s\n", ptr );
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ber_str2bv( ptr, 0, 1, &bv );
|
|
|
|
ber_bvarray_add( &bdb->bi_db_config, &bv );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BDB_DIRECTORY: {
|
|
|
|
FILE *f;
|
2007-10-15 18:17:04 +08:00
|
|
|
char *ptr, *testpath;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
len = strlen( c->value_string );
|
|
|
|
testpath = ch_malloc( len + STRLENOF(LDAP_DIRSEP) + STRLENOF("DUMMY") + 1 );
|
|
|
|
ptr = lutil_strcopy( testpath, c->value_string );
|
|
|
|
*ptr++ = LDAP_DIRSEP[0];
|
|
|
|
strcpy( ptr, "DUMMY" );
|
|
|
|
f = fopen( testpath, "w" );
|
|
|
|
if ( f ) {
|
|
|
|
fclose( f );
|
|
|
|
unlink( testpath );
|
|
|
|
}
|
|
|
|
ch_free( testpath );
|
|
|
|
if ( !f ) {
|
2007-10-15 18:22:51 +08:00
|
|
|
snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s: invalid path: %s",
|
|
|
|
c->log, strerror( errno ));
|
|
|
|
Debug( LDAP_DEBUG_ANY, "%s\n", c->cr_msg, 0, 0 );
|
2007-10-15 18:17:04 +08:00
|
|
|
return -1;
|
|
|
|
}
|
2005-04-01 19:26:43 +08:00
|
|
|
|
2005-04-23 05:35:45 +08:00
|
|
|
if ( bdb->bi_dbenv_home )
|
|
|
|
ch_free( bdb->bi_dbenv_home );
|
2005-04-01 19:26:43 +08:00
|
|
|
bdb->bi_dbenv_home = c->value_string;
|
|
|
|
|
|
|
|
/* See if a DB_CONFIG file already exists here */
|
2005-04-23 05:35:45 +08:00
|
|
|
if ( bdb->bi_db_config_path )
|
|
|
|
ch_free( bdb->bi_db_config_path );
|
2007-10-15 18:17:04 +08:00
|
|
|
bdb->bi_db_config_path = ch_malloc( len +
|
2005-04-09 03:39:58 +08:00
|
|
|
STRLENOF(LDAP_DIRSEP) + STRLENOF("DB_CONFIG") + 1 );
|
2005-04-01 19:26:43 +08:00
|
|
|
ptr = lutil_strcopy( bdb->bi_db_config_path, bdb->bi_dbenv_home );
|
|
|
|
*ptr++ = LDAP_DIRSEP[0];
|
|
|
|
strcpy( ptr, "DB_CONFIG" );
|
|
|
|
|
|
|
|
f = fopen( bdb->bi_db_config_path, "r" );
|
|
|
|
if ( f ) {
|
2005-04-22 03:04:31 +08:00
|
|
|
bdb->bi_flags |= BDB_HAS_CONFIG;
|
2005-04-01 19:26:43 +08:00
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
case BDB_NOSYNC:
|
|
|
|
if ( c->value_int )
|
|
|
|
bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
|
|
|
|
else
|
|
|
|
bdb->bi_dbenv_xflags &= ~DB_TXN_NOSYNC;
|
2005-04-22 03:04:31 +08:00
|
|
|
if ( bdb->bi_flags & BDB_IS_OPEN ) {
|
2005-04-21 20:45:25 +08:00
|
|
|
bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC,
|
|
|
|
c->value_int );
|
|
|
|
}
|
2005-03-02 12:46:50 +08:00
|
|
|
break;
|
2000-09-29 08:18:29 +08:00
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
case BDB_INDEX:
|
|
|
|
rc = bdb_attr_index_config( bdb, c->fname, c->lineno,
|
|
|
|
c->argc - 1, &c->argv[1] );
|
2000-09-29 08:18:29 +08:00
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
if( rc != LDAP_SUCCESS ) return 1;
|
2005-04-24 00:16:54 +08:00
|
|
|
if (( bdb->bi_flags & BDB_IS_OPEN ) && !bdb->bi_index_task ) {
|
2005-04-24 00:58:23 +08:00
|
|
|
/* Start the task as soon as we finish here. Set a long
|
|
|
|
* interval (10 hours) so that it only gets scheduled once.
|
|
|
|
*/
|
2005-06-17 04:01:41 +08:00
|
|
|
if ( c->be->be_suffix == NULL || BER_BVISNULL( &c->be->be_suffix[0] ) ) {
|
|
|
|
fprintf( stderr, "%s: "
|
|
|
|
"\"index\" must occur after \"suffix\".\n",
|
|
|
|
c->log );
|
|
|
|
return 1;
|
|
|
|
}
|
2005-04-24 00:58:23 +08:00
|
|
|
bdb->bi_index_task = ldap_pvt_runqueue_insert( &slapd_rq, 36000,
|
2005-04-23 08:28:43 +08:00
|
|
|
bdb_online_index, c->be,
|
2005-04-24 00:16:54 +08:00
|
|
|
LDAP_XSTRING(bdb_online_index), c->be->be_suffix[0].bv_val );
|
2005-04-21 20:45:25 +08:00
|
|
|
}
|
2005-03-02 12:46:50 +08:00
|
|
|
break;
|
2002-01-18 21:32:01 +08:00
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
case BDB_LOCKD:
|
2005-03-02 22:49:54 +08:00
|
|
|
rc = verb_to_mask( c->argv[1], bdb_lockd );
|
2005-03-03 00:35:59 +08:00
|
|
|
if ( BER_BVISNULL(&bdb_lockd[rc].word) ) {
|
2005-03-02 12:46:50 +08:00
|
|
|
fprintf( stderr, "%s: "
|
2002-09-19 09:13:27 +08:00
|
|
|
"bad policy (%s) in \"lockDetect <policy>\" line\n",
|
2005-03-02 12:46:50 +08:00
|
|
|
c->log, c->argv[1] );
|
2000-09-26 05:10:21 +08:00
|
|
|
return 1;
|
2003-11-10 10:44:25 +08:00
|
|
|
}
|
2005-03-02 12:46:50 +08:00
|
|
|
bdb->bi_lock_detect = rc;
|
|
|
|
break;
|
2002-01-25 15:19:01 +08:00
|
|
|
|
2005-03-02 12:46:50 +08:00
|
|
|
case BDB_SSTACK:
|
|
|
|
if ( c->value_int < MINIMUM_SEARCH_STACK_DEPTH ) {
|
2003-04-05 18:05:27 +08:00
|
|
|
fprintf( stderr,
|
2005-03-02 12:46:50 +08:00
|
|
|
"%s: depth %d too small, using %d\n",
|
|
|
|
c->log, c->value_int, MINIMUM_SEARCH_STACK_DEPTH );
|
|
|
|
c->value_int = MINIMUM_SEARCH_STACK_DEPTH;
|
2003-04-05 18:05:27 +08:00
|
|
|
}
|
2005-03-02 12:46:50 +08:00
|
|
|
bdb->bi_search_stack_depth = c->value_int;
|
|
|
|
break;
|
2000-09-26 05:10:21 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2005-03-02 12:46:50 +08:00
|
|
|
|
|
|
|
int bdb_back_init_cf( BackendInfo *bi )
|
|
|
|
{
|
|
|
|
int rc;
|
2005-05-09 11:42:51 +08:00
|
|
|
bi->bi_cf_ocs = bdbocs;
|
2005-03-02 12:46:50 +08:00
|
|
|
|
2005-03-18 07:07:44 +08:00
|
|
|
rc = config_register_schema( bdbcfg, bdbocs );
|
2005-03-02 12:46:50 +08:00
|
|
|
if ( rc ) return rc;
|
2005-03-18 07:07:44 +08:00
|
|
|
return 0;
|
2005-03-02 12:46:50 +08:00
|
|
|
}
|