From 3be820440e3176873c19ea101800071b79431bdf Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Tue, 3 Feb 2015 18:29:31 +0000 Subject: [PATCH] https://issues.shibboleth.net/jira/browse/SSPCPP-623 --- .../attribute/resolver/impl/XMLAttributeExtractor.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp b/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp index beb726c..d37720d 100644 --- a/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp +++ b/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp @@ -320,7 +320,13 @@ XMLExtractorImpl::XMLExtractorImpl(const DOMElement* e, Category& log) format = &chNull; // ignore default Format/Namespace values // Fetch/create the map entry and see if it's a duplicate rule. - pair< boost::shared_ptr,vector >& decl = m_attrMap[pair(name,format)]; + // Trim the format and the name only if the format is the default (URI). + pair entryKey(name,format); + if (*format == chNull) { + trim(entryKey.first); + } + trim(entryKey.second); + pair< boost::shared_ptr,vector >& decl = m_attrMap[entryKey]; if (decl.first) { m_log.warn("skipping duplicate Attribute mapping (same name and nameFormat)"); child = XMLHelper::getNextSiblingElement(child, shibspconstants::SHIB2ATTRIBUTEMAP_NS, saml1::Attribute::LOCAL_NAME); @@ -328,8 +334,8 @@ XMLExtractorImpl::XMLExtractorImpl(const DOMElement* e, Category& log) } if (m_log.isInfoEnabled()) { - auto_ptr_char n(name); - auto_ptr_char f(format); + auto_ptr_char n(entryKey.first.c_str()); + auto_ptr_char f(entryKey.second.c_str()); m_log.info("creating mapping for Attribute %s%s%s", n.get(), *f.get() ? ", Format/Namespace:" : "", f.get()); } @@ -340,8 +346,9 @@ XMLExtractorImpl::XMLExtractorImpl(const DOMElement* e, Category& log) // Check for isRequired/isRequested. bool requested = XMLHelper::getAttrBool(child, false, isRequested); bool required = XMLHelper::getAttrBool(child, false, RequestedAttribute::ISREQUIRED_ATTRIB_NAME); - if (required || requested) - m_requestedAttrs.push_back(boost::tuple(name,format,required)); + if (required || requested) { + m_requestedAttrs.push_back(boost::tuple(entryKey.first, entryKey.second, required)); + } name = child->getAttributeNS(nullptr, _aliases); if (name && *name) { -- 2.1.4