From: Ralf Haferkamp Date: Wed, 25 Jul 2007 17:21:05 +0000 (+0000) Subject: Added a new parameter (ConfigArgs*) to the _db_init, _db_open, _db_close and X-Git-Tag: OPENLDAP_REL_ENG_2_4_MP~290 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5ae46c195ed5dd2b5117d2301645e8b7a00d9a0a;p=openldap Added a new parameter (ConfigArgs*) to the _db_init, _db_open, _db_close and _db_destroy functions. --- diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index f6fd467671..7105c1762b 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -320,9 +320,9 @@ bdb_cf_cleanup( ConfigArgs *c ) if ( bdb->bi_flags & BDB_RE_OPEN ) { bdb->bi_flags ^= BDB_RE_OPEN; - rc = c->be->bd_info->bi_db_close( c->be ); + rc = c->be->bd_info->bi_db_close( c->be, NULL ); if ( rc == 0 ) - rc = c->be->bd_info->bi_db_open( c->be ); + rc = c->be->bd_info->bi_db_open( c->be, NULL ); /* If this fails, we need to restart */ if ( rc ) { slapd_shutdown = 2; diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index bd17781998..df6c27d06b 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -26,6 +26,7 @@ #include #include #include "alock.h" +#include "config.h" static const struct bdbi_database { char *file; @@ -46,7 +47,7 @@ typedef void * db_realloc(void *, size_t); #define bdb_db_close BDB_SYMBOL(db_close) static int -bdb_db_init( BackendDB *be ) +bdb_db_init( BackendDB *be, ConfigArgs *ca ) { struct bdb_info *bdb; int rc; @@ -93,10 +94,10 @@ bdb_db_init( BackendDB *be ) } static int -bdb_db_close( BackendDB *be ); +bdb_db_close( BackendDB *be, ConfigArgs *ca ); static int -bdb_db_open( BackendDB *be ) +bdb_db_open( BackendDB *be, ConfigArgs *ca ) { int rc, i; struct bdb_info *bdb = (struct bdb_info *) be->be_private; @@ -121,8 +122,8 @@ bdb_db_open( BackendDB *be ) #ifndef BDB_MULTIPLE_SUFFIXES if ( be->be_suffix[1].bv_val ) { - Debug( LDAP_DEBUG_ANY, - LDAP_XSTRING(bdb_db_open) ": only one suffix allowed\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_ANY, + LDAP_XSTRING(bdb_db_open) ": only one suffix allowed\n", 0, 0, 0 ); return -1; } #endif @@ -133,7 +134,7 @@ bdb_db_open( BackendDB *be ) Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_db_open) ": Cannot access database directory %s (%d)\n", bdb->bi_dbenv_home, errno, 0 ); - return -1; + return -1; } /* Perform database use arbitration/recovery logic */ @@ -474,12 +475,12 @@ shm_retry: return 0; fail: - bdb_db_close( be ); + bdb_db_close( be, NULL ); return rc; } static int -bdb_db_close( BackendDB *be ) +bdb_db_close( BackendDB *be, ConfigArgs *ca ) { int rc; struct bdb_info *bdb = (struct bdb_info *) be->be_private; @@ -574,7 +575,7 @@ bdb_db_close( BackendDB *be ) } static int -bdb_db_destroy( BackendDB *be ) +bdb_db_destroy( BackendDB *be, ConfigArgs *ca ) { struct bdb_info *bdb = (struct bdb_info *) be->be_private; diff --git a/servers/slapd/back-dnssrv/init.c b/servers/slapd/back-dnssrv/init.c index 365e47dfdb..9a5ac2bdfe 100644 --- a/servers/slapd/back-dnssrv/init.c +++ b/servers/slapd/back-dnssrv/init.c @@ -24,8 +24,11 @@ #include #include +#include +#include #include "slap.h" +#include "config.h" #include "proto-dnssrv.h" int @@ -89,14 +92,16 @@ dnssrv_back_open( int dnssrv_back_db_init( - Backend *be ) + Backend *be, + ConfigArgs *ca) { return 0; } int dnssrv_back_db_destroy( - Backend *be ) + Backend *be, + ConfigArgs *ca ) { return 0; } diff --git a/servers/slapd/back-ldap/chain.c b/servers/slapd/back-ldap/chain.c index 7e4ae5e85c..102374a40c 100644 --- a/servers/slapd/back-ldap/chain.c +++ b/servers/slapd/back-ldap/chain.c @@ -112,7 +112,7 @@ static int ldap_chain_db_init_common( BackendDB *be ); static int ldap_chain_db_init_one( BackendDB *be ); static int ldap_chain_db_open_one( BackendDB *be ); #define ldap_chain_db_close_one(be) (0) -#define ldap_chain_db_destroy_one(be) (lback)->bi_db_destroy( (be) ) +#define ldap_chain_db_destroy_one(be, rs) (lback)->bi_db_destroy( (be), (rs) ) typedef struct ldap_chain_cb_t { ldap_chain_status_t lb_status; @@ -507,7 +507,7 @@ Document: RFC 4511 if ( rc != 0 ) { lip->li_uri = NULL; lip->li_bvuri = NULL; - (void)ldap_chain_db_destroy_one( op->o_bd ); + (void)ldap_chain_db_destroy_one( op->o_bd, NULL); goto cleanup; } @@ -546,7 +546,7 @@ cleanup:; lip->li_uri = NULL; lip->li_bvuri = NULL; (void)ldap_chain_db_close_one( op->o_bd ); - (void)ldap_chain_db_destroy_one( op->o_bd ); + (void)ldap_chain_db_destroy_one( op->o_bd, NULL ); } further_cleanup:; @@ -691,7 +691,7 @@ ldap_chain_search( if ( rc != 0 ) { lip->li_uri = NULL; lip->li_bvuri = NULL; - (void)ldap_chain_db_destroy_one( op->o_bd ); + (void)ldap_chain_db_destroy_one( op->o_bd, NULL ); goto cleanup; } @@ -733,7 +733,7 @@ cleanup:; lip->li_uri = NULL; lip->li_bvuri = NULL; (void)ldap_chain_db_close_one( op->o_bd ); - (void)ldap_chain_db_destroy_one( op->o_bd ); + (void)ldap_chain_db_destroy_one( op->o_bd, NULL ); } further_cleanup:; @@ -1192,7 +1192,7 @@ chain_ldadd( CfEntryInfo *p, Entry *e, ConfigArgs *ca ) done:; if ( rc != LDAP_SUCCESS ) { - (void)ldap_chain_db_destroy_one( ca->be ); + (void)ldap_chain_db_destroy_one( ca->be, NULL ); ch_free( ca->be ); ca->be = NULL; } @@ -1506,7 +1506,8 @@ chain_cf_gen( ConfigArgs *c ) static int ldap_chain_db_init( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; ldap_chain_t *lc = NULL; @@ -1637,7 +1638,7 @@ private_destroy:; db.bd_info = lback; db.be_private = (void *)lc->lc_cfg_li; - ldap_chain_db_destroy_one( &db ); + ldap_chain_db_destroy_one( &db, NULL ); lc->lc_cfg_li = NULL; } else { @@ -1690,7 +1691,7 @@ ldap_chain_db_apply( void *datum, void *arg ) lca->be->be_private = (void *)li; - return lca->func( lca->be ); + return lca->func( lca->be, NULL ); } static int @@ -1713,7 +1714,7 @@ ldap_chain_db_func( db.bd_info = lback; db.be_private = lc->lc_common_li; - rc = func( &db ); + rc = func( &db, NULL ); if ( rc != 0 ) { return rc; @@ -1737,7 +1738,8 @@ ldap_chain_db_func( static int ldap_chain_db_open( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; ldap_chain_t *lc = (ldap_chain_t *)on->on_bi.bi_private; @@ -1769,14 +1771,16 @@ ldap_chain_db_open( static int ldap_chain_db_close( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { return ldap_chain_db_func( be, db_close ); } static int ldap_chain_db_destroy( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; ldap_chain_t *lc = (ldap_chain_t *)on->on_bi.bi_private; @@ -1808,7 +1812,7 @@ ldap_chain_db_init_common( be->bd_info = lback; be->be_private = NULL; - rc = lback->bi_db_init( be ); + rc = lback->bi_db_init( be, NULL ); if ( rc != 0 ) { return rc; } @@ -1843,7 +1847,7 @@ ldap_chain_db_init_one( be->bd_info = lback; be->be_private = NULL; - t = lback->bi_db_init( be ); + t = lback->bi_db_init( be, NULL ); if ( t != 0 ) { return t; } @@ -1887,7 +1891,7 @@ ldap_chain_db_open_one( } } - return lback->bi_db_open( be ); + return lback->bi_db_open( be, NULL ); } typedef struct ldap_chain_conn_apply_t { diff --git a/servers/slapd/back-ldap/distproc.c b/servers/slapd/back-ldap/distproc.c index 95a167f613..800abf7f11 100644 --- a/servers/slapd/back-ldap/distproc.c +++ b/servers/slapd/back-ldap/distproc.c @@ -237,7 +237,7 @@ static int ldap_distproc_db_init_common( BackendDB *be ); static int ldap_distproc_db_init_one( BackendDB *be ); #define ldap_distproc_db_open_one(be) (lback)->bi_db_open( (be) ) #define ldap_distproc_db_close_one(be) (0) -#define ldap_distproc_db_destroy_one(be) (lback)->bi_db_destroy( (be) ) +#define ldap_distproc_db_destroy_one(be, ca) (lback)->bi_db_destroy( (be), (ca) ) static int ldap_distproc_parse_ctrl( @@ -447,7 +447,7 @@ distproc_ldadd( CfEntryInfo *p, Entry *e, ConfigArgs *ca ) done:; if ( rc != LDAP_SUCCESS ) { - (void)ldap_distproc_db_destroy_one( ca->be ); + (void)ldap_distproc_db_destroy_one( ca->be, NULL ); ch_free( ca->be ); ca->be = NULL; } @@ -567,7 +567,8 @@ distproc_cfgen( ConfigArgs *c ) static int ldap_distproc_db_init( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; ldap_distproc_t *lc = NULL; @@ -659,7 +660,7 @@ private_destroy:; db.bd_info = lback; db.be_private = (void *)lc->lc_cfg_li; - ldap_distproc_db_destroy_one( &db ); + ldap_distproc_db_destroy_one( &db, NULL ); lc->lc_cfg_li = NULL; } else { @@ -712,7 +713,7 @@ ldap_distproc_db_apply( void *datum, void *arg ) lca->be->be_private = (void *)li; - return lca->func( lca->be ); + return lca->func( lca->be, NULL ); } static int @@ -735,7 +736,7 @@ ldap_distproc_db_func( db.bd_info = lback; db.be_private = lc->lc_common_li; - rc = func( &db ); + rc = func( &db, NULL ); if ( rc != 0 ) { return rc; @@ -759,21 +760,24 @@ ldap_distproc_db_func( static int ldap_distproc_db_open( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { return ldap_distproc_db_func( be, db_open ); } static int ldap_distproc_db_close( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { return ldap_distproc_db_func( be, db_close ); } static int ldap_distproc_db_destroy( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; ldap_distproc_t *lc = (ldap_distproc_t *)on->on_bi.bi_private; @@ -804,7 +808,7 @@ ldap_distproc_db_init_common( be->bd_info = lback; be->be_private = NULL; - t = lback->bi_db_init( be ); + t = lback->bi_db_init( be, NULL ); if ( t != 0 ) { return t; } @@ -835,7 +839,7 @@ ldap_distproc_db_init_one( be->bd_info = lback; be->be_private = NULL; - t = lback->bi_db_init( be ); + t = lback->bi_db_init( be, NULL ); if ( t != 0 ) { return t; } diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c index d9a4ff61c4..4d554c204d 100644 --- a/servers/slapd/back-ldap/init.c +++ b/servers/slapd/back-ldap/init.c @@ -29,6 +29,7 @@ #include #include "slap.h" +#include "config.h" #include "back-ldap.h" int @@ -98,7 +99,7 @@ ldap_back_initialize( BackendInfo *bi ) } int -ldap_back_db_init( Backend *be ) +ldap_back_db_init( Backend *be, ConfigArgs *ca ) { ldapinfo_t *li; int rc; @@ -168,7 +169,7 @@ ldap_back_db_init( Backend *be ) } int -ldap_back_db_open( BackendDB *be ) +ldap_back_db_open( BackendDB *be, ConfigArgs *ca ) { ldapinfo_t *li = (ldapinfo_t *)be->be_private; @@ -255,7 +256,7 @@ ldap_back_conn_free( void *v_lc ) } int -ldap_back_db_close( Backend *be ) +ldap_back_db_close( Backend *be, ConfigArgs *ca ) { int rc = 0; @@ -267,7 +268,7 @@ ldap_back_db_close( Backend *be ) } int -ldap_back_db_destroy( Backend *be ) +ldap_back_db_destroy( Backend *be, ConfigArgs *ca ) { if ( be->be_private ) { ldapinfo_t *li = ( ldapinfo_t * )be->be_private; diff --git a/servers/slapd/back-ldif/ldif.c b/servers/slapd/back-ldif/ldif.c index 855e63889f..5d1676b212 100644 --- a/servers/slapd/back-ldif/ldif.c +++ b/servers/slapd/back-ldif/ldif.c @@ -1105,7 +1105,7 @@ int ldif_back_entry_get( return ( *ent == NULL ? 1 : 0 ); } -static int ldif_tool_entry_open(BackendDB * be, int mode) { +static int ldif_tool_entry_open(BackendDB *be, int mode) { struct ldif_info *ni = (struct ldif_info *) be->be_private; ni->li_tool_current = 0; return 0; @@ -1214,7 +1214,7 @@ static ID ldif_tool_entry_put(BackendDB * be, Entry * e, struct berval *text) { } static int -ldif_back_db_init( BackendDB *be ) +ldif_back_db_init( BackendDB *be, ConfigArgs *ca ) { struct ldif_info *ni; @@ -1226,9 +1226,7 @@ ldif_back_db_init( BackendDB *be ) } static int -ldif_back_db_destroy( - Backend *be - ) +ldif_back_db_destroy( Backend *be, ConfigArgs *ca ) { struct ldif_info *ni = be->be_private; @@ -1239,9 +1237,7 @@ ldif_back_db_destroy( } static int -ldif_back_db_open( - Backend *be - ) +ldif_back_db_open( Backend *be, ConfigArgs *ca) { struct ldif_info *ni = (struct ldif_info *) be->be_private; if( BER_BVISEMPTY(&ni->li_base_path)) {/* missing base path */ diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c index 89f27ad818..9edf6aeddf 100644 --- a/servers/slapd/back-meta/init.c +++ b/servers/slapd/back-meta/init.c @@ -23,6 +23,7 @@ #include #include "slap.h" +#include "config.h" #include "../back-ldap/back-ldap.h" #include "back-meta.h" @@ -87,7 +88,8 @@ meta_back_initialize( int meta_back_db_init( - Backend *be ) + Backend *be, + ConfigArgs *ca) { metainfo_t *mi; int i; @@ -128,7 +130,8 @@ meta_back_db_init( int meta_back_db_open( - Backend *be ) + Backend *be, + ConfigArgs *ca ) { metainfo_t *mi = (metainfo_t *)be->be_private; @@ -328,7 +331,8 @@ target_free( int meta_back_db_destroy( - Backend *be ) + Backend *be, + ConfigArgs *ca ) { metainfo_t *mi; diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index 64926717ac..38c2a26c06 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -2050,7 +2050,8 @@ monitor_back_initialize( int monitor_back_db_init( - BackendDB *be ) + BackendDB *be, + ConfigArgs *c) { int rc; struct berval dn = BER_BVC( SLAPD_MONITOR_DN ), @@ -2064,8 +2065,9 @@ monitor_back_db_init( * database monitor can be defined once only */ if ( be_monitor != NULL ) { - Debug( LDAP_DEBUG_ANY, - "only one monitor database is allowed\n", 0, 0, 0 ); + if (c) { + snprintf(c->msg, sizeof(c->msg),"only one monitor database allowed"); + } return( -1 ); } be_monitor = be; @@ -2108,10 +2110,12 @@ monitor_back_db_init( type = oi->oi_orig->bi_type; } - Debug( LDAP_DEBUG_ANY, - "\"monitor\" database serving namingContext \"%s\" " - "is hidden by \"%s\" database serving namingContext \"%s\".\n", - pdn.bv_val, type, be2->be_nsuffix[ 0 ].bv_val ); + if (c) { + snprintf(((ConfigArgs*)c)->msg, sizeof(((ConfigArgs*)c)->msg), + "\"monitor\" database serving namingContext \"%s\" " + "is hidden by \"%s\" database serving namingContext \"%s\".\n", + pdn.bv_val, type, be2->be_nsuffix[ 0 ].bv_val ); + } return -1; } @@ -2120,7 +2124,8 @@ monitor_back_db_init( int monitor_back_db_open( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca) { monitor_info_t *mi = (monitor_info_t *)be->be_private; struct monitor_subsys_t **ms; @@ -2459,7 +2464,8 @@ monitor_back_db_config( int monitor_back_db_destroy( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca) { monitor_info_t *mi = ( monitor_info_t * )be->be_private; diff --git a/servers/slapd/back-null/null.c b/servers/slapd/back-null/null.c index 17b9254a56..d6fb41d256 100644 --- a/servers/slapd/back-null/null.c +++ b/servers/slapd/back-null/null.c @@ -24,6 +24,7 @@ #include #include "slap.h" +#include "config.h" struct null_info { int ni_bind_allowed; @@ -160,7 +161,7 @@ null_back_db_config( } static int -null_back_db_init( BackendDB *be ) +null_back_db_init( BackendDB *be, ConfigArgs *ca ) { struct null_info *ni = ch_calloc( 1, sizeof(struct null_info) ); ni->ni_bind_allowed = 0; @@ -170,7 +171,7 @@ null_back_db_init( BackendDB *be ) } static int -null_back_db_destroy( Backend *be ) +null_back_db_destroy( Backend *be, ConfigArgs *ca ) { free( be->be_private ); return 0; diff --git a/servers/slapd/back-perl/close.c b/servers/slapd/back-perl/close.c index 4625797233..5e66d053a7 100644 --- a/servers/slapd/back-perl/close.c +++ b/servers/slapd/back-perl/close.c @@ -16,7 +16,7 @@ */ #include "perl_back.h" - +#include "config.h" /********************************************************** * * Close @@ -39,7 +39,8 @@ perl_back_close( int perl_back_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { free( be->be_private ); diff --git a/servers/slapd/back-perl/init.c b/servers/slapd/back-perl/init.c index a695a8f97f..edaf5f1a22 100644 --- a/servers/slapd/back-perl/init.c +++ b/servers/slapd/back-perl/init.c @@ -16,6 +16,7 @@ */ #include "perl_back.h" +#include "config.h" static void perl_back_xs_init LDAP_P((PERL_BACK_XS_INIT_PARAMS)); EXT void boot_DynaLoader LDAP_P((PERL_BACK_BOOT_DYNALOADER_PARAMS)); @@ -85,7 +86,8 @@ perl_back_initialize( int perl_back_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { be->be_private = (PerlBackend *) ch_malloc( sizeof(PerlBackend) ); @@ -100,7 +102,8 @@ perl_back_db_init( int perl_back_db_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { int count; diff --git a/servers/slapd/back-relay/init.c b/servers/slapd/back-relay/init.c index 3b29726a8f..ca20602b25 100644 --- a/servers/slapd/back-relay/init.c +++ b/servers/slapd/back-relay/init.c @@ -24,6 +24,7 @@ #include #include "slap.h" +#include "config.h" #include "back-relay.h" int @@ -69,7 +70,7 @@ relay_back_initialize( BackendInfo *bi ) } int -relay_back_db_init( Backend *be ) +relay_back_db_init( Backend *be, ConfigArgs *ca) { relay_back_info *ri; @@ -90,7 +91,7 @@ relay_back_db_init( Backend *be ) } int -relay_back_db_open( Backend *be ) +relay_back_db_open( Backend *be, ConfigArgs *ca ) { relay_back_info *ri = (relay_back_info *)be->be_private; @@ -114,13 +115,13 @@ relay_back_db_open( Backend *be ) } int -relay_back_db_close( Backend *be ) +relay_back_db_close( Backend *be, ConfigArgs *ca ) { return 0; } int -relay_back_db_destroy( Backend *be ) +relay_back_db_destroy( Backend *be, ConfigArgs *ca) { relay_back_info *ri = (relay_back_info *)be->be_private; diff --git a/servers/slapd/back-shell/init.c b/servers/slapd/back-shell/init.c index 5724118e5a..68e11712a2 100644 --- a/servers/slapd/back-shell/init.c +++ b/servers/slapd/back-shell/init.c @@ -36,6 +36,8 @@ #include "slap.h" +#include "config.h" + #include "shell.h" int @@ -76,7 +78,8 @@ shell_back_initialize( int shell_back_db_init( - Backend *be + Backend *be, + ConfigArgs *ca ) { struct shellinfo *si; @@ -90,7 +93,8 @@ shell_back_db_init( int shell_back_db_destroy( - Backend *be + Backend *be, + ConfigArgs *ca ) { free( be->be_private ); diff --git a/servers/slapd/back-sql/init.c b/servers/slapd/back-sql/init.c index 3c7a7fc34f..7950dbea18 100644 --- a/servers/slapd/back-sql/init.c +++ b/servers/slapd/back-sql/init.c @@ -27,6 +27,7 @@ #include "ac/string.h" #include "slap.h" +#include "config.h" #include "proto-sql.h" int @@ -93,7 +94,8 @@ backsql_destroy( int backsql_db_init( - BackendDB *bd ) + BackendDB *bd, + ConfigArgs *ca ) { backsql_info *bi; int rc = 0; @@ -117,7 +119,8 @@ backsql_db_init( int backsql_db_destroy( - BackendDB *bd ) + BackendDB *bd, + ConfigArgs *ca ) { backsql_info *bi = (backsql_info*)bd->be_private; @@ -217,7 +220,8 @@ backsql_db_destroy( int backsql_db_open( - BackendDB *bd ) + BackendDB *bd, + ConfigArgs *ca ) { backsql_info *bi = (backsql_info*)bd->be_private; SQLHDBC dbh = SQL_NULL_HDBC; @@ -565,7 +569,8 @@ backsql_db_open( int backsql_db_close( - BackendDB *bd ) + BackendDB *bd, + ConfigArgs *ca ) { backsql_info *bi = (backsql_info*)bd->be_private; diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index c18e7d3b63..28c5fabd0e 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -34,6 +34,7 @@ #include #include "slap.h" +#include "config.h" #include "lutil.h" #include "lber_pvt.h" @@ -189,7 +190,7 @@ backend_set_controls( BackendDB *be ) } /* startup a specific backend database */ -int backend_startup_one(Backend *be) +int backend_startup_one(Backend *be, ConfigArgs *ca) { int rc = 0; @@ -209,7 +210,7 @@ int backend_startup_one(Backend *be) (void)backend_set_controls( be ); if ( be->bd_info->bi_db_open ) { - rc = be->bd_info->bi_db_open( be ); + rc = be->bd_info->bi_db_open( be, ca ); if ( rc == 0 ) { (void)backend_set_controls( be ); @@ -251,12 +252,12 @@ int backend_startup(Backend *be) /* append global access controls */ acl_append( &be->be_acl, frontendDB->be_acl, -1 ); - return backend_startup_one( be ); + return backend_startup_one( be, NULL ); } /* open frontend, if required */ if ( frontendDB->bd_info->bi_db_open ) { - rc = frontendDB->bd_info->bi_db_open( frontendDB ); + rc = frontendDB->bd_info->bi_db_open( frontendDB, NULL ); if ( rc != 0 ) { Debug( LDAP_DEBUG_ANY, "backend_startup: bi_db_open(frontend) failed! (%d)\n", @@ -300,7 +301,7 @@ int backend_startup(Backend *be) /* append global access controls */ acl_append( &be->be_acl, frontendDB->be_acl, -1 ); - rc = backend_startup_one( be ); + rc = backend_startup_one( be, NULL ); if ( rc ) return rc; } @@ -336,7 +337,7 @@ int backend_shutdown( Backend *be ) } if ( be->bd_info->bi_db_close ) { - be->bd_info->bi_db_close( be ); + be->bd_info->bi_db_close( be, NULL ); } if( be->bd_info->bi_close ) { @@ -349,7 +350,7 @@ int backend_shutdown( Backend *be ) /* close each backend database */ LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) { if ( be->bd_info->bi_db_close ) { - be->bd_info->bi_db_close( be ); + be->bd_info->bi_db_close( be, NULL ); } if(rc != 0) { @@ -373,7 +374,7 @@ int backend_shutdown( Backend *be ) /* close frontend, if required */ if ( frontendDB->bd_info->bi_db_close ) { - rc = frontendDB->bd_info->bi_db_close ( frontendDB ); + rc = frontendDB->bd_info->bi_db_close ( frontendDB, NULL ); if ( rc != 0 ) { Debug( LDAP_DEBUG_ANY, "backend_startup: bi_db_close(frontend) failed! (%d)\n", @@ -411,7 +412,7 @@ backend_stopdown_one( BackendDB *bd ) } if ( bd->bd_info->bi_db_destroy ) { - bd->bd_info->bi_db_destroy( bd ); + bd->bd_info->bi_db_destroy( bd, NULL ); } } @@ -476,7 +477,7 @@ int backend_destroy(void) bd = frontendDB; if ( bd ) { if ( bd->bd_info->bi_db_destroy ) { - bd->bd_info->bi_db_destroy( bd ); + bd->bd_info->bi_db_destroy( bd, NULL ); } ber_bvarray_free( bd->be_suffix ); ber_bvarray_free( bd->be_nsuffix ); @@ -547,7 +548,8 @@ BackendDB * backend_db_init( const char *type, BackendDB *b0, - int idx ) + int idx, + ConfigArgs *ca) { BackendInfo *bi = backend_info(type); BackendDB *be = b0; @@ -586,7 +588,7 @@ backend_db_init( be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH; if ( bi->bi_db_init ) { - rc = bi->bi_db_init( be ); + rc = bi->bi_db_init( be, ca ); } if ( rc != 0 ) { @@ -611,12 +613,12 @@ be_db_close( void ) LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) { if ( be->bd_info->bi_db_close ) { - be->bd_info->bi_db_close( be ); + be->bd_info->bi_db_close( be, NULL ); } } if ( frontendDB->bd_info->bi_db_close ) { - frontendDB->bd_info->bi_db_close( frontendDB ); + frontendDB->bd_info->bi_db_close( frontendDB, NULL ); } } diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 58cdab69b6..975065a426 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -35,6 +35,7 @@ #define SLAPD_TOOLS #include "slap.h" +#include "config.h" typedef struct gluenode { BackendDB *gn_be; @@ -583,7 +584,7 @@ glue_open ( gi->gi_n[i].gn_be->bd_info ); /* Let backend.c take care of the rest of startup */ if ( !rc ) - rc = backend_startup_one( gi->gi_n[i].gn_be ); + rc = backend_startup_one( gi->gi_n[i].gn_be, NULL ); if ( rc ) break; } if ( !rc && !bsame && on->on_info->oi_orig->bi_open ) @@ -816,7 +817,8 @@ glue_tool_sync ( static int glue_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -871,7 +873,8 @@ glue_db_init( static int glue_db_destroy ( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -883,7 +886,8 @@ glue_db_destroy ( static int glue_db_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index c9324f3310..53b8cd980b 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -51,14 +51,14 @@ over_db_func( func = &oi->oi_orig->bi_db_open; if ( func[which] ) { be->bd_info = oi->oi_orig; - rc = func[which]( be ); + rc = func[which]( be, NULL ); } for (; on && rc == 0; on=on->on_next) { be->bd_info = &on->on_bi; func = &on->on_bi.bi_db_open; if (func[which]) { - rc = func[which]( be ); + rc = func[which]( be, NULL ); } } be->bd_info = bi_orig; @@ -168,7 +168,8 @@ over_db_config( static int over_db_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { return over_db_func( be, db_open ); @@ -176,7 +177,8 @@ over_db_open( static int over_db_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinfo *oi = be->bd_info->bi_private; @@ -187,13 +189,13 @@ over_db_close( for (; on && rc == 0; on=on->on_next) { be->bd_info = &on->on_bi; if ( be->bd_info->bi_db_close ) { - rc = be->bd_info->bi_db_close( be ); + rc = be->bd_info->bi_db_close( be, NULL ); } } if ( oi->oi_orig->bi_db_close ) { be->bd_info = oi->oi_orig; - rc = be->bd_info->bi_db_close( be ); + rc = be->bd_info->bi_db_close( be, NULL ); } be->bd_info = bi_orig; @@ -202,7 +204,8 @@ over_db_close( static int over_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinfo *oi = be->bd_info->bi_private; @@ -1075,7 +1078,7 @@ overlay_destroy_one( BackendDB *be, slap_overinst *on ) if ( on->on_bi.bi_db_destroy ) { BackendInfo *bi_orig = be->bd_info; be->bd_info = (BackendInfo *)on; - on->on_bi.bi_db_destroy( be ); + on->on_bi.bi_db_destroy( be, NULL ); be->bd_info = bi_orig; } free( on ); @@ -1281,7 +1284,7 @@ overlay_config( BackendDB *be, const char *ov, int idx, BackendInfo **res ) if ( on2->on_bi.bi_db_init ) { int rc; be->bd_info = (BackendInfo *)on2; - rc = on2->on_bi.bi_db_init( be ); + rc = on2->on_bi.bi_db_init( be, NULL ); be->bd_info = (BackendInfo *)oi; if ( rc ) { *prev = on2->on_next; diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 29b8ed3f57..fbee634de1 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -1236,11 +1236,11 @@ config_generic(ConfigArgs *c) { } else if ( !strcasecmp( c->argv[1], "frontend" )) { c->be = frontendDB; } else { - c->be = backend_db_init(c->argv[1], NULL, c->valx); + c->be = backend_db_init(c->argv[1], NULL, c->valx, c); if ( !c->be ) { - snprintf( c->msg, sizeof( c->msg ), "<%s> failed init", c->argv[0] ); - Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n", - c->log, c->msg, c->argv[1] ); + if ( c->msg[0] == 0 ) + snprintf( c->msg, sizeof( c->msg ), "<%s> failed init", c->argv[0] ); + Debug(LDAP_DEBUG_ANY, "%s: %s (%s)\n", c->log, c->msg, c->argv[1] ); return(1); } } @@ -3085,7 +3085,7 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) { if ( !cfb->cb_db.bd_info ) return 0; /* FIXME: eventually this will be a fatal error */ - if ( backend_db_init( "ldif", &cfb->cb_db, -1 ) == NULL ) + if ( backend_db_init( "ldif", &cfb->cb_db, -1, NULL ) == NULL ) return 1; cfb->cb_db.be_suffix = be->be_suffix; @@ -3115,7 +3115,7 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) { if ( config_add_vals( ct, &c )) return 1; - if ( backend_startup_one( &cfb->cb_db )) + if ( backend_startup_one( &cfb->cb_db, NULL )) return 1; if ( readit ) { @@ -3222,7 +3222,7 @@ read_config(const char *fname, const char *dir) { int rc; /* Setup the config backend */ - be = backend_db_init( "config", NULL, 0 ); + be = backend_db_init( "config", NULL, 0, NULL ); if ( !be ) return 1; @@ -4152,18 +4152,20 @@ ok: /* Newly added databases and overlays need to be started up */ if ( CONFIG_ONLINE_ADD( ca )) { if ( colst[0]->co_type == Cft_Database ) { - rc = backend_startup_one( ca->be ); + rc = backend_startup_one( ca->be, ca ); } else if ( colst[0]->co_type == Cft_Overlay ) { if ( ca->bi->bi_db_open ) { BackendInfo *bi_orig = ca->be->bd_info; ca->be->bd_info = ca->bi; - rc = ca->bi->bi_db_open( ca->be ); + rc = ca->bi->bi_db_open( ca->be, ca ); ca->be->bd_info = bi_orig; } } if ( rc ) { - snprintf( ca->msg, sizeof( ca->msg ), "<%s> failed startup", ca->argv[0] ); + if (ca->msg[0] = 0) + snprintf( ca->msg, sizeof( ca->msg ), "<%s> failed startup", ca->argv[0] ); + Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n", ca->log, ca->msg, ca->argv[1] ); rc = LDAP_OTHER; @@ -5388,7 +5390,7 @@ static const char *defacl[] = { }; static int -config_back_db_open( BackendDB *be ) +config_back_db_open( BackendDB *be, ConfigArgs *ca ) { CfBackInfo *cfb = be->be_private; struct berval rdn; @@ -5626,7 +5628,7 @@ cfb_free_entries( CfEntryInfo *ce ) } static int -config_back_db_close( BackendDB *be ) +config_back_db_close( BackendDB *be, ConfigArgs *ca ) { CfBackInfo *cfb = be->be_private; @@ -5641,7 +5643,7 @@ config_back_db_close( BackendDB *be ) } static int -config_back_db_destroy( BackendDB *be ) +config_back_db_destroy( BackendDB *be, ConfigArgs *ca ) { CfBackInfo *cfb = be->be_private; @@ -5666,7 +5668,7 @@ config_back_db_destroy( BackendDB *be ) } static int -config_back_db_init( BackendDB *be ) +config_back_db_init( BackendDB *be, ConfigArgs* ca ) { struct berval dn; CfBackInfo *cfb; diff --git a/servers/slapd/config.h b/servers/slapd/config.h index 1115d5884d..ea12fcd438 100644 --- a/servers/slapd/config.h +++ b/servers/slapd/config.h @@ -17,6 +17,8 @@ #ifndef CONFIG_H #define CONFIG_H +#include + typedef struct ConfigTable { char *name; char *what; diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index 4325c8f617..48aaed09cb 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -1478,7 +1478,8 @@ static slap_overinst accesslog; static int accesslog_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -1492,7 +1493,8 @@ accesslog_db_init( static int accesslog_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -1608,7 +1610,8 @@ accesslog_db_root( static int accesslog_db_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; diff --git a/servers/slapd/overlays/auditlog.c b/servers/slapd/overlays/auditlog.c index 601c733efd..1d65e1b5b6 100644 --- a/servers/slapd/overlays/auditlog.c +++ b/servers/slapd/overlays/auditlog.c @@ -184,7 +184,8 @@ static slap_overinst auditlog; static int auditlog_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -197,7 +198,8 @@ auditlog_db_init( static int auditlog_db_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -210,7 +212,8 @@ auditlog_db_close( static int auditlog_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; diff --git a/servers/slapd/overlays/constraint.c b/servers/slapd/overlays/constraint.c index 299cd782a3..09712ceeea 100644 --- a/servers/slapd/overlays/constraint.c +++ b/servers/slapd/overlays/constraint.c @@ -343,8 +343,8 @@ constraint_modify( Operation *op, SlapReply *rs ) static int constraint_close( - BackendDB *be - ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; constraint *ap, *a2; diff --git a/servers/slapd/overlays/dds.c b/servers/slapd/overlays/dds.c index 008ec22b10..25e920b3df 100644 --- a/servers/slapd/overlays/dds.c +++ b/servers/slapd/overlays/dds.c @@ -1517,7 +1517,8 @@ dds_cfgen( ConfigArgs *c ) static int dds_db_init( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca) { slap_overinst *on = (slap_overinst *)be->bd_info; dds_info_t *di; @@ -1666,7 +1667,8 @@ done_search:; static int dds_db_open( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; dds_info_t *di = on->on_bi.bi_private; @@ -1731,7 +1733,8 @@ done:; static int dds_db_close( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; dds_info_t *di = on->on_bi.bi_private; @@ -1753,7 +1756,8 @@ dds_db_close( static int dds_db_destroy( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; dds_info_t *di = on->on_bi.bi_private; diff --git a/servers/slapd/overlays/dyngroup.c b/servers/slapd/overlays/dyngroup.c index 6b28ecc8c5..08532866dc 100644 --- a/servers/slapd/overlays/dyngroup.c +++ b/servers/slapd/overlays/dyngroup.c @@ -29,6 +29,7 @@ #include #include "slap.h" +#include "config.h" /* This overlay extends the Compare operation to detect members of a * dynamic group. It has no effect on any other operations. It must @@ -133,7 +134,8 @@ static int dyngroup_config( static int dyngroup_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index eb6fc7a564..5aa1e32976 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -1272,7 +1272,8 @@ dl_cfgen( ConfigArgs *c ) static int dynlist_db_open( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; dynlist_info_t *dli = (dynlist_info_t *)on->on_bi.bi_private; @@ -1329,7 +1330,8 @@ dynlist_db_open( static int dynlist_db_destroy( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index a6299a58a1..7ec44a8dd2 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -1937,7 +1937,7 @@ pc_cf_gen( ConfigArgs *c ) return( 1 ); } - if ( !backend_db_init( c->argv[1], &cm->db, -1 )) { + if ( !backend_db_init( c->argv[1], &cm->db, -1, NULL )) { snprintf( c->msg, sizeof( c->msg ), "unknown backend type (arg #1)" ); Debug( LDAP_DEBUG_CONFIG, "%s: %s.\n", c->log, c->msg, 0 ); return( 1 ); @@ -2140,7 +2140,8 @@ pcache_db_config( static int pcache_db_init( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca) { slap_overinst *on = (slap_overinst *)be->bd_info; cache_manager *cm; @@ -2182,7 +2183,8 @@ pcache_db_init( static int pcache_db_open( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; cache_manager *cm = on->on_bi.bi_private; @@ -2230,7 +2232,7 @@ pcache_db_open( SLAP_DBFLAGS( &cm->db ) &= ~SLAP_DBFLAG_MONITORING; } - rc = backend_startup_one( &cm->db ); + rc = backend_startup_one( &cm->db, NULL ); /* There is no runqueue in TOOL mode */ if ( slapMode & SLAP_SERVER_MODE ) { @@ -2270,7 +2272,8 @@ pcache_free_qbase( void *v ) static int pcache_db_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -2284,7 +2287,7 @@ pcache_db_close( cm->db.be_acl = NULL; if ( cm->db.bd_info->bi_db_close ) { - rc = cm->db.bd_info->bi_db_close( &cm->db ); + rc = cm->db.bd_info->bi_db_close( &cm->db, NULL ); } while ( (tm = qm->templates) != NULL ) { CachedQuery *qc, *qn; @@ -2311,7 +2314,8 @@ pcache_db_close( static int pcache_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index cd73c6b1df..a05b932322 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -2075,7 +2075,8 @@ attrNormalize( static int ppolicy_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; @@ -2118,7 +2119,8 @@ ppolicy_db_init( static int ppolicy_db_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { return overlay_register_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST ); @@ -2126,7 +2128,8 @@ ppolicy_db_open( static int ppolicy_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; diff --git a/servers/slapd/overlays/refint.c b/servers/slapd/overlays/refint.c index c62c39bd52..81cd1f398b 100644 --- a/servers/slapd/overlays/refint.c +++ b/servers/slapd/overlays/refint.c @@ -245,7 +245,8 @@ refint_cf_gen(ConfigArgs *c) static int refint_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -259,7 +260,8 @@ refint_db_init( static int refint_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -280,7 +282,8 @@ refint_db_destroy( static int refint_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -308,7 +311,8 @@ refint_open( static int refint_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; diff --git a/servers/slapd/overlays/retcode.c b/servers/slapd/overlays/retcode.c index a1e655ed95..5bea3b73c7 100644 --- a/servers/slapd/overlays/retcode.c +++ b/servers/slapd/overlays/retcode.c @@ -31,6 +31,7 @@ #include #include "slap.h" +#include "config.h" #include "lutil.h" #include "ldif.h" @@ -725,7 +726,7 @@ retcode_response( Operation *op, SlapReply *rs ) } static int -retcode_db_init( BackendDB *be ) +retcode_db_init( BackendDB *be, ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; retcode_t *rd; @@ -1087,7 +1088,7 @@ retcode_db_config( } static int -retcode_db_open( BackendDB *be ) +retcode_db_open( BackendDB *be, ConfigArgs *ca) { slap_overinst *on = (slap_overinst *)be->bd_info; retcode_t *rd = (retcode_t *)on->on_bi.bi_private; @@ -1211,7 +1212,7 @@ retcode_db_open( BackendDB *be ) } static int -retcode_db_destroy( BackendDB *be ) +retcode_db_destroy( BackendDB *be, ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; retcode_t *rd = (retcode_t *)on->on_bi.bi_private; diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index ce1e2ff0e1..e99ccd279e 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -39,7 +39,7 @@ typedef struct rwm_op_state { } rwm_op_state; static int -rwm_db_destroy( BackendDB *be ); +rwm_db_destroy( BackendDB *be, ConfigArgs *ca ); typedef struct rwm_op_cb { slap_callback cb; @@ -1903,7 +1903,8 @@ rwm_cf_gen( ConfigArgs *c ) static int rwm_db_init( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; struct ldaprwmap *rwmap; @@ -1934,7 +1935,7 @@ error_return:; on->on_bi.bi_private = (void *)rwmap; if ( rc ) { - (void)rwm_db_destroy( be ); + (void)rwm_db_destroy( be, NULL ); } return rc; @@ -1942,7 +1943,8 @@ error_return:; static int rwm_db_destroy( - BackendDB *be ) + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; int rc = 0; diff --git a/servers/slapd/overlays/seqmod.c b/servers/slapd/overlays/seqmod.c index 278face56d..d2886fed61 100644 --- a/servers/slapd/overlays/seqmod.c +++ b/servers/slapd/overlays/seqmod.c @@ -22,6 +22,7 @@ #ifdef SLAPD_OVER_SEQMOD #include "slap.h" +#include "config.h" /* This overlay serializes concurrent attempts to modify a single entry */ @@ -139,7 +140,8 @@ seqmod_op_extended( static int seqmod_db_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -155,7 +157,8 @@ seqmod_db_open( static int seqmod_db_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index b1f064b8e2..d785e17b08 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -2512,7 +2512,8 @@ syncprov_db_otask( */ static int syncprov_db_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; @@ -2605,7 +2606,8 @@ out: */ static int syncprov_db_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; @@ -2635,7 +2637,8 @@ syncprov_db_close( static int syncprov_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -2667,7 +2670,8 @@ syncprov_db_init( static int syncprov_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; diff --git a/servers/slapd/overlays/translucent.c b/servers/slapd/overlays/translucent.c index ee9bf9ebe4..c8d3452e05 100644 --- a/servers/slapd/overlays/translucent.c +++ b/servers/slapd/overlays/translucent.c @@ -686,7 +686,7 @@ static int translucent_db_config( ** */ -static int translucent_db_init(BackendDB *be) { +static int translucent_db_init(BackendDB *be, ConfigArgs *ca) { slap_overinst *on = (slap_overinst *) be->bd_info; translucent_info *ov; @@ -698,7 +698,7 @@ static int translucent_db_init(BackendDB *be) { ov->db.be_private = NULL; ov->db.be_pcl_mutexp = &ov->db.be_pcl_mutex; - if ( !backend_db_init( "ldap", &ov->db, -1 )) { + if ( !backend_db_init( "ldap", &ov->db, -1, NULL )) { Debug( LDAP_DEBUG_CONFIG, "translucent: unable to open captive back-ldap\n", 0, 0, 0); return 1; } @@ -714,7 +714,7 @@ static int translucent_db_init(BackendDB *be) { ** */ -static int translucent_db_open(BackendDB *be) { +static int translucent_db_open(BackendDB *be, ConfigArgs *ca) { slap_overinst *on = (slap_overinst *) be->bd_info; translucent_info *ov = on->on_bi.bi_private; int rc; @@ -727,7 +727,7 @@ static int translucent_db_open(BackendDB *be) { ov->db.be_acl = be->be_acl; ov->db.be_dfltaccess = be->be_dfltaccess; - rc = backend_startup_one( &ov->db ); + rc = backend_startup_one( &ov->db, NULL ); if(rc) Debug(LDAP_DEBUG_TRACE, "translucent: bi_db_open() returned error %d\n", rc, 0, 0); @@ -743,7 +743,7 @@ static int translucent_db_open(BackendDB *be) { */ static int -translucent_db_close( BackendDB *be ) +translucent_db_close( BackendDB *be, ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; translucent_info *ov = on->on_bi.bi_private; @@ -752,7 +752,7 @@ translucent_db_close( BackendDB *be ) Debug(LDAP_DEBUG_TRACE, "==> translucent_db_close\n", 0, 0, 0); if ( ov && ov->db.bd_info && ov->db.bd_info->bi_db_close ) { - rc = ov->db.bd_info->bi_db_close(&ov->db); + rc = ov->db.bd_info->bi_db_close(&ov->db, NULL); } return(rc); @@ -765,7 +765,7 @@ translucent_db_close( BackendDB *be ) */ static int -translucent_db_destroy( BackendDB *be ) +translucent_db_destroy( BackendDB *be, ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; translucent_info *ov = on->on_bi.bi_private; diff --git a/servers/slapd/overlays/unique.c b/servers/slapd/overlays/unique.c index 6852f917d5..7c649190aa 100644 --- a/servers/slapd/overlays/unique.c +++ b/servers/slapd/overlays/unique.c @@ -740,7 +740,8 @@ unique_cf_uri( ConfigArgs *c ) static int unique_db_init( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -755,7 +756,8 @@ unique_db_init( static int unique_db_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; @@ -779,7 +781,8 @@ unique_db_destroy( static int unique_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { Debug(LDAP_DEBUG_TRACE, "unique_open: overlay initialized\n", 0, 0, 0); @@ -795,7 +798,8 @@ unique_open( static int unique_close( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *) be->bd_info; diff --git a/servers/slapd/overlays/valsort.c b/servers/slapd/overlays/valsort.c index c7a7dfa5d5..a06d83a985 100644 --- a/servers/slapd/overlays/valsort.c +++ b/servers/slapd/overlays/valsort.c @@ -479,7 +479,8 @@ valsort_modify( Operation *op, SlapReply *rs ) static int valsort_db_open( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { return overlay_register_control( be, LDAP_CONTROL_VALSORT ); @@ -487,7 +488,8 @@ valsort_db_open( static int valsort_destroy( - BackendDB *be + BackendDB *be, + ConfigArgs *ca ) { slap_overinst *on = (slap_overinst *)be->bd_info; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 8d15e80496..ba4791bcf6 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -320,7 +320,7 @@ LDAP_SLAPD_F (int) backend_init LDAP_P((void)); LDAP_SLAPD_F (int) backend_add LDAP_P((BackendInfo *aBackendInfo)); LDAP_SLAPD_F (int) backend_num LDAP_P((Backend *be)); LDAP_SLAPD_F (int) backend_startup LDAP_P((Backend *be)); -LDAP_SLAPD_F (int) backend_startup_one LDAP_P((Backend *be)); +LDAP_SLAPD_F (int) backend_startup_one LDAP_P((Backend *be, struct config_args_s *ca)); LDAP_SLAPD_F (int) backend_sync LDAP_P((Backend *be)); LDAP_SLAPD_F (int) backend_shutdown LDAP_P((Backend *be)); LDAP_SLAPD_F (int) backend_destroy LDAP_P((void)); @@ -329,7 +329,7 @@ LDAP_SLAPD_F (void) backend_destroy_one LDAP_P((BackendDB *bd, int dynamic)); LDAP_SLAPD_F (BackendInfo *) backend_info LDAP_P(( const char *type )); LDAP_SLAPD_F (BackendDB *) backend_db_init LDAP_P(( const char *type, - BackendDB *be, int idx )); + BackendDB *be, int idx, struct config_args_s *ca )); LDAP_SLAPD_F (void) backend_db_insert LDAP_P((BackendDB *bd, int idx)); LDAP_SLAPD_F (void) backend_db_move LDAP_P((BackendDB *bd, int idx)); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 72fedf3209..15b102ddca 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1874,7 +1874,8 @@ typedef int (BI_config) LDAP_P((BackendInfo *bi, const char *fname, int lineno, int argc, char **argv)); -typedef int (BI_db_func) LDAP_P((Backend *bd)); +struct config_args_s; /* config.h */ +typedef int (BI_db_func) LDAP_P((Backend *bd, struct config_args_s *ca)); typedef BI_db_func BI_db_init; typedef BI_db_func BI_db_open; typedef BI_db_func BI_db_close;