https://bugs.internet2.edu/jira/browse/SSPCPP-300
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 9 Aug 2010 20:32:58 +0000 (20:32 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 9 Aug 2010 20:32:58 +0000 (20:32 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/branches/REL_2@3289 cb58f699-b61c-0410-a6fe-9272a202ed29

shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp

index 4c49473..fd8ebd7 100644 (file)
@@ -533,6 +533,7 @@ void XMLExtractorImpl::extractAttributes(
         format = saml2::Attribute::UNSPECIFIED;
     else if (XMLString::equals(format, saml2::Attribute::URI_REFERENCE))
         format = &chNull;
+
 #ifdef HAVE_GOOD_STL
     if ((rule=m_attrMap.find(pair<xstring,xstring>(name,format))) != m_attrMap.end()) {
 #else
@@ -541,10 +542,27 @@ void XMLExtractorImpl::extractAttributes(
     if ((rule=m_attrMap.find(pair<string,string>(temp1.get(),temp2.get()))) != m_attrMap.end()) {
 #endif
         Attribute* a = rule->second.first->decode(rule->second.second, &attr, assertingParty, relyingParty);
-        if (a)
+        if (a) {
             attributes.push_back(a);
+            return;
+        }
     }
-    else if (m_log.isInfoEnabled()) {
+    else if (XMLString::equals(format, saml2::Attribute::UNSPECIFIED)) {
+        // As a fallback, if the format is "unspecified", null out the value and re-map.
+#ifdef HAVE_GOOD_STL
+        if ((rule=m_attrMap.find(pair<xstring,xstring>(name,xstring()))) != m_attrMap.end()) {
+#else
+        if ((rule=m_attrMap.find(pair<string,string>(temp1.get(),string()))) != m_attrMap.end()) {
+#endif
+            Attribute* a = rule->second.first->decode(rule->second.second, &attr, assertingParty, relyingParty);
+            if (a) {
+                attributes.push_back(a);
+                return;
+            }
+        }
+    }
+
+    if (m_log.isInfoEnabled()) {
 #ifdef HAVE_GOOD_STL
         auto_ptr_char temp1(name);
         auto_ptr_char temp2(format);