]> git.sur5r.net Git - openldap/commitdiff
pass ConfigReply into overlay_config() to allow progating error messages
authorQuanah Gibson-Mount <quanah@openldap.org>
Mon, 2 Jun 2008 20:00:53 +0000 (20:00 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 2 Jun 2008 20:00:53 +0000 (20:00 +0000)
back through back-config
pass ConfigReply to slapi overlay initialization

servers/slapd/backglue.c
servers/slapd/backover.c
servers/slapd/bconfig.c
servers/slapd/overlays/ppolicy.c
servers/slapd/proto-slap.h
servers/slapd/slapi/plugin.c
servers/slapd/slapi/proto-slapi.h
servers/slapd/slapi/slapi_overlay.c

index 6786f20394cd9bdf487eabec34cff0f144e8f24b..15ef0380edeb25f45309820ddbbf5a44e99f2f78 100644 (file)
@@ -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;
                        }
index 46d879b63bea5c2bb15d31e9f3f4406a4c4a750c..b813b9b662a1b184ff6aa11db2478ab7ff845d1b 100644 (file)
@@ -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;
index e2486ca65260476265431baa79938b45baaab02c..882be198c825b9c528af4e32b1abccd69fb73426 100644 (file)
@@ -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);
index 622fba7f9f126a443f02095cf2c096ab707e1399..6f96c02426106e5781df2d39288ea67b4b5c1ef2 100644 (file)
@@ -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;
                        }
                }
index ef6e454115b51771b0debcac7570c16f6f5da866..77cfac404bf8ce77f6003cbeac482558818d0a99 100644 (file)
@@ -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 ));
index d2b2aaebb43c1d2c0dcd661e51efc6f52fe087e2..d84921a2422fd94dbdf88e1f9389d386c10aa6aa 100644 (file)
  */
 
 #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;
                }
        }
index 7359c6e28d9f4b733cb3c55c654acf1a872694ca..fc6941b220e907f400351f82dc106aa4ef72cb10 100644 (file)
@@ -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
 
index 48cb7ae97170b43340ee2ef6317d1f8b38b9ac19..d717b4ceae11c02ce42ff6b1f411f4b824ce5361 100644 (file)
@@ -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 */