[cpp-opensaml] branch master updated: Remove legacy Xerces support.
Scott Cantor
cantor.2 at osu.edu
Mon Nov 27 16:30:06 EST 2017
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository cpp-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-opensaml.git;a=commit;h=1b404b5d590a33c4aa21cb2e1b943af207c1d4dc
The following commit(s) were added to refs/heads/master by this push:
new 1b404b5 Remove legacy Xerces support.
1b404b5 is described below
commit 1b404b5d590a33c4aa21cb2e1b943af207c1d4dc
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Nov 27 16:30:02 2017 -0500
Remove legacy Xerces support.
---
config_win32.h | 6 ------
configure.ac | 14 ++++----------
saml/binding/impl/SAMLArtifact.cpp | 12 ------------
saml/binding/impl/SimpleSigningRule.cpp | 12 ------------
saml/saml1/binding/impl/SAML1POSTEncoder.cpp | 4 ----
saml/saml2/binding/impl/SAML2POSTEncoder.cpp | 8 --------
saml/saml2/binding/impl/SAML2RedirectDecoder.cpp | 11 ++---------
saml/saml2/binding/impl/SAML2RedirectEncoder.cpp | 4 ----
saml/util/CommonDomainCookie.cpp | 8 --------
9 files changed, 6 insertions(+), 73 deletions(-)
diff --git a/config_win32.h b/config_win32.h
index 5735fee..317e069 100644
--- a/config_win32.h
+++ b/config_win32.h
@@ -35,12 +35,6 @@
/* Define if log4cpp library is used. */
/* #undef OPENSAML_LOG4CPP */
-#include <xercesc/util/XercesVersion.hpp>
-
-#if (XERCES_VERSION_MAJOR < 3)
-# define OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE 1
-#endif
-
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
diff --git a/configure.ac b/configure.ac
index 1d5d26d..1dc8487 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,24 +225,18 @@ AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces heade
AC_MSG_CHECKING([Xerces version])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
-[#if _XERCES_VERSION != 20600
+[#if _XERCES_VERSION >= 30000
int i = 0;
#else
-#error cannot use version 2.6.0
+#error cannot use version 1.x or 2.x
#endif])],
[AC_MSG_RESULT(OK)],
- [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
+ [AC_MSG_FAILURE([Xerces-C 3.x is required])])
+
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],[[xercesc::XMLPlatformUtils::Initialize()]])],
,[AC_MSG_ERROR([unable to link with Xerces])])
-AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
- [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
- [AC_MSG_RESULT([yes])AC_DEFINE([OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
- [AC_MSG_RESULT([no])])
-
# XML-Security settings
AC_ARG_WITH(xmlsec,
AS_HELP_STRING([--with-xmlsec=PATH],[where xmlsec is installed]),,
diff --git a/saml/binding/impl/SAMLArtifact.cpp b/saml/binding/impl/SAMLArtifact.cpp
index f2e9750..20a1c0f 100644
--- a/saml/binding/impl/SAMLArtifact.cpp
+++ b/saml/binding/impl/SAMLArtifact.cpp
@@ -86,11 +86,7 @@ SAMLArtifact::SAMLArtifact(const char* s)
XMLByte* ptr=decoded;
while (len--)
m_raw+= *ptr++;
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
}
string SAMLArtifact::getBytes() const
@@ -114,11 +110,7 @@ string SAMLArtifact::encode() const
XMLByte* out=Base64::encode(reinterpret_cast<const XMLByte*>(m_raw.data()),m_raw.size(),&len);
if (out) {
string ret(reinterpret_cast<char*>(out),len);
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&out);
-#else
XMLString::release((char**)&out);
-#endif
return ret;
}
return string();
@@ -135,11 +127,7 @@ SAMLArtifact* SAMLArtifact::parse(const char* s)
string type;
type+= decoded[0];
type+= decoded[1];
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
return SAMLConfig::getConfig().SAMLArtifactManager.newPlugin(type,s);
}
diff --git a/saml/binding/impl/SimpleSigningRule.cpp b/saml/binding/impl/SimpleSigningRule.cpp
index f9d6dce..584431b 100644
--- a/saml/binding/impl/SimpleSigningRule.cpp
+++ b/saml/binding/impl/SimpleSigningRule.cpp
@@ -160,11 +160,7 @@ bool SimpleSigningRule::evaluate(const XMLObject& message, const GenericRequest*
return false;
}
input = string("SAMLRequest=") + reinterpret_cast<const char*>(decoded);
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
}
else {
pch = httpRequest->getParameter("SAMLResponse");
@@ -174,11 +170,7 @@ bool SimpleSigningRule::evaluate(const XMLObject& message, const GenericRequest*
return false;
}
input = string("SAMLResponse=") + reinterpret_cast<const char*>(decoded);
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
}
pch = httpRequest->getParameter("RelayState");
@@ -206,11 +198,7 @@ bool SimpleSigningRule::evaluate(const XMLObject& message, const GenericRequest*
catch (XMLToolingException& ex) {
log.warn("Failed to load KeyInfo from message: %s", ex.what());
}
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
}
else {
log.warn("Failed to load KeyInfo from message: Unable to decode base64-encoded KeyInfo.");
diff --git a/saml/saml1/binding/impl/SAML1POSTEncoder.cpp b/saml/saml1/binding/impl/SAML1POSTEncoder.cpp
index 7ce4811..918166d 100644
--- a/saml/saml1/binding/impl/SAML1POSTEncoder.cpp
+++ b/saml/saml1/binding/impl/SAML1POSTEncoder.cpp
@@ -168,11 +168,7 @@ long SAML1POSTEncoder::encode(
if (out) {
xmlbuf.erase();
xmlbuf.append(reinterpret_cast<char*>(out),len);
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&out);
-#else
XMLString::release((char**)&out);
-#endif
}
else {
throw BindingException("Base64 encoding of XML failed.");
diff --git a/saml/saml2/binding/impl/SAML2POSTEncoder.cpp b/saml/saml2/binding/impl/SAML2POSTEncoder.cpp
index 6905f48..271d9f0 100644
--- a/saml/saml2/binding/impl/SAML2POSTEncoder.cpp
+++ b/saml/saml2/binding/impl/SAML2POSTEncoder.cpp
@@ -199,11 +199,7 @@ long SAML2POSTEncoder::encode(
throw BindingException("Base64 encoding of XML failed.");
kstring.erase();
kstring.append(reinterpret_cast<char*>(out),len);
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&out);
-#else
XMLString::release((char**)&out);
-#endif
}
}
@@ -214,11 +210,7 @@ long SAML2POSTEncoder::encode(
throw BindingException("Base64 encoding of XML failed.");
msg.erase();
msg.append(reinterpret_cast<char*>(out),len);
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&out);
-#else
XMLString::release((char**)&out);
-#endif
// Push the rest of it into template and send result to client.
log.debug("message encoded, sending HTML form template to client");
diff --git a/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp b/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp
index 0fb0910..c5259c1 100644
--- a/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp
+++ b/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp
@@ -112,20 +112,13 @@ XMLObject* SAML2RedirectDecoder::decode(
// Now we have to inflate it.
stringstream s;
if (inflate(reinterpret_cast<char*>(decoded), x, s)==0) {
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
throw BindingException("Unable to inflate Redirect binding message.");
}
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug("decoded SAML message:\n%s", s.str().c_str());
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
+ }
XMLString::release((char**)&decoded);
-#endif
// Parse and bind the document into an XMLObject.
DOMDocument* doc = (policy.getValidating() ? XMLToolingConfig::getConfig().getValidatingParser()
diff --git a/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp b/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp
index 7b37a9a..6f5249d 100644
--- a/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp
+++ b/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp
@@ -147,11 +147,7 @@ long SAML2RedirectEncoder::encode(
if (!isspace(*xb))
xmlbuf += *xb;
}
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&encoded);
-#else
XMLString::release((char**)&encoded);
-#endif
const URLEncoder* escaper = XMLToolingConfig::getConfig().getURLEncoder();
xmlbuf = (request ? "SAMLRequest=" : "SAMLResponse=") + escaper->encode(xmlbuf.c_str());
diff --git a/saml/util/CommonDomainCookie.cpp b/saml/util/CommonDomainCookie.cpp
index f1a481c..d53c44e 100644
--- a/saml/util/CommonDomainCookie.cpp
+++ b/saml/util/CommonDomainCookie.cpp
@@ -63,11 +63,7 @@ CommonDomainCookie::CommonDomainCookie(const char* cookie)
XMLByte* decoded=Base64::decode(reinterpret_cast<const XMLByte*>(i->c_str()),&len);
if (decoded && *decoded) {
i->assign(reinterpret_cast<char*>(decoded));
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&decoded);
-#else
XMLString::release((char**)&decoded);
-#endif
}
}
}
@@ -105,11 +101,7 @@ const char* CommonDomainCookie::set(const char* entityID)
if (!delimited.empty())
delimited += ' ';
delimited += reinterpret_cast<char*>(b64);
-#ifdef OPENSAML_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&b64);
-#else
XMLString::release((char**)&b64);
-#endif
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list