From 44c32c4010ab88d962006c1894402683f5dd2fe4 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Fri, 20 Aug 2010 02:30:39 +0000 Subject: [PATCH] https://issues.shibboleth.net/jira/browse/SSPCPP-210 --- shibsp/impl/XMLServiceProvider.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/shibsp/impl/XMLServiceProvider.cpp b/shibsp/impl/XMLServiceProvider.cpp index 69c55cc..bff5b55 100644 --- a/shibsp/impl/XMLServiceProvider.cpp +++ b/shibsp/impl/XMLServiceProvider.cpp @@ -645,13 +645,29 @@ XMLApplication::XMLApplication( } // Finally, load relying parties. - child = XMLHelper::getFirstChildElement(e,RelyingParty); + child = XMLHelper::getFirstChildElement(e, RelyingParty); while (child) { - auto_ptr rp(new DOMPropertySet()); - rp->load(child,nullptr,this); - rp->setParent(this); - m_partyMap[child->getAttributeNS(nullptr,saml2::Attribute::NAME_ATTRIB_NAME)]=rp.release(); - child = XMLHelper::getNextSiblingElement(child,RelyingParty); + if (child->hasAttributeNS(nullptr, saml2::Attribute::NAME_ATTRIB_NAME)) { + auto_ptr rp(new DOMPropertySet()); + rp->load(child, nullptr, this); + rp->setParent(this); + m_partyMap[child->getAttributeNS(nullptr, saml2::Attribute::NAME_ATTRIB_NAME)] = rp.release(); + } + child = XMLHelper::getNextSiblingElement(child, RelyingParty); + } + if (base && m_partyMap.empty() && !base->m_partyMap.empty()) { + // For inheritance of RPs to work, we have to pull them in to the override by cloning the DOM. + child = XMLHelper::getFirstChildElement(base->getElement(), RelyingParty); + while (child) { + if (child->hasAttributeNS(nullptr, saml2::Attribute::NAME_ATTRIB_NAME)) { + DOMElement* rpclone = static_cast(child->cloneNode(true)); + auto_ptr rp(new DOMPropertySet()); + rp->load(rpclone, nullptr, this); + rp->setParent(this); + m_partyMap[rpclone->getAttributeNS(nullptr, saml2::Attribute::NAME_ATTRIB_NAME)] = rp.release(); + } + child = XMLHelper::getNextSiblingElement(child, RelyingParty); + } } #endif -- 2.1.4