From 9d72509d05f181cde44805ba11665a60ff75b8f9 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Fri, 30 May 2008 14:49:24 +0000 Subject: [PATCH] pass ConfigReply into overlay_config() to allow progating error messages back through back-config --- servers/slapd/backglue.c | 2 +- servers/slapd/backover.c | 4 ++-- servers/slapd/bconfig.c | 4 ++-- servers/slapd/overlays/ppolicy.c | 7 ++++++- servers/slapd/proto-slap.h | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 6786f20394..15ef0380ed 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -1099,7 +1099,7 @@ glue_sub_attach() /* If it's not already configured, set up the overlay */ if ( !SLAP_GLUE_INSTANCE( be )) { - rc = overlay_config( be, glue.on_bi.bi_type, -1, NULL ); + rc = overlay_config( be, glue.on_bi.bi_type, -1, NULL, NULL); if ( rc ) break; } diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 46d879b63b..b813b9b662 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -1143,7 +1143,7 @@ overlay_move( BackendDB *be, slap_overinst *on, int idx ) /* add an overlay to a particular backend. */ int -overlay_config( BackendDB *be, const char *ov, int idx, BackendInfo **res ) +overlay_config( BackendDB *be, const char *ov, int idx, BackendInfo **res, ConfigReply *cr ) { slap_overinst *on = NULL, *on2 = NULL, **prev; slap_overinfo *oi = NULL; @@ -1278,7 +1278,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, NULL ); + rc = on2->on_bi.bi_db_init( be, cr); be->bd_info = (BackendInfo *)oi; if ( rc ) { *prev = on2->on_next; diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index e2486ca652..882be198c8 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -2140,13 +2140,13 @@ config_overlay(ConfigArgs *c) { assert(0); } if(c->argv[1][0] == '-' && overlay_config(c->be, &c->argv[1][1], - c->valx, &c->bi)) { + c->valx, &c->bi, &c->reply)) { /* log error */ Debug( LDAP_DEBUG_ANY, "%s: (optional) %s overlay \"%s\" configuration failed.\n", c->log, c->be == frontendDB ? "global " : "", &c->argv[1][1]); return 1; - } else if(overlay_config(c->be, c->argv[1], c->valx, &c->bi)) { + } else if(overlay_config(c->be, c->argv[1], c->valx, &c->bi, &c->reply)) { return(1); } return(0); diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index 622fba7f9f..6f96c02426 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -2093,7 +2093,12 @@ ppolicy_db_init( for (i=0; pwd_UsSchema[i].def; i++) { code = slap_str2ad( pwd_UsSchema[i].def, pwd_UsSchema[i].ad, &err ); if ( code ) { - fprintf( stderr, "User Schema Load failed %d: %s\n", code, err ); + if ( cr ){ + snprintf( cr->msg, sizeof(cr->msg), + "User Schema load failed for attribute \"%s\". Error code %d: %s", + pwd_UsSchema[i].def, code, err ); + fprintf( stderr, "%s\n", cr->msg ); + } return code; } } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index ef6e454115..77cfac404b 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -435,7 +435,7 @@ LDAP_SLAPD_F (int) glue_sub_del( BackendDB *be ); */ LDAP_SLAPD_F (int) overlay_register LDAP_P(( slap_overinst *on )); LDAP_SLAPD_F (int) overlay_config LDAP_P(( BackendDB *be, const char *ov, - int idx, BackendInfo **res )); + int idx, BackendInfo **res, ConfigReply *cr )); LDAP_SLAPD_F (void) overlay_destroy_one LDAP_P(( BackendDB *be, slap_overinst *on )); -- 2.39.5