[shibboleth-sp2] 51/89: SSPCPP-701 Add code to make local copy of protocols.xml
Ferenc Wágner
wferi at moszumanska.debian.org
Thu Sep 1 09:24:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
wferi pushed a commit to branch master
in repository shibboleth-sp2.
commit 8661656b35f2ce15c930535412ae7c9d57ade79a
Author: Rod Widdowson <rdw at steadingsoftware.com>
Date: 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);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git
More information about the Pkg-shibboleth-devel
mailing list