[cpp-sp COMMIT] /branches/REL_2/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp

noreply at shibboleth.net noreply at shibboleth.net
Tue Feb 3 13:29:31 EST 2015


Author: scantor
Date: Tue Feb  3 13:29:31 2015
New Revision: 3903

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3903&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-623

Modified:
    branches/REL_2/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp

Modified: branches/REL_2/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp?rev=3903&r1=3902&r2=3903&view=diff
==============================================================================
--- branches/REL_2/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp (original)
+++ branches/REL_2/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp Tue Feb  3 13:29:31 2015
@@ -320,7 +320,13 @@
             format = &chNull;  // ignore default Format/Namespace values
 
         // Fetch/create the map entry and see if it's a duplicate rule.
-        pair< boost::shared_ptr<AttributeDecoder>,vector<string> >& decl = m_attrMap[pair<xstring,xstring>(name,format)];
+        // Trim the format and the name only if the format is the default (URI).
+        pair<xstring,xstring> entryKey(name,format);
+        if (*format == chNull) {
+            trim(entryKey.first);
+        }
+        trim(entryKey.second);
+        pair< boost::shared_ptr<AttributeDecoder>,vector<string> >& 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 @@
         }
 
         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 @@
         // 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<xstring,xstring,bool>(name,format,required));
+        if (required || requested) {
+            m_requestedAttrs.push_back(boost::tuple<xstring,xstring,bool>(entryKey.first, entryKey.second, required));
+        }
 
         name = child->getAttributeNS(nullptr, _aliases);
         if (name && *name) {



More information about the commits mailing list