From c182511f913038bf74a0bf9c0999219580030bae Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 25 Sep 2000 23:41:16 +0000 Subject: [PATCH] Add bdb_bind, clean up init, s/Backend/BackendDB/ --- servers/slapd/back-bdb/Makefile.in | 4 ++-- servers/slapd/back-bdb/add.c | 2 +- servers/slapd/back-bdb/back-bdb.h | 5 +---- servers/slapd/back-bdb/backbdb.dsp | 4 ++++ servers/slapd/back-bdb/compare.c | 2 +- servers/slapd/back-bdb/config.c | 2 +- servers/slapd/back-bdb/delete.c | 2 +- servers/slapd/back-bdb/dn2entry.c | 2 +- servers/slapd/back-bdb/dn2id.c | 10 +++++----- servers/slapd/back-bdb/id2entry.c | 8 ++++---- servers/slapd/back-bdb/init.c | 24 +++++++++++++----------- servers/slapd/back-bdb/proto-bdb.h | 10 +++++----- servers/slapd/back-bdb/search.c | 10 +++++----- 13 files changed, 44 insertions(+), 41 deletions(-) diff --git a/servers/slapd/back-bdb/Makefile.in b/servers/slapd/back-bdb/Makefile.in index cbcd68b5be..12af61da0c 100644 --- a/servers/slapd/back-bdb/Makefile.in +++ b/servers/slapd/back-bdb/Makefile.in @@ -1,10 +1,10 @@ # $OpenLDAP$ SRCS = init.c tools.c config.c \ - add.c compare.c delete.c search.c \ + add.c bind.c compare.c delete.c search.c \ dn2entry.lo dn2id.c error.c id2entry.c idl.c nextid.c OBJS = init.lo tools.lo config.lo \ - add.lo compare.lo delete.lo search.lo \ + add.lo bind.lo compare.lo delete.lo search.lo \ dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo LDAP_INCDIR= ../../../include diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 059794e553..6fb0e2c656 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -15,7 +15,7 @@ int bdb_add( - Backend *be, + BackendDB *be, Connection *conn, Operation *op, Entry *e ) diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index fec1848d96..7859119d81 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -45,12 +45,9 @@ LDAP_BEGIN_DECL #define BDB_TMP_SUBDIR LDAP_DIRSEP "tmp" #define BDB_LG_SUBDIR LDAP_DIRSEP "log" #define BDB_DATA_SUBDIR LDAP_DIRSEP "data" -#else -#define BDB_TMP_SUBDIR BDB_DBENV_HOME -#define BDB_LG_SUBDIR BDB_DBENV_HOME -#define BDB_DATA_SUBDIR BDB_DBENV_HOME #endif +#define BDB_SUFFIX ".bdb" #define BDB_NEXTID 0 #define BDB_DN2ID 1 #define BDB_ID2ENTRY 2 diff --git a/servers/slapd/back-bdb/backbdb.dsp b/servers/slapd/back-bdb/backbdb.dsp index b07b71385b..968c4c710c 100644 --- a/servers/slapd/back-bdb/backbdb.dsp +++ b/servers/slapd/back-bdb/backbdb.dsp @@ -135,6 +135,10 @@ SOURCE=".\back-bdb.h" # End Source File # Begin Source File +SOURCE=.\bind.c +# End Source File +# Begin Source File + SOURCE=.\compare.c # End Source File # Begin Source File diff --git a/servers/slapd/back-bdb/compare.c b/servers/slapd/back-bdb/compare.c index 3dc7e9fc61..98d95cdf5e 100644 --- a/servers/slapd/back-bdb/compare.c +++ b/servers/slapd/back-bdb/compare.c @@ -15,7 +15,7 @@ int bdb_compare( - Backend *be, + BackendDB *be, Connection *conn, Operation *op, const char *dn, diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index 7ac348cdb6..c881bec923 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -14,7 +14,7 @@ int bdb_db_config( - Backend *be, + BackendDB *be, const char *fname, int lineno, int argc, diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index e3617f08d1..0b66029b57 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -15,7 +15,7 @@ int bdb_delete( - Backend *be, + BackendDB *be, Connection *conn, Operation *op, const char *dn, diff --git a/servers/slapd/back-bdb/dn2entry.c b/servers/slapd/back-bdb/dn2entry.c index 7568035eeb..b30dce4a23 100644 --- a/servers/slapd/back-bdb/dn2entry.c +++ b/servers/slapd/back-bdb/dn2entry.c @@ -19,7 +19,7 @@ int bdb_dn2entry( - Backend *be, + BackendDB *be, DB_TXN *tid, const char *dn, Entry **e, diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index 007c18866f..7c1ce7ce40 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -14,7 +14,7 @@ int bdb_dn2id_add( - Backend *be, + BackendDB *be, DB_TXN *txn, const char *dn, ID id @@ -92,7 +92,7 @@ done: int bdb_dn2id_delete( - Backend *be, + BackendDB *be, DB_TXN *txn, const char *dn, ID id ) @@ -164,7 +164,7 @@ done: int bdb_dn2id( - Backend *be, + BackendDB *be, DB_TXN *txn, const char *dn, ID *id ) @@ -200,7 +200,7 @@ bdb_dn2id( int bdb_dn2id_matched( - Backend *be, + BackendDB *be, DB_TXN *txn, const char *in, ID *id, @@ -269,7 +269,7 @@ bdb_dn2id_matched( int bdb_dn2id_children( - Backend *be, + BackendDB *be, DB_TXN *txn, const char *dn ) { diff --git a/servers/slapd/back-bdb/id2entry.c b/servers/slapd/back-bdb/id2entry.c index 04b27ea1b2..5eb3f7f6aa 100644 --- a/servers/slapd/back-bdb/id2entry.c +++ b/servers/slapd/back-bdb/id2entry.c @@ -13,7 +13,7 @@ #include "back-bdb.h" int bdb_id2entry_add( - Backend *be, + BackendDB *be, DB_TXN *tid, Entry *e ) { @@ -42,7 +42,7 @@ int bdb_id2entry_add( } int bdb_id2entry( - Backend *be, + BackendDB *be, DB_TXN *tid, ID id, Entry **e ) @@ -78,7 +78,7 @@ int bdb_id2entry( } int bdb_id2entry_delete( - Backend *be, + BackendDB *be, DB_TXN *tid, ID id ) { @@ -99,7 +99,7 @@ int bdb_id2entry_delete( } int bdb_entry_return( - Backend *be, + BackendDB *be, Entry *e ) { entry_free( e ); diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 91307aa8b5..aa66fc0b85 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -19,11 +19,12 @@ static struct bdbi_database { int type; int flags; } bdbi_databases[BDB_INDICES] = { - { "nextid", "nextid", DB_BTREE, 0 }, - { "dn2entry", "dn2entry", DB_BTREE, 0 }, - { "id2entry", "id2entry", DB_BTREE, 0 }, + { "nextid" BDB_SUFFIX, "nextid", DB_BTREE, 0 }, + { "dn2entry" BDB_SUFFIX, "dn2entry", DB_BTREE, 0 }, + { "id2entry" BDB_SUFFIX, "id2entry", DB_BTREE, 0 }, }; +#if 0 static int bdb_destroy( BackendInfo *bi ) { @@ -46,9 +47,10 @@ bdb_close( BackendInfo *bi ) /* terminate the underlying database system */ return 0; } +#endif static int -bdb_db_init( Backend *be ) +bdb_db_init( BackendDB *be ) { struct bdb_info *bdb; @@ -75,8 +77,8 @@ bdb_db_open( BackendDB *be ) struct bdb_info *bdb = (struct bdb_info *) be->be_private; u_int32_t flags; - Debug( LDAP_DEBUG_ANY, - "bdb_db_open: opening database for %s\n", + Debug( LDAP_DEBUG_ARGS, + "bdb_db_open: %s\n", be->be_suffix[0], 0, 0 ); /* we should check existance of dbenv_home and db_directory */ @@ -278,15 +280,15 @@ bdb_initialize( db_env_set_func_malloc( ch_malloc ); db_env_set_func_realloc( ch_realloc ); db_env_set_func_free( ch_free ); - db_env_set_func_yield( ldap_pvt_thread_yield ); #endif + db_env_set_func_yield( ldap_pvt_thread_yield ); bi->bi_controls = controls; - bi->bi_open = bdb_open; - bi->bi_close = bdb_close; + bi->bi_open = 0; + bi->bi_close = 0; bi->bi_config = 0; - bi->bi_destroy = bdb_destroy; + bi->bi_destroy = 0; bi->bi_db_init = bdb_db_init; bi->bi_db_config = bdb_db_config; @@ -295,12 +297,12 @@ bdb_initialize( bi->bi_db_destroy = bdb_db_destroy; bi->bi_op_add = bdb_add; + bi->bi_op_bind = bdb_bind; bi->bi_op_compare = bdb_compare; bi->bi_op_delete = bdb_delete; bi->bi_op_search = bdb_search; #if 0 - bi->bi_op_bind = bdb_bind; bi->bi_op_unbind = bdb_unbind; bi->bi_op_modify = bdb_modify; bi->bi_op_modrdn = bdb_modrdn; diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index 1f4daa3fd5..23e5a5fb48 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -13,7 +13,7 @@ LDAP_BEGIN_DECL * alias.c */ Entry *bdb_deref_internal_r LDAP_P(( - Backend *be, + BackendDB *be, Entry *e, const char *dn, int *err, @@ -28,7 +28,7 @@ Entry *bdb_deref_internal_r LDAP_P(( /* * dn2entry.c */ -int bdb_dn2entry LDAP_P(( Backend *be, DB_TXN *tid, +int bdb_dn2entry LDAP_P(( BackendDB *be, DB_TXN *tid, const char *dn, Entry **e, Entry **matched, int flags )); #define dn2entry_r(be, tid, dn, p, m) \ @@ -84,17 +84,17 @@ void bdb_errcall( const char *pfx, char * msg ); * id2entry */ int bdb_id2entry_add( - Backend *be, + BackendDB *be, DB_TXN *tid, Entry *e ); int bdb_id2entry_delete( - Backend *be, + BackendDB *be, DB_TXN *tid, ID id ); int bdb_id2entry( - Backend *be, + BackendDB *be, DB_TXN *tid, ID id, Entry **e ); diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index d81eb3c422..6ad4b54031 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -13,11 +13,11 @@ #include "back-bdb.h" static int base_candidate( - Backend *be, + BackendDB *be, Entry *e, ID *ids ); static int search_candidates( - Backend *be, + BackendDB *be, Entry *e, Filter *filter, int scope, @@ -30,7 +30,7 @@ static ID idl_next( ID *ids, ID *cursor ); int bdb_search( - Backend *be, + BackendDB *be, Connection *conn, Operation *op, const char *base, @@ -353,7 +353,7 @@ done: static int base_candidate( - Backend *be, + BackendDB *be, Entry *e, ID *ids ) { @@ -366,7 +366,7 @@ static int base_candidate( } static int search_candidates( - Backend *be, + BackendDB *be, Entry *e, Filter *filter, int scope, -- 2.39.5