[cpp-sp COMMIT] /branches/REL_2/shibsp/attribute/NameIDAttribute.cpp

noreply at shibboleth.net noreply at shibboleth.net
Tue Sep 25 18:04:10 EDT 2012


Author: scantor
Date: Tue Sep 25 18:04:10 2012
New Revision: 3769

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

Modified:
    branches/REL_2/shibsp/attribute/NameIDAttribute.cpp

Modified: branches/REL_2/shibsp/attribute/NameIDAttribute.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/attribute/NameIDAttribute.cpp?rev=3769&r1=3768&r2=3769&view=diff
==============================================================================
--- branches/REL_2/shibsp/attribute/NameIDAttribute.cpp (original)
+++ branches/REL_2/shibsp/attribute/NameIDAttribute.cpp Tue Sep 25 18:04:10 2012
@@ -61,10 +61,21 @@
         m_hashAlg = val.string();
     const char* pch;
     val = in.first().first();
-    while (val.name()) {
+    while (!val.isnull()) {
         m_values.push_back(Value());
         Value& v = m_values.back();
-        v.m_Name = val.name();
+        // There are two serializations supported. The new one is in 2.5.1 and fixes SPPCPP-504.
+        // The original is the first branch and was vulnerable to non-ASCII characters in the value.
+        // Supporting both means at least minimal support for rolling upgrades if a shibd instance is
+        // shared.
+        if (val.name()) {
+            v.m_Name = val.name();
+        }
+        else {
+            pch = val["Name"].string();
+            if (pch)
+                v.m_Name = pch;
+        }
         pch = val["Format"].string();
         if (pch)
             v.m_Format = pch;
@@ -176,7 +187,8 @@
         ddf.addmember("_hashalg").string(m_hashAlg.c_str());
     DDF vlist = ddf.first();
     for (vector<Value>::const_iterator i=m_values.begin(); i!=m_values.end(); ++i) {
-        DDF val = DDF(i->m_Name.c_str()).structure();
+        DDF val = DDF(nullptr).structure();
+        val.addmember("Name").string(i->m_Name.c_str());
         if (!i->m_Format.empty())
             val.addmember("Format").string(i->m_Format.c_str());
         if (!i->m_NameQualifier.empty())



More information about the commits mailing list