From: Kurt Zeilenga Date: Mon, 25 Sep 2000 21:10:21 +0000 (+0000) Subject: Add minimal config support X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1898 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e50c9b15888cef74f441b2475ad58d2ff9f329b2;p=openldap Add minimal config support --- diff --git a/servers/slapd/back-bdb/Makefile.in b/servers/slapd/back-bdb/Makefile.in index 646183ec6c..cbcd68b5be 100644 --- a/servers/slapd/back-bdb/Makefile.in +++ b/servers/slapd/back-bdb/Makefile.in @@ -1,9 +1,9 @@ # $OpenLDAP$ -SRCS = init.c tools.c \ +SRCS = init.c tools.c config.c \ add.c compare.c delete.c search.c \ dn2entry.lo dn2id.c error.c id2entry.c idl.c nextid.c -OBJS = init.lo tools.lo \ +OBJS = init.lo tools.lo config.lo \ add.lo compare.lo delete.lo search.lo \ dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo diff --git a/servers/slapd/back-bdb/backbdb.dsp b/servers/slapd/back-bdb/backbdb.dsp index 3543e5e5a5..b07b71385b 100644 --- a/servers/slapd/back-bdb/backbdb.dsp +++ b/servers/slapd/back-bdb/backbdb.dsp @@ -139,6 +139,10 @@ SOURCE=.\compare.c # End Source File # Begin Source File +SOURCE=.\config.c +# End Source File +# Begin Source File + SOURCE=.\delete.c # End Source File # Begin Source File diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c new file mode 100644 index 0000000000..7ac348cdb6 --- /dev/null +++ b/servers/slapd/back-bdb/config.c @@ -0,0 +1,83 @@ +/* config.c - ldbm backend configuration file routine */ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" + +#include +#include + +#include "back-bdb.h" + +int +bdb_db_config( + Backend *be, + const char *fname, + int lineno, + int argc, + char **argv ) +{ + struct bdb_info *bdb = (struct bdb_info *) be->be_private; + + if ( bdb == NULL ) { + fprintf( stderr, "%s: line %d: " + "bdb database info is null!\n", + fname, lineno ); + return 1; + } + + /* directory is the DB_HOME */ + if ( strcasecmp( argv[0], "directory" ) == 0 ) { + if ( argc < 2 ) { + fprintf( stderr, "%s: line %d: " + "missing dir in \"directory \" line\n", + fname, lineno ); + return 1; + } + if ( bdb->bi_dbenv_home ) { + free( bdb->bi_dbenv_home ); + } + bdb->bi_dbenv_home = ch_strdup( argv[1] ); + + /* mode with which to create new database files */ + } else if ( strcasecmp( argv[0], "mode" ) == 0 ) { + if ( argc < 2 ) { + fprintf( stderr, "%s: line %d: " + "missing mode in \"mode \" line\n", + fname, lineno ); + return 1; + } + bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 ); + +#if 0 + /* attribute to index */ + } else if ( strcasecmp( argv[0], "index" ) == 0 ) { + int rc; + if ( argc < 2 ) { + fprintf( stderr, "%s: line %d: " + "missing attr in \"index [pres,eq,approx,sub]\" line\n", + fname, lineno ); + return 1; + } else if ( argc > 3 ) { + fprintf( stderr, "%s: line %d: " + "extra junk after \"index [pres,eq,approx,sub]\" " + "line (ignored)\n", + fname, lineno ); + } + rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] ); + + if( rc != LDAP_SUCCESS ) return 1; +#endif + + /* anything else */ + } else { + fprintf( stderr, "%s: line %d: " + "unknown directive \"%s\" in bdb database definition (ignored)\n", + fname, lineno, argv[0] ); + } + + return 0; +} diff --git a/servers/slapd/back-bdb/external.h b/servers/slapd/back-bdb/external.h index 1adee5d1a5..6b721685de 100644 --- a/servers/slapd/back-bdb/external.h +++ b/servers/slapd/back-bdb/external.h @@ -11,6 +11,10 @@ LDAP_BEGIN_DECL extern int bdb_initialize LDAP_P(( BackendInfo *bi )); +extern int bdb_db_config LDAP_P(( BackendDB *bd, + const char *fname, int lineno, + int argc, char **argv )); + extern int bdb_add LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, Entry *e )); diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 32c44b06b5..046a060900 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -269,7 +269,7 @@ bdb_initialize( bi->bi_destroy = bdb_destroy; bi->bi_db_init = bdb_db_init; - bi->bi_db_config = 0; + bi->bi_db_config = bdb_db_config; bi->bi_db_open = bdb_db_open; bi->bi_db_close = bdb_db_close; bi->bi_db_destroy = bdb_db_destroy;