Commit c8acdaf6 authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

pass ConfigReply into overlay_config() to allow progating error messages

back through back-config
pass ConfigReply to slapi overlay initialization
parent d6ec4f7b
......@@ -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;
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
}
}
......
......@@ -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 ));
......
......@@ -21,10 +21,11 @@
*/
#include "portable.h"
#include <ldap_pvt_thread.h>
#include <slap.h>
#include <slapi.h>
#include <lutil.h>
#include "ldap_pvt_thread.h"
#include "slap.h"
#include "config.h"
#include "slapi.h"
#include "lutil.h"
/*
* Note: if ltdl.h is not available, slapi should not be compiled
......@@ -645,8 +646,10 @@ slapi_int_read_config(
/* automatically instantiate overlay if necessary */
if ( !slapi_over_is_inst( be ) ) {
if ( slapi_over_config( be ) != 0 ) {
fprintf( stderr, "Failed to instantiate SLAPI overlay\n");
ConfigReply cr = { 0 };
if ( slapi_over_config( be, &cr ) != 0 ) {
fprintf( stderr, "Failed to instantiate SLAPI overlay: "
"err=%d msg=\"%s\"\n", cr.err, cr.msg );
return -1;
}
}
......
......@@ -83,7 +83,7 @@ LDAP_SLAPI_F (int) slapi_int_clear_object_extensions LDAP_P((int objecttype, voi
/* slapi_overlay.c */
LDAP_SLAPI_F (int) slapi_over_is_inst LDAP_P((BackendDB *));
LDAP_SLAPI_F (int) slapi_over_config LDAP_P((BackendDB *));
LDAP_SLAPI_F (int) slapi_over_config LDAP_P((BackendDB *, ConfigReply *));
LDAP_END_DECL
......
......@@ -916,7 +916,7 @@ int slapi_over_is_inst( BackendDB *be )
return overlay_is_inst( be, SLAPI_OVERLAY_NAME );
}
int slapi_over_config( BackendDB *be )
int slapi_over_config( BackendDB *be, ConfigReply *cr )
{
if ( slapi_over_initialized == 0 ) {
int rc;
......@@ -940,7 +940,7 @@ int slapi_over_config( BackendDB *be )
slapi_over_initialized = 1;
}
return overlay_config( be, SLAPI_OVERLAY_NAME, -1, NULL );
return overlay_config( be, SLAPI_OVERLAY_NAME, -1, NULL, cr );
}
#endif /* LDAP_SLAPI */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment