_db_destroy functions.
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;
#include <lutil.h>
#include <ldap_rq.h>
#include "alock.h"
+#include "config.h"
static const struct bdbi_database {
char *file;
#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;
}
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;
#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
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 */
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;
}
static int
-bdb_db_destroy( BackendDB *be )
+bdb_db_destroy( BackendDB *be, ConfigArgs *ca )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
#include <stdio.h>
#include <ac/socket.h>
+#include <ac/param.h>
+#include <ac/string.h>
#include "slap.h"
+#include "config.h"
#include "proto-dnssrv.h"
int
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;
}
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;
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;
}
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:;
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;
}
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:;
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;
}
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;
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 {
lca->be->be_private = (void *)li;
- return lca->func( lca->be );
+ return lca->func( lca->be, NULL );
}
static int
db.bd_info = lback;
db.be_private = lc->lc_common_li;
- rc = func( &db );
+ rc = func( &db, NULL );
if ( rc != 0 ) {
return rc;
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;
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;
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;
}
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;
}
}
}
- return lback->bi_db_open( be );
+ return lback->bi_db_open( be, NULL );
}
typedef struct ldap_chain_conn_apply_t {
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(
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;
}
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;
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 {
lca->be->be_private = (void *)li;
- return lca->func( lca->be );
+ return lca->func( lca->be, NULL );
}
static int
db.bd_info = lback;
db.be_private = lc->lc_common_li;
- rc = func( &db );
+ rc = func( &db, NULL );
if ( rc != 0 ) {
return rc;
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;
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;
}
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;
}
#include <ac/socket.h>
#include "slap.h"
+#include "config.h"
#include "back-ldap.h"
int
}
int
-ldap_back_db_init( Backend *be )
+ldap_back_db_init( Backend *be, ConfigArgs *ca )
{
ldapinfo_t *li;
int rc;
}
int
-ldap_back_db_open( BackendDB *be )
+ldap_back_db_open( BackendDB *be, ConfigArgs *ca )
{
ldapinfo_t *li = (ldapinfo_t *)be->be_private;
}
int
-ldap_back_db_close( Backend *be )
+ldap_back_db_close( Backend *be, ConfigArgs *ca )
{
int rc = 0;
}
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;
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;
}
static int
-ldif_back_db_init( BackendDB *be )
+ldif_back_db_init( BackendDB *be, ConfigArgs *ca )
{
struct ldif_info *ni;
}
static int
-ldif_back_db_destroy(
- Backend *be
- )
+ldif_back_db_destroy( Backend *be, ConfigArgs *ca )
{
struct ldif_info *ni = be->be_private;
}
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 */
#include <ac/socket.h>
#include "slap.h"
+#include "config.h"
#include "../back-ldap/back-ldap.h"
#include "back-meta.h"
int
meta_back_db_init(
- Backend *be )
+ Backend *be,
+ ConfigArgs *ca)
{
metainfo_t *mi;
int i;
int
meta_back_db_open(
- Backend *be )
+ Backend *be,
+ ConfigArgs *ca )
{
metainfo_t *mi = (metainfo_t *)be->be_private;
int
meta_back_db_destroy(
- Backend *be )
+ Backend *be,
+ ConfigArgs *ca )
{
metainfo_t *mi;
int
monitor_back_db_init(
- BackendDB *be )
+ BackendDB *be,
+ ConfigArgs *c)
{
int rc;
struct berval dn = BER_BVC( SLAPD_MONITOR_DN ),
* 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;
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;
}
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;
int
monitor_back_db_destroy(
- BackendDB *be )
+ BackendDB *be,
+ ConfigArgs *ca)
{
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
#include <ac/string.h>
#include "slap.h"
+#include "config.h"
struct null_info {
int ni_bind_allowed;
}
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;
}
static int
-null_back_db_destroy( Backend *be )
+null_back_db_destroy( Backend *be, ConfigArgs *ca )
{
free( be->be_private );
return 0;
*/
#include "perl_back.h"
-
+#include "config.h"
/**********************************************************
*
* Close
int
perl_back_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
free( be->be_private );
*/
#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));
int
perl_back_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
be->be_private = (PerlBackend *) ch_malloc( sizeof(PerlBackend) );
int
perl_back_db_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
int count;
#include <ac/string.h>
#include "slap.h"
+#include "config.h"
#include "back-relay.h"
int
}
int
-relay_back_db_init( Backend *be )
+relay_back_db_init( Backend *be, ConfigArgs *ca)
{
relay_back_info *ri;
}
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;
}
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;
#include "slap.h"
+#include "config.h"
+
#include "shell.h"
int
int
shell_back_db_init(
- Backend *be
+ Backend *be,
+ ConfigArgs *ca
)
{
struct shellinfo *si;
int
shell_back_db_destroy(
- Backend *be
+ Backend *be,
+ ConfigArgs *ca
)
{
free( be->be_private );
#include "ac/string.h"
#include "slap.h"
+#include "config.h"
#include "proto-sql.h"
int
int
backsql_db_init(
- BackendDB *bd )
+ BackendDB *bd,
+ ConfigArgs *ca )
{
backsql_info *bi;
int rc = 0;
int
backsql_db_destroy(
- BackendDB *bd )
+ BackendDB *bd,
+ ConfigArgs *ca )
{
backsql_info *bi = (backsql_info*)bd->be_private;
int
backsql_db_open(
- BackendDB *bd )
+ BackendDB *bd,
+ ConfigArgs *ca )
{
backsql_info *bi = (backsql_info*)bd->be_private;
SQLHDBC dbh = SQL_NULL_HDBC;
int
backsql_db_close(
- BackendDB *bd )
+ BackendDB *bd,
+ ConfigArgs *ca )
{
backsql_info *bi = (backsql_info*)bd->be_private;
#include <sys/stat.h>
#include "slap.h"
+#include "config.h"
#include "lutil.h"
#include "lber_pvt.h"
}
/* startup a specific backend database */
-int backend_startup_one(Backend *be)
+int backend_startup_one(Backend *be, ConfigArgs *ca)
{
int rc = 0;
(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 );
/* 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",
/* 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;
}
}
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 ) {
/* 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) {
/* 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",
}
if ( bd->bd_info->bi_db_destroy ) {
- bd->bd_info->bi_db_destroy( bd );
+ bd->bd_info->bi_db_destroy( bd, NULL );
}
}
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 );
backend_db_init(
const char *type,
BackendDB *b0,
- int idx )
+ int idx,
+ ConfigArgs *ca)
{
BackendInfo *bi = backend_info(type);
BackendDB *be = b0;
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 ) {
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 );
}
}
#define SLAPD_TOOLS
#include "slap.h"
+#include "config.h"
typedef struct gluenode {
BackendDB *gn_be;
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 )
static int
glue_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
glue_db_destroy (
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
glue_db_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
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;
static int
over_db_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
return over_db_func( be, db_open );
static int
over_db_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinfo *oi = be->bd_info->bi_private;
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;
static int
over_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinfo *oi = be->bd_info->bi_private;
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 );
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;
} 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);
}
}
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;
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 ) {
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;
/* 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;
};
static int
-config_back_db_open( BackendDB *be )
+config_back_db_open( BackendDB *be, ConfigArgs *ca )
{
CfBackInfo *cfb = be->be_private;
struct berval rdn;
}
static int
-config_back_db_close( BackendDB *be )
+config_back_db_close( BackendDB *be, ConfigArgs *ca )
{
CfBackInfo *cfb = be->be_private;
}
static int
-config_back_db_destroy( BackendDB *be )
+config_back_db_destroy( BackendDB *be, ConfigArgs *ca )
{
CfBackInfo *cfb = be->be_private;
}
static int
-config_back_db_init( BackendDB *be )
+config_back_db_init( BackendDB *be, ConfigArgs* ca )
{
struct berval dn;
CfBackInfo *cfb;
#ifndef CONFIG_H
#define CONFIG_H
+#include<ac/string.h>
+
typedef struct ConfigTable {
char *name;
char *what;
static int
accesslog_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
accesslog_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
accesslog_db_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
auditlog_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
auditlog_db_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
auditlog_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
constraint_close(
- BackendDB *be
- )
+ BackendDB *be,
+ ConfigArgs *ca )
{
slap_overinst *on = (slap_overinst *) be->bd_info;
constraint *ap, *a2;
static int
dds_db_init(
- BackendDB *be )
+ BackendDB *be,
+ ConfigArgs *ca)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
dds_info_t *di;
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;
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;
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;
#include <ac/socket.h>
#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
static int
dyngroup_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
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;
static int
dynlist_db_destroy(
- BackendDB *be )
+ BackendDB *be,
+ ConfigArgs *ca )
{
slap_overinst *on = (slap_overinst *) be->bd_info;
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 );
static int
pcache_db_init(
- BackendDB *be )
+ BackendDB *be,
+ ConfigArgs *ca)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
cache_manager *cm;
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;
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 ) {
static int
pcache_db_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
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;
static int
pcache_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
ppolicy_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
static int
ppolicy_db_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
return overlay_register_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST );
static int
ppolicy_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
static int
refint_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
refint_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
refint_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
refint_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
#include <ac/socket.h>
#include "slap.h"
+#include "config.h"
#include "lutil.h"
#include "ldif.h"
}
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;
}
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;
}
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;
} 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;
static int
rwm_db_init(
- BackendDB *be )
+ BackendDB *be,
+ ConfigArgs *ca )
{
slap_overinst *on = (slap_overinst *) be->bd_info;
struct ldaprwmap *rwmap;
on->on_bi.bi_private = (void *)rwmap;
if ( rc ) {
- (void)rwm_db_destroy( be );
+ (void)rwm_db_destroy( be, NULL );
}
return rc;
static int
rwm_db_destroy(
- BackendDB *be )
+ BackendDB *be,
+ ConfigArgs *ca )
{
slap_overinst *on = (slap_overinst *) be->bd_info;
int rc = 0;
#ifdef SLAPD_OVER_SEQMOD
#include "slap.h"
+#include "config.h"
/* This overlay serializes concurrent attempts to modify a single entry */
static int
seqmod_db_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
seqmod_db_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
*/
static int
syncprov_db_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
*/
static int
syncprov_db_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
static int
syncprov_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
syncprov_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
**
*/
-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;
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;
}
**
*/
-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;
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);
*/
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;
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);
*/
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;
static int
unique_db_init(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
unique_db_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
static int
unique_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
Debug(LDAP_DEBUG_TRACE, "unique_open: overlay initialized\n", 0, 0, 0);
static int
unique_close(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
static int
valsort_db_open(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
return overlay_register_control( be, LDAP_CONTROL_VALSORT );
static int
valsort_destroy(
- BackendDB *be
+ BackendDB *be,
+ ConfigArgs *ca
)
{
slap_overinst *on = (slap_overinst *)be->bd_info;
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));
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));
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;