Add an LDBM backend "directory" directive (in addition to

the existing database "directory" directive) to allow setting
of a DB_ENV directory.  Should likely be database specific.
This commit is contained in:
Kurt Zeilenga 2001-05-29 01:51:37 +00:00
parent 3ca26377c0
commit 351e436dcf
13 changed files with 125 additions and 16 deletions

View File

@ -1,5 +1,5 @@
.TH SLAPD.CONF 5 "17 October 2000" "OpenLDAP LDVERSION"
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.TH SLAPD.CONF 5 "28 May 2001" "OpenLDAP LDVERSION"
.\" Copyright 1998-2001 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.\" $OpenLDAP$
.SH NAME
@ -56,9 +56,10 @@ backslash character (`\\'), the character should be preceded by a
backslash character.
.LP
The specific configuration options available are discussed below in the
Global Configuration Options, General Backend Options, LDBM
Backend-Specific Options, Shell Backend-Specific Options, and Password
Backend-Specific Options sections. Refer to the "OpenLDAP
Global Configuration Options, General Backend Options, General Database
Options, LDBM Backend-Specific Options, LDBM Database-Specific Options,
Shell Database-Specific Options, and Password
Database-Specific Options sections. Refer to the "OpenLDAP
Administrator's Guide" for more details on the slapd configuration
file.
.SH GLOBAL CONFIGURATION OPTIONS
@ -480,7 +481,21 @@ is not available. Generally set to the name of the EGD/PRNGD socket.
The environment variable RANDFILE can also be used to specify the filename.
.SH GENERAL BACKEND OPTIONS
Options in this section only apply to the configuration file section
for the backend in which they are defined. They are supported by every
for the specified backend. They are supported by every
type of backend.
.TP
.B backend <databasetype>
Mark the beginning of a backend definition. <databasetype>
should be one of
.B ldbm,
.B shell,
or
.B passwd
depending on which backend will serve the database.
.SH GENERAL DATABASE OPTIONS
Options in this section only apply to the configuration file section
for the database in which they are defined. They are supported by every
type of backend.
.TP
.B database <databasetype>
@ -590,10 +605,20 @@ Specify the referral to pass back when
is asked to modify a replicated local database.
If specified multiple times, each url is provided.
.SH LDBM BACKEND-SPECIFIC OPTIONS
Options in this category only apply to the LDBM backend database. That is,
they must follow a "database ldbm" line and come before any subsequent
"database" lines. The LDBM backend is a high-performance database that
makes extensive use of indexing and caching to speed data access.
Options in this category only apply to the LDBM backend. That is,
they must follow "backend ldbm" line and come before any subsequent
"backend" or "database" lines. The LDBM backend is a high-performance
database that makes extensive use of indexing and caching to speed
data access.
.TP
.B directory <directory>
Specify the directory where shared LDBM files, namely those associated
with a BerkeleyDB environment, for all LDBM databases are kept.
The default is unset.
.SH LDBM DATABASE-SPECIFIC OPTIONS
Options in this category only apply to the LDBM databases. That is,
they must follow "database ldbm" line and come before any subsequent
"backend" or "database" lines.
.TP
.B cachesize <integer>
Specify the size in entries of the in-memory cache maintained
@ -649,10 +674,10 @@ other subtypes.
.B mode <integer>
Specify the file protection mode that newly created database
index files should have. The default is 0600.
.SH SHELL BACKEND-SPECIFIC OPTIONS
.SH SHELL DATABASE-SPECIFIC OPTIONS
Options in this category only apply to the SHELL backend database. That is,
they must follow a "database shell" line and come before any subsequent
"database" lines. The Shell backend executes external programs to
"backend" or "database" lines. The Shell backend executes external programs to
implement operations, and is designed to make it easy to tie an existing
database to the
.B slapd
@ -681,10 +706,10 @@ to the given LDAP operation.
Note that you need only supply configuration lines for those commands you
want the backend to handle. Operations for which a command is not
supplied will be refused with an "unwilling to perform" error.
.SH PASSWORD BACKEND-SPECIFIC OPTIONS
.SH PASSWORD DATABASE-SPECIFIC OPTIONS
Options in this category only apply to the PASSWD backend database.
That is, they must follow a "database passwd" line and come before any
subsequent "database" lines. The PASSWD database serves up the user
subsequent "backend" or "database" lines. The PASSWD database serves up the user
account information listed in the system
.BR passwd (5)
file.

View File

@ -119,6 +119,10 @@ struct ldbminfo {
ldap_pvt_thread_cond_t li_dbcache_cv;
};
struct ldbm_backend_info {
char *lbi_directory;
};
LDAP_END_DECL
#include "proto-back-ldbm.h"

View File

@ -16,6 +16,48 @@
#include "back-ldbm.h"
int
ldbm_back_config(
BackendInfo *bi,
const char *fname,
int lineno,
int argc,
char **argv
)
{
int rc;
struct ldbm_backend_info *lbi =
(struct ldbm_backend_info *) bi->bi_private;
if ( lbi == NULL ) {
fprintf( stderr, "%s: line %d: ldbm backend info is null!\n",
fname, lineno );
return 1;
}
/* directory where database files live */
if ( strcasecmp( argv[0], "directory" ) == 0 ) {
if ( argc < 2 ) {
fprintf( stderr,
"%s: line %d: missing dir in \"directory <dir>\" line\n",
fname, lineno );
return( 1 );
}
if ( lbi->lbi_directory ) {
free( lbi->lbi_directory );
}
lbi->lbi_directory = ch_strdup( argv[1] );
/* anything else */
} else {
fprintf( stderr,
"%s: line %d: unknown directive \"%s\" in ldbm backend definition (ignored)\n",
fname, lineno, argv[0] );
}
return 0;
}
int
ldbm_back_db_config(
Backend *be,

View File

@ -13,6 +13,9 @@ extern int ldbm_back_initialize LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_open LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_close LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_destroy LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_config LDAP_P(( BackendInfo *bi,
const char *fname, int lineno,
int argc, char **argv ));
extern int ldbm_back_db_init LDAP_P(( BackendDB *bd ));
extern int ldbm_back_db_open LDAP_P(( BackendDB *bd ));

View File

@ -43,7 +43,7 @@ ldbm_back_initialize(
bi->bi_controls = controls;
bi->bi_open = ldbm_back_open;
bi->bi_config = 0;
bi->bi_config = ldbm_back_config;
bi->bi_close = ldbm_back_close;
bi->bi_destroy = ldbm_back_destroy;
@ -85,6 +85,14 @@ ldbm_back_initialize(
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
{
struct ldbm_backend_info *lbi = malloc(
sizeof( struct ldbm_backend_info ) );
bi->bi_private = lbi;
lbi->lbi_directory = NULL;
}
return 0;
}
@ -103,8 +111,11 @@ ldbm_back_open(
{
int rc;
struct ldbm_backend_info *lbi
= (struct ldbm_backend_info *) bi->bi_private;
/* initialize the underlying database system */
rc = ldbm_initialize( NULL );
rc = ldbm_initialize( lbi->lbi_directory );
return rc;
}

View File

@ -14,6 +14,9 @@ argsfile ./test-db/slapd.args
# ldbm database definitions
#######################################################################
backend @BACKEND@
#LDBM#directory ./test-db
database @BACKEND@
cachesize 0
suffix "o=University of Michigan, c=US"

View File

@ -14,6 +14,9 @@ argsfile ./test-db/slapd.args
# ldbm database definitions
#######################################################################
backend @BACKEND@
#LDBM#directory ./test-db
database @BACKEND@
suffix "o=University of Michigan, c=US"
directory ./test-db

View File

@ -16,6 +16,9 @@ argsfile ./test-db/slapd.args
# ldbm database definitions
#######################################################################
backend @BACKEND@
#LDBM#directory ./test-db
database @BACKEND@
cachesize 0
suffix "o=University of Michigan, c=US"

View File

@ -18,6 +18,9 @@ argsfile ./test-repl/slapd.args
referral "ldap://localhost:9009/"
backend @BACKEND@
#LDBM#directory ./test-repl
database @BACKEND@
cachesize 0
suffix "o=University of Mich, c=US"

View File

@ -16,6 +16,9 @@ argsfile ./test-db/slapd.args
# ldbm database definitions
#######################################################################
backend @BACKEND@
#LDBM#directory ./test-db
database @BACKEND@
cachesize 0
suffix "o=University of Michigan, c=US"

View File

@ -17,6 +17,9 @@ argsfile ./test-repl/slapd.args
# ldbm database definitions
#######################################################################
backend @BACKEND@
#LDBM#directory ./test-repl
database @BACKEND@
cachesize 0
suffix "o=University of Michigan, c=US"

View File

@ -25,6 +25,9 @@ argsfile ./test-db/slapd.args
# ldbm database definitions
#######################################################################
backend @BACKEND@
#LDBM#directory ./test-db
database @BACKEND@
suffix "o=OpenLDAP Project, l=Internet"
directory ./test-db

View File

@ -15,6 +15,9 @@ argsfile ./test-db/slapd.args
# ldbm database definitions
#######################################################################
backend @BACKEND@
#LDBM#directory ./test-db
database @BACKEND@
suffix "o=University of Michigan, c=US"
directory ./test-db