/* Define if Xerces-C library was found */
#define HAVE_LIBXERCESC 1
+#include <xercesc/util/XercesVersion.hpp>
+
+#if (XERCES_VERSION_MAJOR < 3)
+# define SHIBSP_XERCESC_HAS_XMLBYTE_RELEASE 1
+# define SHIBSP_XERCESC_SHORT_ACCEPTNODE 1
+#endif
+
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
[AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
[AC_MSG_ERROR([unable to link with Xerces])])
+AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
+AC_TRY_COMPILE([#include <xercesc/util/XMLString.hpp>],
+ [using namespace XERCES_CPP_NAMESPACE;
+ XMLByte* buf=NULL;
+ XMLString::release(&buf);
+ ],
+ [AC_MSG_RESULT([yes])]
+ [AC_DEFINE([SHIBSP_XERCESC_HAS_XMLBYTE_RELEASE], [1], [Define to 1 if Xerces XMLString includes XMLByte release.])],
+ [AC_MSG_RESULT([no])])
+
+AC_MSG_CHECKING([whether Xerces DOMNodeFilter API returns a short])
+AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
+ [using namespace XERCES_CPP_NAMESPACE;
+ class Blocker : public DOMNodeFilter {
+ public:
+ short acceptNode(const DOMNode* node) const {
+ return FILTER_REJECT;
+ }
+ };
+ static Blocker g_Blocker;
+ ],
+ [AC_MSG_RESULT([yes])]
+ [AC_DEFINE([SHIBSP_XERCESC_SHORT_ACCEPTNODE], [1], [Define to 1 if Xerces DOMNodeFilter API returns a short.])],
+ [AC_MSG_RESULT([no])])
#XML-Tooling settings
AC_ARG_WITH(xmltooling,
}
#ifndef SHIBSP_LITE
- SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,QName,const DOMElement*>::Factory StringAttributeDecoderFactory;
- SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,QName,const DOMElement*>::Factory ScopedAttributeDecoderFactory;
- SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,QName,const DOMElement*>::Factory NameIDAttributeDecoderFactory;
- SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,QName,const DOMElement*>::Factory NameIDFromScopedAttributeDecoderFactory;
+ SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory StringAttributeDecoderFactory;
+ SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory ScopedAttributeDecoderFactory;
+ SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory NameIDAttributeDecoderFactory;
+ SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory NameIDFromScopedAttributeDecoderFactory;
static const XMLCh _StringAttributeDecoder[] = UNICODE_LITERAL_22(S,t,r,i,n,g,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
static const XMLCh _ScopedAttributeDecoder[] = UNICODE_LITERAL_22(S,c,o,p,e,d,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
};
#ifndef SHIBSP_LITE
-QName shibsp::StringAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _StringAttributeDecoder);
-QName shibsp::ScopedAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _ScopedAttributeDecoder);
-QName shibsp::NameIDAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _NameIDAttributeDecoder);
-QName shibsp::NameIDFromScopedAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _NameIDFromScopedAttributeDecoder);
+xmltooling::QName shibsp::StringAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _StringAttributeDecoder);
+xmltooling::QName shibsp::ScopedAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _ScopedAttributeDecoder);
+xmltooling::QName shibsp::NameIDAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _NameIDAttributeDecoder);
+xmltooling::QName shibsp::NameIDFromScopedAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _NameIDFromScopedAttributeDecoder);
void shibsp::registerAttributeDecoders()
{
char* val;
char* scope;
const XMLCh* xmlscope;
- QName scopeqname(NULL,Scope);
+ xmltooling::QName scopeqname(NULL,Scope);
auto_ptr<NameIDAttribute> nameid(
new NameIDAttribute(ids, (m_formatter.get() && *m_formatter.get()) ? m_formatter.get() : DEFAULT_NAMEID_FORMATTER)
);
char* val;
char* scope;
const XMLCh* xmlscope;
- QName scopeqname(NULL,Scope);
+ xmltooling::QName scopeqname(NULL,Scope);
auto_ptr<ScopedAttribute> scoped(new ScopedAttribute(ids, m_delimeter));
scoped->setCaseSensitive(m_caseSensitive);
vector< pair<string,string> >& dest = scoped->getValues();
if (*id && functorMap->getMatchFunctors().count(id))
id = "";
- auto_ptr<QName> type(XMLHelper::getXSIType(e));
+ auto_ptr<xmltooling::QName> type(XMLHelper::getXSIType(e));
if (!type.get())
throw ConfigurationException("Child Rule found with no xsi:type.");
using namespace std;
#define DECL_FACTORY(name) \
- SHIBSP_DLLLOCAL PluginManager< MatchFunctor,QName,pair<const FilterPolicyContext*,const DOMElement*> >::Factory name##Factory
+ SHIBSP_DLLLOCAL PluginManager< MatchFunctor,xmltooling::QName,pair<const FilterPolicyContext*,const DOMElement*> >::Factory name##Factory
#define DECL_BASIC_QNAME(name,lit) \
- QName shibsp::name##Type(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_BASIC_NS, lit)
+ xmltooling::QName shibsp::name##Type(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_BASIC_NS, lit)
#define DECL_SAML_QNAME(name,lit) \
- QName shibsp::name##Type(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_SAML_NS, lit)
+ xmltooling::QName shibsp::name##Type(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_SAML_NS, lit)
#define REGISTER_FACTORY(name) \
mgr.registerFactory(name##Type, name##Factory)
void SHIBSP_API shibsp::registerMatchFunctors()
{
- PluginManager< MatchFunctor,QName,pair<const FilterPolicyContext*,const DOMElement*> >& mgr =
+ PluginManager< MatchFunctor,xmltooling::QName,pair<const FilterPolicyContext*,const DOMElement*> >& mgr =
SPConfig::getConfig().MatchFunctorManager;
REGISTER_FACTORY(AnyMatchFunctor);
REGISTER_FACTORY(AndMatchFunctor);
if (*id && functorMap->getMatchFunctors().count(id))
id = "";
- auto_ptr<QName> type(XMLHelper::getXSIType(e));
+ auto_ptr<xmltooling::QName> type(XMLHelper::getXSIType(e));
if (!type.get())
throw ConfigurationException("Child Rule found with no xsi:type.");
if (*id && functorMap->getMatchFunctors().count(id))
id = "";
- auto_ptr<QName> type(XMLHelper::getXSIType(e));
+ auto_ptr<xmltooling::QName> type(XMLHelper::getXSIType(e));
if (!type.get())
throw ConfigurationException("Child Rule found with no xsi:type.");
id = "";
}
- auto_ptr<QName> type(XMLHelper::getXSIType(e));
+ auto_ptr<xmltooling::QName> type(XMLHelper::getXSIType(e));
if (type.get()) {
try {
MatchFunctor* func = SPConfig::getConfig().MatchFunctorManager.newPlugin(*type.get(), make_pair(&functorMap,e));
try {
DOMElement* dchild = XMLHelper::getFirstChildElement(child, shibspconstants::SHIB2ATTRIBUTEMAP_NS, _AttributeDecoder);
if (dchild) {
- auto_ptr<QName> q(XMLHelper::getXSIType(dchild));
+ auto_ptr<xmltooling::QName> q(XMLHelper::getXSIType(dchild));
if (q.get())
decoder = SPConfig::getConfig().AttributeDecoderManager.newPlugin(*q.get(), dchild);
}
throw MetadataException("No compatible endpoint found in issuer's metadata.");
else if (!response)
throw BindingException("Unable to resolve artifact(s) into a SAML response.");
- const QName* code = (response->getStatus() && response->getStatus()->getStatusCode()) ? response->getStatus()->getStatusCode()->getValue() : NULL;
+ const xmltooling::QName* code = (response->getStatus() && response->getStatus()->getStatusCode()) ? response->getStatus()->getStatusCode()->getValue() : NULL;
if (!code || *code != saml1p::StatusCode::SUCCESS) {
delete response;
throw BindingException("Identity provider returned a SAML error in response to artifact(s).");
const saml1p::Status* status = r1->getStatus();
if (status) {
const saml1p::StatusCode* sc = status->getStatusCode();
- const QName* code = sc ? sc->getValue() : NULL;
+ const xmltooling::QName* code = sc ? sc->getValue() : NULL;
if (code && *code != saml1p::StatusCode::SUCCESS) {
FatalProfileException ex("SAML response contained an error.");
ex.addProperty("statusCode", code->toString().c_str());
class SHIBSP_DLLLOCAL Blocker : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
return FILTER_REJECT;
}
};
class SHIBSP_DLLLOCAL LogoutInitiatorNodeFilter : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
if (XMLHelper::isNodeNamed(node,shibspconstants::SHIB2SPCONFIG_NS,_LogoutInitiator))
return FILTER_REJECT;
return FILTER_ACCEPT;
class SHIBSP_DLLLOCAL SessionInitiatorNodeFilter : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
if (XMLHelper::isNodeNamed(node,shibspconstants::SHIB2SPCONFIG_NS,_SessionInitiator))
return FILTER_REJECT;
return FILTER_ACCEPT;
env->setBody(body);
ElementProxy* msg = new AnyElementImpl(shibspconstants::SHIB2SPNOTIFY_NS, LogoutNotification);
body->getUnknownXMLObjects().push_back(msg);
- msg->setAttribute(QName(NULL, _type), local ? _local : _global);
+ msg->setAttribute(xmltooling::QName(NULL, _type), local ? _local : _global);
for (vector<string>::const_iterator s = sessions.begin(); s!=sessions.end(); ++s) {
auto_ptr_XMLCh temp(s->c_str());
ElementProxy* child = new AnyElementImpl(shibspconstants::SHIB2SPNOTIFY_NS, SessionID);
class SHIBSP_DLLLOCAL Blocker : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
return FILTER_REJECT;
}
};
MessageEncoder* m_encoder;
MessageDecoder* m_decoder;
- QName m_role;
+ xmltooling::QName m_role;
#endif
};
getString("Binding").second,pair<const DOMElement*,const XMLCh*>(e,NULL)
);
}
- catch (exception& ex) {
+ catch (exception&) {
m_log.error("error building MessageEncoder/Decoder pair for binding (%s)", getString("Binding").second);
delete m_encoder;
delete m_decoder;
bool front
) const;
- QName m_role;
+ xmltooling::QName m_role;
MessageDecoder* m_decoder;
XMLCh* m_outgoing;
vector<const XMLCh*> m_bindings;
bool front
) const;
- QName m_role;
+ xmltooling::QName m_role;
MessageDecoder* m_decoder;
XMLCh* m_outgoing;
vector<const XMLCh*> m_bindings;
hurl += loc;
auto_ptr_XMLCh widen(hurl.c_str());
ElementProxy* ep = new AnyElementImpl(m_discoNS.get(), LOCAL_NAME);
- ep->setAttribute(QName(NULL,EndpointType::LOCATION_ATTRIB_NAME), widen.get());
- ep->setAttribute(QName(NULL,EndpointType::BINDING_ATTRIB_NAME), m_discoNS.get());
+ ep->setAttribute(xmltooling::QName(NULL,EndpointType::LOCATION_ATTRIB_NAME), widen.get());
+ ep->setAttribute(xmltooling::QName(NULL,EndpointType::BINDING_ATTRIB_NAME), m_discoNS.get());
pair<bool,const XMLCh*> ix = getXMLString("index");
- ep->setAttribute(QName(NULL,IndexedEndpointType::INDEX_ATTRIB_NAME), ix.first ? ix.second : xmlconstants::XML_ONE);
+ ep->setAttribute(xmltooling::QName(NULL,IndexedEndpointType::INDEX_ATTRIB_NAME), ix.first ? ix.second : xmlconstants::XML_ONE);
Extensions* ext = role.getExtensions();
if (!ext) {
class SHIBSP_DLLLOCAL Blocker : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
return FILTER_REJECT;
}
};
class SHIBSP_DLLLOCAL Blocker : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
return FILTER_REJECT;
}
};
class SHIBSP_DLLLOCAL TransformSINodeFilter : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
return FILTER_REJECT;
}
};
~Override();
// Provides filter to exclude special config elements.
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
return FILTER_REJECT;
}
}
// Provides filter to exclude special config elements.
- short acceptNode(const DOMNode* node) const;
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const;
private:
void cleanup();
#endif
// Provides filter to exclude special config elements.
- short acceptNode(const DOMNode* node) const;
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const;
void setDocument(DOMDocument* doc) {
m_document = doc;
class SHIBSP_DLLLOCAL PolicyNodeFilter : public DOMNodeFilter
{
public:
- short acceptNode(const DOMNode* node) const {
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+ short
+#else
+ FilterAction
+#endif
+ acceptNode(const DOMNode* node) const {
return FILTER_REJECT;
}
};
#endif
}
-short XMLApplication::acceptNode(const DOMNode* node) const
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+short
+#else
+DOMNodeFilter::FilterAction
+#endif
+XMLApplication::acceptNode(const DOMNode* node) const
{
const XMLCh* name=node->getLocalName();
if (XMLString::equals(name,ApplicationOverride) ||
}
}
-short XMLConfigImpl::acceptNode(const DOMNode* node) const
+#ifdef SHIBSP_XERCESC_SHORT_ACCEPTNODE
+short
+#else
+DOMNodeFilter::FilterAction
+#endif
+XMLConfigImpl::acceptNode(const DOMNode* node) const
{
if (!XMLString::equals(node->getNamespaceURI(),shibspconstants::SHIB2SPCONFIG_NS))
return FILTER_ACCEPT;
/*
* Copyright 2001-2007 Internet2
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
/**
* CommonDomainCookie.cpp
- *
- * Helper class for maintaining discovery cookie.
+ *
+ * Helper class for maintaining discovery cookie.
*/
#include "internal.h"
free(b64);
// Now Base64 decode the list.
- unsigned int len;
+ xsecsize_t len;
for (vector<string>::iterator i=templist.begin(); i!=templist.end(); ++i) {
XMLByte* decoded=Base64::decode(reinterpret_cast<const XMLByte*>(i->c_str()),&len);
if (decoded && *decoded) {
m_list.push_back(reinterpret_cast<char*>(decoded));
+#ifdef SHIBSP_XERCESC_HAS_XMLBYTE_RELEASE
XMLString::release(&decoded);
+#else
+ XMLString::release((char**)&decoded);
+#endif
}
}
}
break;
}
}
-
+
// Append it to the end.
m_list.push_back(entityID);
-
+
// Now rebuild the delimited list.
- unsigned int len;
+ xsecsize_t len;
string delimited;
for (vector<string>::const_iterator j=m_list.begin(); j!=m_list.end(); j++) {
if (!delimited.empty()) delimited += ' ';
-
+
XMLByte* b64=Base64::encode(reinterpret_cast<const XMLByte*>(j->c_str()),j->length(),&len);
XMLByte *pos, *pos2;
for (pos=b64, pos2=b64; *pos2; pos2++)
if (isgraph(*pos2))
*pos++=*pos2;
*pos=0;
-
+
delimited += reinterpret_cast<char*>(b64);
+#ifdef SHIBSP_XERCESC_HAS_XMLBYTE_RELEASE
XMLString::release(&b64);
+#else
+ XMLString::release((char**)&b64);
+#endif
}
-
+
m_encoded=XMLToolingConfig::getConfig().getURLEncoder()->encode(delimited.c_str());
return m_encoded.c_str();
}
public:
- ScopeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ ScopeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
init();
}
XMLString::release(&m_VerifyDepth);
}
- KeyAuthorityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ KeyAuthorityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
init();
}
IMPL_TYPED_CHILDREN(KeyInfo,m_children.end());
public:
- void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
+ void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),VERIFYDEPTH_ATTRIB_NAME)) {
setVerifyDepth(value);
};
#define REGISTER_ELEMENT(cname) \
- q=QName(SHIBMD_NS,cname::LOCAL_NAME); \
+ q=xmltooling::QName(SHIBMD_NS,cname::LOCAL_NAME); \
XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
SchemaValidators.registerValidator(q,new cname##SchemaValidator())
void shibsp::registerMetadataExtClasses() {
- QName q;
+ xmltooling::QName q;
REGISTER_ELEMENT(Scope);
REGISTER_ELEMENT(KeyAuthority);