Blame SOURCES/log_no_idp.patch

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