[cpp-sp] branch master updated: SSPCPP-778 - Fork configuration and address backward compatibility
Scott Cantor
cantor.2 at osu.edu
Wed Feb 14 16:11:40 EST 2018
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=455682f1b5ec04b8ebf6c1ae7117c6e41e334d51
The following commit(s) were added to refs/heads/master by this push:
new 455682f SSPCPP-778 - Fork configuration and address backward compatibility
455682f is described below
commit 455682f1b5ec04b8ebf6c1ae7117c6e41e334d51
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Feb 14 16:11:10 2018 -0500
SSPCPP-778 - Fork configuration and address backward compatibility
https://issues.shibboleth.net/jira/browse/SSPCPP-778
Change default config file name and add legacy fallback.
---
shibsp/SPConfig.cpp | 21 +++++++++++++++++----
shibsp/base.h | 5 ++++-
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/shibsp/SPConfig.cpp b/shibsp/SPConfig.cpp
index bd93ca8..c4bd28a 100644
--- a/shibsp/SPConfig.cpp
+++ b/shibsp/SPConfig.cpp
@@ -404,17 +404,21 @@ bool SPConfig::instantiate(const char* config, bool rethrow)
#ifdef _DEBUG
NDC ndc("instantiate");
#endif
+
+ bool retry = false;
+
if (!config)
config = getenv("SHIBSP_CONFIG");
- if (!config)
+ if (!config) {
config = SHIBSP_CONFIG;
+ retry = true;
+ }
try {
xercesc::DOMDocument* dummydoc;
if (*config == '"' || *config == '\'') {
throw ConfigurationException("The value of SHIBSP_CONFIG started with a quote.");
}
else if (*config != '<') {
-
// Mock up some XML.
string resolved(config);
stringstream snippet;
@@ -448,9 +452,18 @@ bool SPConfig::instantiate(const char* config, bool rethrow)
return true;
}
catch (std::exception& ex) {
- if (rethrow)
+ if (retry) {
+ Category::getInstance(SHIBSP_LOGCAT ".Config").warn(
+ "failed to load default configuration (%s), retrying with legacy default (%s)", config, SHIBSP2_CONFIG
+ );
+ return instantiate(SHIBSP2_CONFIG, rethrow);
+ }
+ else if (rethrow) {
throw;
- Category::getInstance(SHIBSP_LOGCAT ".Config").fatal("caught exception while loading configuration: %s", ex.what());
+ }
+ else {
+ Category::getInstance(SHIBSP_LOGCAT ".Config").fatal("caught exception while loading configuration: %s", ex.what());
+ }
}
return false;
}
diff --git a/shibsp/base.h b/shibsp/base.h
index 0b2c521..cea76bd 100644
--- a/shibsp/base.h
+++ b/shibsp/base.h
@@ -95,7 +95,10 @@
#define SHIBSP_TX_LOGCAT "Shibboleth-TRANSACTION"
/** Default name of configuration file. */
-# define SHIBSP_CONFIG "shibboleth2.xml"
+# define SHIBSP_CONFIG "shibboleth3.xml"
+
+/** Default name of configuration file. */
+# define SHIBSP2_CONFIG "shibboleth2.xml"
#ifdef WIN32
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list