From 096ce6f74192c04615e8a1954d3a97687dc272eb Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 27 Dec 2007 17:36:39 +0000 Subject: [PATCH] pass ConfigReply to overlays; don't complain unless once-only overlays are instantiated multiple times --- servers/slapd/backover.c | 19 ++++++++++--------- servers/slapd/config.h | 4 ++-- servers/slapd/slap.h | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 874ccf065a..2eb131addb 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -39,6 +39,7 @@ enum db_which { static int over_db_func( BackendDB *be, + ConfigReply *cr, enum db_which which ) { @@ -51,14 +52,14 @@ over_db_func( func = &oi->oi_orig->bi_db_open; if ( func[which] ) { be->bd_info = oi->oi_orig; - rc = func[which]( be, NULL ); + rc = func[which]( be, cr ); } 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, NULL ); + rc = func[which]( be, cr ); } } be->bd_info = bi_orig; @@ -172,7 +173,7 @@ over_db_open( ConfigReply *cr ) { - return over_db_func( be, db_open ); + return over_db_func( be, cr, db_open ); } static int @@ -189,13 +190,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, NULL ); + rc = be->bd_info->bi_db_close( be, cr ); } } if ( oi->oi_orig->bi_db_close ) { be->bd_info = oi->oi_orig; - rc = be->bd_info->bi_db_close( be, NULL ); + rc = be->bd_info->bi_db_close( be, cr ); } be->bd_info = bi_orig; @@ -212,7 +213,7 @@ over_db_destroy( slap_overinst *on = oi->oi_list, *next; int rc; - rc = over_db_func( be, db_destroy ); + rc = over_db_func( be, cr, db_destroy ); if ( on ) { for (next = on->on_next; on; on=next) { @@ -1248,10 +1249,10 @@ overlay_config( BackendDB *be, const char *ov, int idx, BackendInfo **res ) } else { if ( overlay_is_inst( be, ov ) ) { - Debug( LDAP_DEBUG_ANY, "overlay_config(): " - "overlay \"%s\" already in list\n", - ov, 0, 0 ); if ( SLAPO_SINGLE( be ) ) { + Debug( LDAP_DEBUG_ANY, "overlay_config(): " + "overlay \"%s\" already in list\n", + ov, 0, 0 ); return 1; } } diff --git a/servers/slapd/config.h b/servers/slapd/config.h index 61b2dc65b1..5964b8df9a 100644 --- a/servers/slapd/config.h +++ b/servers/slapd/config.h @@ -108,10 +108,10 @@ typedef struct ConfigOCs { typedef int (ConfigDriver)(struct config_args_s *c); -typedef struct config_reply_s { +struct config_reply_s { int err; char msg[SLAP_TEXT_BUFLEN]; -} ConfigReply; +}; typedef struct config_args_s { int argc; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 20e2eb3ca6..3109b20efa 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1903,8 +1903,8 @@ typedef int (BI_config) LDAP_P((BackendInfo *bi, const char *fname, int lineno, int argc, char **argv)); -struct config_reply_s ; /* config.h */ -typedef int (BI_db_func) LDAP_P((Backend *bd, struct config_reply_s *c)); +typedef struct config_reply_s ConfigReply; /* config.h */ +typedef int (BI_db_func) LDAP_P((Backend *bd, ConfigReply *cr)); typedef BI_db_func BI_db_init; typedef BI_db_func BI_db_open; typedef BI_db_func BI_db_close; -- 2.39.5