[cpp-sp] branch master updated: SSPCPP-701 Add code to make local copy of protocols.xml
Rod Widdowson
rdw at steadingsoftware.com
Wed Jun 8 12:36:10 EDT 2016
This is an automated email from the git hooks/post-receive script.
rdw 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=8661656b35f2ce15c930535412ae7c9d57ade79a
The following commit(s) were added to refs/heads/master by this push:
new 8661656 SSPCPP-701 Add code to make local copy of protocols.xml
8661656 is described below
commit 8661656b35f2ce15c930535412ae7c9d57ade79a
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Jun 8 17:29:28 2016 +0100
SSPCPP-701 Add code to make local copy of protocols.xml
https://issues.shibboleth.net/jira/browse/SSPCPP-701
Note that this uses the old paradigm (load into a DOM
and then serialize out), which is subject to SSPCPP-684,
but the domain is much more constrained so this is not
an issue.
---
shibsp/binding/impl/XMLProtocolProvider.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/shibsp/binding/impl/XMLProtocolProvider.cpp b/shibsp/binding/impl/XMLProtocolProvider.cpp
index 3084076..be29538 100644
--- a/shibsp/binding/impl/XMLProtocolProvider.cpp
+++ b/shibsp/binding/impl/XMLProtocolProvider.cpp
@@ -31,6 +31,7 @@
#include "util/SPConstants.h"
#include <map>
+#include <fstream>
#include <boost/shared_ptr.hpp>
#include <xmltooling/io/HTTPResponse.h>
#include <xmltooling/util/NDC.h>
@@ -198,6 +199,19 @@ pair<bool,DOMElement*> XMLProtocolProvider::load(bool backup)
// Load from source using base class.
pair<bool,DOMElement*> raw = ReloadableXMLFile::load(backup);
+ if (!backup && !m_backing.empty()) {
+ m_log.debug("backing up remote resource to (%s)", m_backing.c_str());
+ try {
+ Locker locker(getBackupLock());
+ ofstream backer(m_backing.c_str());
+ backer << *(raw.second->getOwnerDocument());
+ preserveCacheTag();
+ }
+ catch (std::exception& ex) {
+ m_log.crit("exception while backing up resource: %s", ex.what());
+ }
+ }
+
// If we own it, wrap it.
XercesJanitor<DOMDocument> docjanitor(raw.first ? raw.second->getOwnerDocument() : nullptr);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list