commit daa5d1e66791a155dc74b220f16422ba206b8788
Author: John Dennis <jdennis@redhat.com>
Date: Tue Jun 13 09:34:36 2017 -0400
If no IdP's are defined explicitly log that fact
Sometimes configuration errors are made and a location does have any
IdP's defined for it. Previosly the error message in this case was:
"Error adding IdP to lasso server object. Please verify the following
configuration directives: MellonIdPMetadataFile and
MellonIdPPublicKeyFile."
But this message is misleading, it suggests an attempt was made to add
the IdP but somehow it failed, this will often cause folks to try to
determine what is wrong with the IdP metadata file, which may in fact
be defined in the mellon config but because of location inheritance is
not being included in the per directory config.
It would be much more helpful to indicate no IdP's were defined for
this config location which is clearly a different problem than
suggesting an attempt was made to add an IdP but it failed.
Signed-off-by: John Dennis <jdennis@redhat.com>
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
index 44a5ee9..2004752 100644
--- a/auth_mellon_handler.c
+++ b/auth_mellon_handler.c
@@ -242,6 +242,12 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r)
idp_public_key_file = NULL;
#endif /* ! HAVE_lasso_server_load_metadata */
+ if (cfg->idp_metadata->nelts == 0) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "Error, URI \"%s\" has no IdP's defined", r->uri);
+ return 0;
+ }
+
for (index = 0; index < cfg->idp_metadata->nelts; index++) {
const am_metadata_t *idp_metadata;
int error;