[cpp-sp] branch main updated: Sanitize Xerces usage out of PropertySet interface.
Scott Cantor
cantor.2 at osu.edu
Wed Nov 6 18:11:37 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=c6e5e2774fba20ecaf40b366544f679c3e08071d
The following commit(s) were added to refs/heads/main by this push:
new c6e5e277 Sanitize Xerces usage out of PropertySet interface.
c6e5e277 is described below
commit c6e5e2774fba20ecaf40b366544f679c3e08071d
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Nov 6 13:11:19 2024 -0500
Sanitize Xerces usage out of PropertySet interface.
---
apache/mod_shib_24.cpp | 53 +++++---------
shibsp/ServiceProvider.h | 9 ---
shibsp/handler/impl/SAML2SessionInitiator.cpp | 34 ++-------
shibsp/impl/XMLApplication.cpp | 43 +----------
shibsp/impl/XMLRequestMapper.cpp | 3 +-
shibsp/impl/XMLServiceProvider.cpp | 4 +-
shibsp/impl/XMLServiceProvider.h | 16 ++--
shibsp/util/DOMPropertySet.cpp | 101 ++++++--------------------
shibsp/util/DOMPropertySet.h | 14 ++--
shibsp/util/PropertySet.h | 53 ++++----------
shibsp/util/SPConstants.cpp | 35 ---------
shibsp/util/SPConstants.h | 15 ----
12 files changed, 82 insertions(+), 298 deletions(-)
diff --git a/apache/mod_shib_24.cpp b/apache/mod_shib_24.cpp
index fe99d237..0222a9b1 100644
--- a/apache/mod_shib_24.cpp
+++ b/apache/mod_shib_24.cpp
@@ -1061,13 +1061,11 @@ public:
const PropertySet* getParent() const { return nullptr; }
void setParent(const PropertySet*) {}
- pair<bool,bool> getBool(const char* name, const char* ns=nullptr) const;
- pair<bool,const char*> getString(const char* name, const char* ns=nullptr) const;
- pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=nullptr) const;
- pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=nullptr) const;
- pair<bool,int> getInt(const char* name, const char* ns=nullptr) const;
- const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIBSPCONFIG_NS) const;
- const xercesc::DOMElement* getElement() const;
+ pair<bool,bool> getBool(const char* name) const;
+ pair<bool,const char*> getString(const char* name) const;
+ pair<bool,unsigned int> getUnsignedInt(const char* name) const;
+ pair<bool,int> getInt(const char* name) const;
+ const PropertySet* getPropertySet(const char* name) const;
const htAccessControl& getHTAccessControl() const { return m_htaccess; }
@@ -1097,11 +1095,11 @@ RequestMapper::Settings ApacheRequestMapper::getSettings(const HTTPRequest& requ
return pair<const PropertySet*,AccessControl*>(this, s.second);
}
-pair<bool,bool> ApacheRequestMapper::getBool(const char* name, const char* ns) const
+pair<bool,bool> ApacheRequestMapper::getBool(const char* name) const
{
const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
- if (sta && !ns) {
+ if (sta) {
// Override Apache-settable boolean properties.
if (name && !strcmp(name,"requireSession") && sta->m_dc->bRequireSession != -1)
return make_pair(true, sta->m_dc->bRequireSession==1);
@@ -1113,14 +1111,14 @@ pair<bool,bool> ApacheRequestMapper::getBool(const char* name, const char* ns) c
return make_pair(true, !strcmp(prop, "true") || !strcmp(prop, "1") || !strcmp(prop, "On"));
}
}
- return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getBool(name,ns) : make_pair(false,false);
+ return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getBool(name) : make_pair(false,false);
}
-pair<bool,const char*> ApacheRequestMapper::getString(const char* name, const char* ns) const
+pair<bool,const char*> ApacheRequestMapper::getString(const char* name) const
{
const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
- if (sta && !ns) {
+ if (sta) {
// Override Apache-settable string properties.
if (name && !strcmp(name,"authType")) {
const char* auth_type = ap_auth_type(sta->m_req);
@@ -1143,21 +1141,14 @@ pair<bool,const char*> ApacheRequestMapper::getString(const char* name, const ch
return make_pair(true, prop);
}
}
- return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getString(name,ns) : pair<bool,const char*>(false,nullptr);
+ return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getString(name) : pair<bool,const char*>(false,nullptr);
}
-pair<bool,const XMLCh*> ApacheRequestMapper::getXMLString(const char* name, const char* ns) const
-{
- const ShibTargetApache* sta = reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
- const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
- return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getXMLString(name,ns) : pair<bool,const XMLCh*>(false,nullptr);
-}
-
-pair<bool,unsigned int> ApacheRequestMapper::getUnsignedInt(const char* name, const char* ns) const
+pair<bool,unsigned int> ApacheRequestMapper::getUnsignedInt(const char* name) const
{
const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
- if (sta && !ns) {
+ if (sta) {
// Override Apache-settable int properties.
if (name && !strcmp(name,"redirectToSSL") && sta->m_dc->szRedirectToSSL)
return pair<bool,unsigned int>(true, strtol(sta->m_dc->szRedirectToSSL, nullptr, 10));
@@ -1167,14 +1158,14 @@ pair<bool,unsigned int> ApacheRequestMapper::getUnsignedInt(const char* name, co
return pair<bool,unsigned int>(true, atoi(prop));
}
}
- return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getUnsignedInt(name,ns) : pair<bool,unsigned int>(false,0);
+ return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getUnsignedInt(name) : pair<bool,unsigned int>(false,0);
}
-pair<bool,int> ApacheRequestMapper::getInt(const char* name, const char* ns) const
+pair<bool,int> ApacheRequestMapper::getInt(const char* name) const
{
const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
- if (sta && !ns) {
+ if (sta) {
// Override Apache-settable int properties.
if (name && !strcmp(name,"redirectToSSL") && sta->m_dc->szRedirectToSSL)
return pair<bool,int>(true,atoi(sta->m_dc->szRedirectToSSL));
@@ -1184,19 +1175,13 @@ pair<bool,int> ApacheRequestMapper::getInt(const char* name, const char* ns) con
return make_pair(true, atoi(prop));
}
}
- return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getInt(name,ns) : pair<bool,int>(false,0);
-}
-
-const PropertySet* ApacheRequestMapper::getPropertySet(const char* name, const char* ns) const
-{
- const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
- return s ? s->getPropertySet(name,ns) : nullptr;
+ return s && (!sta->m_dc->tUnsettings || !apr_table_get(sta->m_dc->tUnsettings, name)) ? s->getInt(name) : pair<bool,int>(false,0);
}
-const xercesc::DOMElement* ApacheRequestMapper::getElement() const
+const PropertySet* ApacheRequestMapper::getPropertySet(const char* name) const
{
const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
- return s ? s->getElement() : nullptr;
+ return s ? s->getPropertySet(name) : nullptr;
}
// Authz callbacks for Apache 2.4
diff --git a/shibsp/ServiceProvider.h b/shibsp/ServiceProvider.h
index 3bcbc38a..d52b7e08 100644
--- a/shibsp/ServiceProvider.h
+++ b/shibsp/ServiceProvider.h
@@ -76,15 +76,6 @@ namespace shibsp {
*/
virtual void init()=0;
- /**
- * Get the "active" XML namespace of the underlying configuration.
- *
- * <p>This accomodates multiple supported configuration schemas at runtime
- * by allowing components to tailor their behavior to the specific format in
- * use.</p>
- */
- virtual const XMLCh* getConfigurationNamespace() const=0;
-
/**
* Returns a SessionCache instance.
*
diff --git a/shibsp/handler/impl/SAML2SessionInitiator.cpp b/shibsp/handler/impl/SAML2SessionInitiator.cpp
index 8fce76e2..a9b94f1a 100644
--- a/shibsp/handler/impl/SAML2SessionInitiator.cpp
+++ b/shibsp/handler/impl/SAML2SessionInitiator.cpp
@@ -97,16 +97,6 @@ namespace shibsp {
#pragma warning( pop )
#endif
- class SHIBSP_DLLLOCAL SessionInitiatorNodeFilter : public DOMNodeFilter
- {
- public:
- FilterAction acceptNode(const DOMNode* node) const {
- return FILTER_REJECT;
- }
- };
-
- static SHIBSP_DLLLOCAL SessionInitiatorNodeFilter g_SINFilter;
-
SessionInitiator* SHIBSP_DLLLOCAL SAML2SessionInitiatorFactory(const pair<const DOMElement*,const char*>& p, bool deprecationSupport)
{
return new SAML2SessionInitiator(p.first, p.second, deprecationSupport);
@@ -115,11 +105,8 @@ namespace shibsp {
};
SAML2SessionInitiator::SAML2SessionInitiator(const DOMElement* e, const char* appId, bool deprecationSupport)
- : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT ".SessionInitiator.SAML2"), &g_SINFilter, this),
- m_appId(appId), m_deprecationSupport(deprecationSupport)
-#ifdef SHIBSP_LITE
- ,m_ecp(false)
-#endif
+ : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT ".SessionInitiator.SAML2"), nullptr, this),
+ m_appId(appId), m_deprecationSupport(deprecationSupport), m_ecp(false)
{
// If Location isn't set, defer initialization until the setParent call.
pair<bool,const char*> loc = getString("Location");
@@ -339,20 +326,9 @@ pair<bool,long> SAML2SessionInitiator::run(SPRequest& request, string& entityID,
target = prop.second;
}
- // Determine index to use.
- pair<bool,const XMLCh*> ix = pair<bool,const XMLCh*>(false,nullptr);
- if (!strncmp(ACSloc.c_str(), "https://", 8)) {
- ix = ACS->getXMLString("sslIndex", shibspconstants::ASCII_SHIBSPCONFIG_NS);
- if (!ix.first)
- ix = ACS->getXMLString("index");
- }
- else {
- ix = ACS->getXMLString("index");
- }
-
return doRequest(
app, &request, request, entityID.c_str(),
- ix.second,
+ nullptr,
attributeIndex.first ? attributeIndex.second : nullptr,
false,
nullptr, nullptr,
@@ -387,7 +363,7 @@ pair<bool,long> SAML2SessionInitiator::run(SPRequest& request, string& entityID,
nullptr,
attributeIndex.first ? attributeIndex.second : nullptr,
false,
- ACSloc.c_str(), ACS->getXMLString("Binding").second,
+ ACSloc.c_str(), nullptr,
isPassive, forceAuthn,
acClass.first ? acClass.second : nullptr,
acComp.first ? acComp.second : nullptr,
@@ -427,7 +403,7 @@ pair<bool,long> SAML2SessionInitiator::run(SPRequest& request, string& entityID,
// Determine index to use.
pair<bool,const char*> ix = pair<bool,const char*>(false,nullptr);
if (!strncmp(ACSloc.c_str(), "https://", 8)) {
- ix = ACS->getString("sslIndex", shibspconstants::ASCII_SHIBSPCONFIG_NS);
+ ix = ACS->getString("sslIndex");
if (!ix.first)
ix = ACS->getString("index");
}
diff --git a/shibsp/impl/XMLApplication.cpp b/shibsp/impl/XMLApplication.cpp
index 304a366e..53c5f04f 100644
--- a/shibsp/impl/XMLApplication.cpp
+++ b/shibsp/impl/XMLApplication.cpp
@@ -403,52 +403,17 @@ void XMLApplication::doHandlers(const DOMElement* e, Category& log)
const PropertySet* sessions = getPropertySet("Sessions");
- // Process assertion export handler.
- pair<bool,const char*> location = sessions ? sessions->getString("exportLocation") : pair<bool,const char*>(false,nullptr);
- if (location.first) {
- try {
- DOMElement* exportElement = e->getOwnerDocument()->createElementNS(e->getNamespaceURI(), _Handler);
- exportElement->setAttributeNS(nullptr,Location,sessions->getXMLString("exportLocation").second);
- pair<bool,const XMLCh*> exportACL = sessions->getXMLString("exportACL");
- if (exportACL.first) {
- static const XMLCh _acl[] = UNICODE_LITERAL_9(e,x,p,o,r,t,A,C,L);
- exportElement->setAttributeNS(nullptr,_acl,exportACL.second);
- }
- boost::shared_ptr<Handler> exportHandler(
- conf.HandlerManager.newPlugin(
- nullptr, pair<const DOMElement*,const char*>(exportElement, getId()), m_deprecationSupport
- )
- );
- m_handlers.push_back(exportHandler);
-
- // Insert into location map. If it contains the handlerURL, we skip past that part.
- const char* hurl = sessions->getString("handlerURL").second;
- if (!hurl)
- hurl = "/Shibboleth.sso";
- const char* pch = strstr(location.second, hurl);
- if (pch)
- location.second = pch + strlen(hurl);
- if (*location.second == '/')
- m_handlerMap[location.second] = exportHandler.get();
- else
- m_handlerMap[string("/") + location.second] = exportHandler.get();
- }
- catch (const std::exception& ex) {
- log.error("caught exception installing assertion lookup handler: %s", ex.what());
- }
- }
-
// Look for "shorthand" elements first.
set<string> protocols;
- DOMElement* child = sessions ? XMLHelper::getFirstChildElement(sessions->getElement()) : nullptr;
+ DOMElement* child = nullptr;
while (child) {
- if (XMLHelper::isNodeNamed(child, sessions->getElement()->getNamespaceURI(), SSO)) {
+ if (XMLHelper::isNodeNamed(child, nullptr, SSO)) {
if (false)
doSSO(protocols, child, log);
else
log.error("no ProtocolProvider, SSO auto-configure unsupported");
}
- else if (XMLHelper::isNodeNamed(child, sessions->getElement()->getNamespaceURI(), Logout)) {
+ else if (XMLHelper::isNodeNamed(child, nullptr, Logout)) {
if (false)
doLogout(protocols, child, log);
else
@@ -600,7 +565,7 @@ void XMLApplication::doHandlers(const DOMElement* e, Category& log)
m_handlers.push_back(handler);
// Insert into location map.
- location = handler->getString("Location");
+ pair<bool,const char*> location = handler->getString("Location");
if (location.first && *location.second == '/')
m_handlerMap[location.second] = handler.get();
else if (location.first)
diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index 9e7ffae1..e79713c2 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -279,7 +279,8 @@ Override::Override(bool unicodeAware, const DOMElement* e, Category& log, const
try {
boost::shared_ptr<Override> o(new Override(m_unicodeAware, path, log, this));
if (m_unicodeAware) {
- dup = toUTF8(o->getXMLString("name").second, true /* use malloc */);
+ //dup = toUTF8(o->getXMLString("name").second, true /* use malloc */);
+ dup = strdup(o->getString("name").second);
}
else {
dup = strdup(o->getString("name").second);
diff --git a/shibsp/impl/XMLServiceProvider.cpp b/shibsp/impl/XMLServiceProvider.cpp
index c0c0b8fe..ba798ddf 100644
--- a/shibsp/impl/XMLServiceProvider.cpp
+++ b/shibsp/impl/XMLServiceProvider.cpp
@@ -284,8 +284,8 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, XMLConfig* outer,
// Default language handling.
pair<bool,bool> langFromClient = getBool("langFromClient");
- pair<bool,const XMLCh*> langPriority = getXMLString("langPriority");
- GenericRequest::setLangDefaults(!langFromClient.first || langFromClient.second, langPriority.second);
+ pair<bool,const char*> langPriority = getString("langPriority");
+ GenericRequest::setLangDefaults(!langFromClient.first || langFromClient.second, nullptr);
// Extensions
doExtensions(e, "global", log);
diff --git a/shibsp/impl/XMLServiceProvider.h b/shibsp/impl/XMLServiceProvider.h
index d1dbe840..0d56ef30 100644
--- a/shibsp/impl/XMLServiceProvider.h
+++ b/shibsp/impl/XMLServiceProvider.h
@@ -98,20 +98,14 @@ namespace shibsp {
background_load();
}
- const XMLCh* getConfigurationNamespace() const {
- return m_impl ? m_impl->getElement()->getNamespaceURI() : nullptr;
- }
-
// PropertySet
const PropertySet* getParent() const { return m_impl->getParent(); }
void setParent(const PropertySet* parent) { return m_impl->setParent(parent); }
- std::pair<bool, bool> getBool(const char* name, const char* ns = nullptr) const { return m_impl->getBool(name, ns); }
- std::pair<bool, const char*> getString(const char* name, const char* ns = nullptr) const { return m_impl->getString(name, ns); }
- std::pair<bool, const XMLCh*> getXMLString(const char* name, const char* ns = nullptr) const { return m_impl->getXMLString(name, ns); }
- std::pair<bool, unsigned int> getUnsignedInt(const char* name, const char* ns = nullptr) const { return m_impl->getUnsignedInt(name, ns); }
- std::pair<bool, int> getInt(const char* name, const char* ns = nullptr) const { return m_impl->getInt(name, ns); }
- const PropertySet* getPropertySet(const char* name, const char* ns = shibspconstants::ASCII_SHIBSPCONFIG_NS) const { return m_impl->getPropertySet(name, ns); }
- const xercesc::DOMElement* getElement() const { return m_impl->getElement(); }
+ std::pair<bool, bool> getBool(const char* name) const { return m_impl->getBool(name); }
+ std::pair<bool, const char*> getString(const char* name) const { return m_impl->getString(name); }
+ std::pair<bool, unsigned int> getUnsignedInt(const char* name) const { return m_impl->getUnsignedInt(name); }
+ std::pair<bool, int> getInt(const char* name) const { return m_impl->getInt(name); }
+ const PropertySet* getPropertySet(const char* name) const { return m_impl->getPropertySet(name); }
// ServiceProvider
ListenerService* getListenerService(bool required = true) const {
diff --git a/shibsp/util/DOMPropertySet.cpp b/shibsp/util/DOMPropertySet.cpp
index f50f5007..c5b2d3d0 100644
--- a/shibsp/util/DOMPropertySet.cpp
+++ b/shibsp/util/DOMPropertySet.cpp
@@ -96,11 +96,6 @@ void DOMPropertySet::setParent(const PropertySet* parent)
m_parent = parent;
}
-const DOMElement* DOMPropertySet::getElement() const
-{
- return m_root;
-}
-
void DOMPropertySet::load(
const DOMElement* e,
Category* log,
@@ -198,65 +193,30 @@ void DOMPropertySet::load(
walker->release();
}
-pair<bool,bool> DOMPropertySet::getBool(const char* name, const char* ns) const
+pair<bool,bool> DOMPropertySet::getBool(const char* name) const
{
- map< string,pair<char*,const XMLCh*> >::const_iterator i;
-
- if (ns)
- i=m_map.find(string("{") + ns + '}' + name);
- else
- i=m_map.find(name);
-
-
+ const auto i = m_map.find(name);
if (i!=m_map.end())
return make_pair(true,(!strcmp(i->second.first,"true") || !strcmp(i->second.first,"1")));
- else if (m_parent && m_unset.find(ns ? (string("{") + ns + '}' + name) : name) == m_unset.end()) {
- return m_parent->getBool(name, ns);
+ else if (m_parent && m_unset.find(name) == m_unset.end()) {
+ return m_parent->getBool(name);
}
return make_pair(false,false);
}
-pair<bool,const char*> DOMPropertySet::getString(const char* name, const char* ns) const
+pair<bool,const char*> DOMPropertySet::getString(const char* name) const
{
- map< string,pair<char*,const XMLCh*> >::const_iterator i;
-
- if (ns)
- i=m_map.find(string("{") + ns + '}' + name);
- else
- i=m_map.find(name);
-
+ const auto i = m_map.find(name);
if (i!=m_map.end())
return pair<bool,const char*>(true,i->second.first);
- else if (m_parent && m_unset.find(ns ? (string("{") + ns + '}' + name) : name) == m_unset.end())
- return m_parent->getString(name,ns);
+ else if (m_parent && m_unset.find(name) == m_unset.end())
+ return m_parent->getString(name);
return pair<bool,const char*>(false,nullptr);
}
-pair<bool,const XMLCh*> DOMPropertySet::getXMLString(const char* name, const char* ns) const
-{
- map< string,pair<char*,const XMLCh*> >::const_iterator i;
-
- if (ns)
- i=m_map.find(string("{") + ns + '}' + name);
- else
- i=m_map.find(name);
-
- if (i!=m_map.end())
- return make_pair(true,i->second.second);
- else if (m_parent && m_unset.find(ns ? (string("{") + ns + '}' + name) : name) == m_unset.end())
- return m_parent->getXMLString(name,ns);
- return pair<bool,const XMLCh*>(false,nullptr);
-}
-
-pair<bool,unsigned int> DOMPropertySet::getUnsignedInt(const char* name, const char* ns) const
+pair<bool,unsigned int> DOMPropertySet::getUnsignedInt(const char* name) const
{
- map< string,pair<char*,const XMLCh*> >::const_iterator i;
-
- if (ns)
- i=m_map.find(string("{") + ns + '}' + name);
- else
- i=m_map.find(name);
-
+ const auto i = m_map.find(name);
if (i!=m_map.end()) {
try {
return pair<bool,unsigned int>(true,lexical_cast<unsigned int>(i->second.first));
@@ -265,53 +225,40 @@ pair<bool,unsigned int> DOMPropertySet::getUnsignedInt(const char* name, const c
return pair<bool,unsigned int>(false,0);
}
}
- else if (m_parent && m_unset.find(ns ? (string("{") + ns + '}' + name) : name) == m_unset.end())
- return m_parent->getUnsignedInt(name,ns);
+ else if (m_parent && m_unset.find(name) == m_unset.end())
+ return m_parent->getUnsignedInt(name);
return pair<bool,unsigned int>(false,0);
}
-pair<bool,int> DOMPropertySet::getInt(const char* name, const char* ns) const
+pair<bool,int> DOMPropertySet::getInt(const char* name) const
{
- map< string,pair<char*,const XMLCh*> >::const_iterator i;
-
- if (ns)
- i=m_map.find(string("{") + ns + '}' + name);
- else
- i=m_map.find(name);
-
+ const auto i = m_map.find(name);
if (i!=m_map.end())
return pair<bool,int>(true,atoi(i->second.first));
- else if (m_parent && m_unset.find(ns ? (string("{") + ns + '}' + name) : name) == m_unset.end())
- return m_parent->getInt(name,ns);
+ else if (m_parent && m_unset.find(name) == m_unset.end())
+ return m_parent->getInt(name);
return pair<bool,int>(false,0);
}
-const PropertySet* DOMPropertySet::getPropertySet(const char* name, const char* ns) const
+const PropertySet* DOMPropertySet::getPropertySet(const char* name) const
{
- map< string,boost::shared_ptr<DOMPropertySet> >::const_iterator i;
+ const auto i = m_nested.find(name);
- if (ns)
- i = m_nested.find(string("{") + ns + '}' + name);
- else
- i = m_nested.find(name);
-
- return (i != m_nested.end()) ? i->second.get() : (m_parent ? m_parent->getPropertySet(name,ns) : nullptr);
+ return (i != m_nested.end()) ? i->second.get() : (m_parent ? m_parent->getPropertySet(name) : nullptr);
}
-bool DOMPropertySet::setProperty(const char* name, const char* val, const char* ns)
+bool DOMPropertySet::setProperty(const char* name, const char* val)
{
- string propname = ns ? (string("{") + ns + "}" + name) : name;
-
// Erase existing property.
- if (m_map.count(propname) > 0) {
- XMLString::release(&m_map[propname].first);
- m_map.erase(propname);
+ if (m_map.count(name) > 0) {
+ XMLString::release(&m_map[name].first);
+ m_map.erase(name);
}
char* dup = XMLString::replicate(val);
auto_ptr_XMLCh widedup(val);
m_injected.push_back(widedup.get());
- m_map[propname] = make_pair(dup, m_injected.back().c_str());
+ m_map[name] = make_pair(dup, m_injected.back().c_str());
return true;
}
diff --git a/shibsp/util/DOMPropertySet.h b/shibsp/util/DOMPropertySet.h
index 748a87ab..c857cccf 100644
--- a/shibsp/util/DOMPropertySet.h
+++ b/shibsp/util/DOMPropertySet.h
@@ -50,13 +50,11 @@ namespace shibsp {
const PropertySet* getParent() const;
void setParent(const PropertySet* parent);
- std::pair<bool,bool> getBool(const char* name, const char* ns=nullptr) const;
- std::pair<bool,const char*> getString(const char* name, const char* ns=nullptr) const;
- std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=nullptr) const;
- std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=nullptr) const;
- std::pair<bool,int> getInt(const char* name, const char* ns=nullptr) const;
- const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIBSPCONFIG_NS) const;
- const xercesc::DOMElement* getElement() const;
+ std::pair<bool,bool> getBool(const char* name) const;
+ std::pair<bool,const char*> getString(const char* name) const;
+ std::pair<bool,unsigned int> getUnsignedInt(const char* name) const;
+ std::pair<bool,int> getInt(const char* name) const;
+ const PropertySet* getPropertySet(const char* name) const;
/**
* Interface that remaps property names for legacy support.
@@ -127,7 +125,7 @@ namespace shibsp {
* @param ns property namespace
* @return true iff the property was successfully set
*/
- bool setProperty(const char* name, const char* val, const char* ns=nullptr);
+ bool setProperty(const char* name, const char* val);
private:
const PropertySet* m_parent;
diff --git a/shibsp/util/PropertySet.h b/shibsp/util/PropertySet.h
index c6562d62..0870f391 100644
--- a/shibsp/util/PropertySet.h
+++ b/shibsp/util/PropertySet.h
@@ -1,21 +1,15 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you 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
+/*
+ * 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
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
/**
@@ -31,7 +25,6 @@
#include <map>
#include <string>
-#include <xercesc/dom/DOM.hpp>
namespace shibsp {
@@ -67,7 +60,7 @@ namespace shibsp {
* @param ns property namespace, or nullptr
* @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
*/
- virtual std::pair<bool,bool> getBool(const char* name, const char* ns=nullptr) const=0;
+ virtual std::pair<bool,bool> getBool(const char* name) const=0;
/**
* Returns a string-valued property.
@@ -76,16 +69,7 @@ namespace shibsp {
* @param ns property namespace, or nullptr
* @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
*/
- virtual std::pair<bool,const char*> getString(const char* name, const char* ns=nullptr) const=0;
-
- /**
- * Returns a Unicode string-valued property.
- *
- * @param name property name
- * @param ns property namespace, or nullptr
- * @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
- */
- virtual std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=nullptr) const=0;
+ virtual std::pair<bool,const char*> getString(const char* name) const=0;
/**
* Returns an unsigned integer-valued property.
@@ -94,7 +78,7 @@ namespace shibsp {
* @param ns property namespace, or nullptr
* @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
*/
- virtual std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=nullptr) const=0;
+ virtual std::pair<bool,unsigned int> getUnsignedInt(const char* name) const=0;
/**
* Returns an integer-valued property.
@@ -103,7 +87,7 @@ namespace shibsp {
* @param ns property namespace, or nullptr
* @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
*/
- virtual std::pair<bool,int> getInt(const char* name, const char* ns=nullptr) const=0;
+ virtual std::pair<bool,int> getInt(const char* name) const=0;
/**
* Returns a nested property set.
@@ -112,14 +96,7 @@ namespace shibsp {
* @param ns nested property set namespace, or nullptr
* @return the nested property set, or nullptr
*/
- virtual const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIBSPCONFIG_NS) const=0;
-
- /**
- * Returns a DOM element representing the property container, if any.
- *
- * @return a DOM element, or nullptr
- */
- virtual const xercesc::DOMElement* getElement() const=0;
+ virtual const PropertySet* getPropertySet(const char* name) const=0;
};
};
diff --git a/shibsp/util/SPConstants.cpp b/shibsp/util/SPConstants.cpp
index e7a935b5..a6c2ed7e 100644
--- a/shibsp/util/SPConstants.cpp
+++ b/shibsp/util/SPConstants.cpp
@@ -61,21 +61,6 @@ const XMLCh shibspconstants::SHIB2SPCONFIG_NS[] = // urn:mace:shibboleth:2.0:nat
const XMLCh* shibspconstants::SHIBSPCONFIG_NS = shibspconstants::SHIB3SPCONFIG_NS;
-const XMLCh shibspconstants::SHIB2SPPROTOCOLS_NS[] = // urn:mace:shibboleth:2.0:native:sp:protocols
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
- chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
- chDigit_2, chPeriod, chDigit_0, chColon, chLatin_n, chLatin_a, chLatin_t, chLatin_i, chLatin_v, chLatin_e, chColon,
- chLatin_s, chLatin_p, chColon, chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chLatin_s, chNull
-};
-
-const XMLCh shibspconstants::SHIB2ATTRIBUTEMAP_NS[] = // urn:mace:shibboleth:2.0:attribute-map
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
- chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
- chDigit_2, chPeriod, chDigit_0, chColon,
- chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chDash,
- chLatin_m, chLatin_a, chLatin_p, chNull
-};
-
const XMLCh shibspconstants::SHIB2SPNOTIFY_NS[] = // urn:mace:shibboleth:2.0:sp:notify
{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
@@ -83,26 +68,6 @@ const XMLCh shibspconstants::SHIB2SPNOTIFY_NS[] = // urn:mace:shibboleth:2.0:sp:
chLatin_n, chLatin_o, chLatin_t, chLatin_i, chLatin_f, chLatin_y, chNull
};
-const XMLCh shibspconstants::SHIB2ATTRIBUTEFILTER_NS[] = // urn:mace:shibboleth:2.0:afp
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
- chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
- chDigit_2, chPeriod, chDigit_0, chColon, chLatin_a, chLatin_f, chLatin_p, chNull
-};
-
-const XMLCh shibspconstants::SHIB2ATTRIBUTEFILTER_MF_BASIC_NS[] = // urn:mace:shibboleth:2.0:afp:mf:basic
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
- chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
- chDigit_2, chPeriod, chDigit_0, chColon, chLatin_a, chLatin_f, chLatin_p, chColon, chLatin_m, chLatin_f, chColon,
- chLatin_b, chLatin_a, chLatin_s, chLatin_i, chLatin_c, chNull
-};
-
-const XMLCh shibspconstants::SHIB2ATTRIBUTEFILTER_MF_SAML_NS[] = // urn:mace:shibboleth:2.0:afp:mf:saml
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
- chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
- chDigit_2, chPeriod, chDigit_0, chColon, chLatin_a, chLatin_f, chLatin_p, chColon, chLatin_m, chLatin_f, chColon,
- chLatin_s, chLatin_a, chLatin_m, chLatin_l, chNull
-};
-
const XMLCh shibspconstants::SHIB1_ATTRIBUTE_NAMESPACE_URI[] = // urn:mace:shibboleth:1.0:attributeNamespace:uri
{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
diff --git a/shibsp/util/SPConstants.h b/shibsp/util/SPConstants.h
index 676f9e4c..94e4d9ea 100644
--- a/shibsp/util/SPConstants.h
+++ b/shibsp/util/SPConstants.h
@@ -50,24 +50,9 @@ namespace shibspconstants {
/** Shibboleth 2.0 SP configuration namespace ("urn:mace:shibboleth:2.0:native:sp:config") */
extern SHIBSP_API const XMLCh SHIB2SPCONFIG_NS[];
- /** Shibboleth 2.0 SP protocol provider namespace ("urn:mace:shibboleth:2.0:native:sp:protocols") */
- extern SHIBSP_API const XMLCh SHIB2SPPROTOCOLS_NS[];
-
- /** Shibboleth 2.0 attribute mapping namespace ("urn:mace:shibboleth:2.0:attribute-map") */
- extern SHIBSP_API const XMLCh SHIB2ATTRIBUTEMAP_NS[];
-
/** Shibboleth 2.0 notification namespace ("urn:mace:shibboleth:2.0:sp:notify") */
extern SHIBSP_API const XMLCh SHIB2SPNOTIFY_NS[];
- /** Shibboleth 2.0 attribute filter policy namespace ("urn:mace:shibboleth:2.0:afp") */
- extern SHIBSP_API const XMLCh SHIB2ATTRIBUTEFILTER_NS[];
-
- /** Shibboleth 2.0 basic matching function namespace ("urn:mace:shibboleth:2.0:afp:mf:basic") */
- extern SHIBSP_API const XMLCh SHIB2ATTRIBUTEFILTER_MF_BASIC_NS[];
-
- /** Shibboleth 2.0 SAML matching function namespace ("urn:mace:shibboleth:2.0:afp:mf:saml") */
- extern SHIBSP_API const XMLCh SHIB2ATTRIBUTEFILTER_MF_SAML_NS[];
-
/** Shibboleth 1.x Protocol Enumeration constant ("urn:mace:shibboleth:1.0") */
extern SHIBSP_API const XMLCh SHIB1_PROTOCOL_ENUM[];
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list