From fe186a9c8fd7ad971b98612270ecdef15af49e77 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 19 Sep 2000 01:59:08 +0000 Subject: [PATCH] Add BDB errcall --- servers/slapd/back-bdb/Makefile.in | 4 +- servers/slapd/back-bdb/error.c | 21 +++ servers/slapd/back-bdb/external.h | 93 ------------ servers/slapd/back-bdb/init.c | 220 ++++++++++++++--------------- 4 files changed, 126 insertions(+), 212 deletions(-) create mode 100644 servers/slapd/back-bdb/error.c diff --git a/servers/slapd/back-bdb/Makefile.in b/servers/slapd/back-bdb/Makefile.in index 4e3e718d45..0e9dae5e00 100644 --- a/servers/slapd/back-bdb/Makefile.in +++ b/servers/slapd/back-bdb/Makefile.in @@ -1,7 +1,7 @@ # $OpenLDAP$ -SRCS = init.c -OBJS = init.lo +SRCS = error.c init.c +OBJS = error.lo init.lo LDAP_INCDIR= ../../../include LDAP_LIBDIR= ../../../libraries diff --git a/servers/slapd/back-bdb/error.c b/servers/slapd/back-bdb/error.c new file mode 100644 index 0000000000..56a6e0572b --- /dev/null +++ b/servers/slapd/back-bdb/error.c @@ -0,0 +1,21 @@ +/* error.c - BDB errcall routine */ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" + +#include + +#include +#include + +#include "slap.h" +#include "back-bdb.h" + +void bdb_errcall( const char *pfx, char * msg ) +{ + Debug( LDAP_DEBUG_ANY, "bdb(%s): %s", pfx, msg, 0 ); +} diff --git a/servers/slapd/back-bdb/external.h b/servers/slapd/back-bdb/external.h index 44b2dc8753..c08b9db81e 100644 --- a/servers/slapd/back-bdb/external.h +++ b/servers/slapd/back-bdb/external.h @@ -10,99 +10,6 @@ LDAP_BEGIN_DECL extern int bdb_back_initialize LDAP_P(( BackendInfo *bi )); -extern int bdb_back_open LDAP_P(( BackendInfo *bi )); -extern int bdb_back_close LDAP_P(( BackendInfo *bi )); -extern int bdb_back_destroy LDAP_P(( BackendInfo *bi )); - -extern int bdb_back_db_init LDAP_P(( BackendDB *bd )); -extern int bdb_back_db_open LDAP_P(( BackendDB *bd )); -extern int bdb_back_db_close LDAP_P(( BackendDB *bd )); -extern int bdb_back_db_destroy LDAP_P(( BackendDB *bd )); - -extern int bdb_back_db_config LDAP_P(( BackendDB *bd, - const char *fname, int lineno, - int argc, char **argv )); - -extern int bdb_back_extended LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *reqoid, - struct berval *reqdata, - char **rspoid, - struct berval **rspdata, - LDAPControl *** rspctrls, - const char **text, - struct berval *** refs )); - -extern int bdb_back_bind LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *dn, const char *ndn, int method, - struct berval *cred, char** edn )); - -extern int bdb_back_unbind LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op )); - -extern int bdb_back_search LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *base, const char *nbase, - int scope, int deref, int sizelimit, int timelimit, - Filter *filter, const char *filterstr, - char **attrs, int attrsonly )); - -extern int bdb_back_compare LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *dn, const char *ndn, - AttributeAssertion *ava )); - -extern int bdb_back_modify LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *dn, const char *ndn, Modifications *ml )); - -extern int bdb_back_modrdn LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *dn, const char *ndn, - const char* newrdn, int deleteoldrdn, - const char *newSuperior )); - -extern int bdb_back_add LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, Entry *e )); - -extern int bdb_back_delete LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *dn, const char *ndn )); - -extern int bdb_back_abandon LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, ber_int_t msgid )); - -extern int bdb_back_group LDAP_P(( BackendDB *bd, - Entry *target, - const char* gr_ndn, - const char* op_ndn, - ObjectClass* group_oc, - AttributeDescription* group_at)); - -extern int bdb_back_attribute LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - Entry *target, - const char* e_ndn, - AttributeDescription* entry_at, - struct berval ***vals)); - - -/* hooks for slap tools */ -extern int bdb_tool_entry_open LDAP_P(( BackendDB *be, int mode )); -extern int bdb_tool_entry_close LDAP_P(( BackendDB *be )); -extern ID bdb_tool_entry_first LDAP_P(( BackendDB *be )); -extern ID bdb_tool_entry_next LDAP_P(( BackendDB *be )); -extern Entry* bdb_tool_entry_get LDAP_P(( BackendDB *be, ID id )); -extern ID bdb_tool_entry_put LDAP_P(( BackendDB *be, Entry *e )); - -extern int bdb_tool_entry_reindex LDAP_P(( BackendDB *be, ID id )); -extern int bdb_tool_sync LDAP_P(( BackendDB *be )); - -extern int bdb_back_referrals LDAP_P(( BackendDB *bd, - Connection *conn, Operation *op, - const char *dn, const char *ndn, - const char **text )); LDAP_END_DECL diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 33a75a8a76..49f7b7af9c 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -15,129 +15,28 @@ #include "slap.h" #include "back-bdb.h" -#ifdef SLAPD_BDB_DYNAMIC - -int back_bdb_LTX_init_module(int argc, char *argv[]) { - BackendInfo bi; - - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "bdb"; - bi.bi_init = bdb_back_initialize; - - backend_add(&bi); - return 0; -} - -#endif /* SLAPD_BDB_DYNAMIC */ - -int -bdb_back_initialize( - BackendInfo *bi -) -{ - static char *controls[] = { - LDAP_CONTROL_MANAGEDSAIT, - NULL - }; - - { /* version check */ - int major, minor, patch; - char *version = db_version( &major, &minor, &patch ); - - if( major != DB_VERSION_MAJOR || - minor != DB_VERSION_MINOR || - patch < DB_VERSION_PATCH ) - { - Debug( LDAP_DEBUG_ANY, - "bdb_back_initialize: version mismatch\n" - "\texpected: " DB_VERSION_STRING "\n" - "\tgot: %s \n", version, 0, 0 ); - } - - Debug( LDAP_DEBUG_ANY, "bdb_back_initialize: %s\n", - version, 0, 0 ); - } - -#if 0 - bi->bi_controls = controls; - - bi->bi_open = bdb_back_open; - bi->bi_config = 0; - bi->bi_close = bdb_back_close; - bi->bi_destroy = bdb_back_destroy; - - bi->bi_db_init = bdb_back_db_init; - bi->bi_db_config = bdb_back_db_config; - bi->bi_db_open = bdb_back_db_open; - bi->bi_db_close = bdb_back_db_close; - bi->bi_db_destroy = bdb_back_db_destroy; - - bi->bi_op_bind = bdb_back_bind; - bi->bi_op_unbind = bdb_back_unbind; - bi->bi_op_search = bdb_back_search; - bi->bi_op_compare = bdb_back_compare; - bi->bi_op_modify = bdb_back_modify; - bi->bi_op_modrdn = bdb_back_modrdn; - bi->bi_op_add = bdb_back_add; - bi->bi_op_delete = bdb_back_delete; - bi->bi_op_abandon = bdb_back_abandon; - - bi->bi_extended = bdb_back_extended; - - bi->bi_entry_release_rw = bdb_back_entry_release_rw; - bi->bi_acl_group = bdb_back_group; - bi->bi_acl_attribute = bdb_back_attribute; - bi->bi_chk_referrals = bdb_back_referrals; - - /* - * hooks for slap tools - */ - bi->bi_tool_entry_open = bdb_tool_entry_open; - bi->bi_tool_entry_close = bdb_tool_entry_close; - bi->bi_tool_entry_first = bdb_tool_entry_first; - bi->bi_tool_entry_next = bdb_tool_entry_next; - bi->bi_tool_entry_get = bdb_tool_entry_get; - bi->bi_tool_entry_put = bdb_tool_entry_put; - bi->bi_tool_entry_reindex = bdb_tool_entry_reindex; - bi->bi_tool_sync = bdb_tool_sync; - - bi->bi_connection_init = 0; - bi->bi_connection_destroy = 0; -#endif - - return 0; -} - -int -bdb_back_destroy( - BackendInfo *bi -) +static int +bdb_back_destroy( BackendInfo *bi ) { return 0; } -int -bdb_back_open( - BackendInfo *bi -) +static int +bdb_back_open( BackendInfo *bi ) { /* initialize the underlying database system */ return 0; } -int -bdb_back_close( - BackendInfo *bi -) +static int +bdb_back_close( BackendInfo *bi ) { /* terminate the underlying database system */ return 0; } -int -bdb_back_db_init( - Backend *be -) +static int +bdb_back_db_init( Backend *be ) { struct bdb_dbinfo *bdi; @@ -158,10 +57,8 @@ bdb_back_db_init( return 0; } -int -bdb_back_db_open( - BackendDB *be -) +static int +bdb_back_db_open( BackendDB *be ) { int rc; struct bdb_dbinfo *bdi = (struct bdb_dbinfo *) be->be_private; @@ -230,10 +127,8 @@ bdb_back_db_open( return 0; } -int -bdb_back_db_destroy( - BackendDB *be -) +static int +bdb_back_db_destroy( BackendDB *be ) { int rc; struct bdb_dbinfo *bdi = (struct bdb_dbinfo *) be->be_private; @@ -250,3 +145,94 @@ bdb_back_db_destroy( return 0; } + +#ifdef SLAPD_BDB_DYNAMIC +int back_bdb_LTX_init_module( int argc, char *argv[] ) { + BackendInfo bi; + + memset( &bi, '\0', sizeof(bi) ); + bi.bi_type = "bdb"; + bi.bi_init = bdb_back_initialize; + + backend_add( &bi ); + return 0; +} +#endif /* SLAPD_BDB_DYNAMIC */ + +int +bdb_back_initialize( + BackendInfo *bi +) +{ + static char *controls[] = { + LDAP_CONTROL_MANAGEDSAIT, + NULL + }; + + { /* version check */ + int major, minor, patch; + char *version = db_version( &major, &minor, &patch ); + + if( major != DB_VERSION_MAJOR || + minor != DB_VERSION_MINOR || + patch < DB_VERSION_PATCH ) + { + Debug( LDAP_DEBUG_ANY, + "bdb_back_initialize: version mismatch\n" + "\texpected: " DB_VERSION_STRING "\n" + "\tgot: %s \n", version, 0, 0 ); + } + + Debug( LDAP_DEBUG_ANY, "bdb_back_initialize: %s\n", + version, 0, 0 ); + } + + bi->bi_controls = controls; + + bi->bi_open = bdb_back_open; + bi->bi_close = bdb_back_close; + bi->bi_config = 0; + bi->bi_destroy = bdb_back_destroy; + +#if 0 + bi->bi_db_init = bdb_back_db_init; + bi->bi_db_config = bdb_back_db_config; + bi->bi_db_open = bdb_back_db_open; + bi->bi_db_close = bdb_back_db_close; + bi->bi_db_destroy = bdb_back_db_destroy; + + bi->bi_op_bind = bdb_back_bind; + bi->bi_op_unbind = bdb_back_unbind; + bi->bi_op_search = bdb_back_search; + bi->bi_op_compare = bdb_back_compare; + bi->bi_op_modify = bdb_back_modify; + bi->bi_op_modrdn = bdb_back_modrdn; + bi->bi_op_add = bdb_back_add; + bi->bi_op_delete = bdb_back_delete; + bi->bi_op_abandon = bdb_back_abandon; + + bi->bi_extended = bdb_back_extended; + + bi->bi_entry_release_rw = bdb_back_entry_release_rw; + bi->bi_acl_group = bdb_back_group; + bi->bi_acl_attribute = bdb_back_attribute; + bi->bi_chk_referrals = bdb_back_referrals; + + /* + * hooks for slap tools + */ + bi->bi_tool_entry_open = bdb_tool_entry_open; + bi->bi_tool_entry_close = bdb_tool_entry_close; + bi->bi_tool_entry_first = bdb_tool_entry_first; + bi->bi_tool_entry_next = bdb_tool_entry_next; + bi->bi_tool_entry_get = bdb_tool_entry_get; + bi->bi_tool_entry_put = bdb_tool_entry_put; + bi->bi_tool_entry_reindex = bdb_tool_entry_reindex; + bi->bi_tool_sync = bdb_tool_sync; + + bi->bi_connection_init = 0; + bi->bi_connection_destroy = 0; +#endif + + return 0; +} -- 2.39.5