From: Scott Cantor Date: Fri, 20 Aug 2010 02:30:39 +0000 (+0000) Subject: https://issues.shibboleth.net/jira/browse/SSPCPP-210 X-Git-Tag: 2.4RC1~64 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=44c32c4010ab88d962006c1894402683f5dd2fe4;hp=806eac236820059f7422255ef915f941bb32cbf1;p=shibboleth%2Fcpp-sp.git https://issues.shibboleth.net/jira/browse/SSPCPP-210 --- 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