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

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


Author: scantor
Date: Tue Sep 25 18:04:00 2012
New Revision: 3768

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

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

Modified: branches/REL_2/shibsp/attribute/ScopedAttribute.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/attribute/ScopedAttribute.cpp?rev=3768&r1=3767&r2=3768&view=diff
==============================================================================
--- branches/REL_2/shibsp/attribute/ScopedAttribute.cpp (original)
+++ branches/REL_2/shibsp/attribute/ScopedAttribute.cpp Tue Sep 25 18:04:00 2012
@@ -46,8 +46,17 @@
     if (val.isint())
         m_delimeter = static_cast<char>(val.integer());
     val = in.first().first();
-    while (val.name() && val.string()) {
-        m_values.push_back(make_pair(string(val.name()), string(val.string())));
+    while (!val.isnull()) {
+        // There are two serializations supported. The new one is in 2.5.1 and fixes SPPCPP-504.
+        // The original is the second 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.islist() && val.integer() == 2) {
+            m_values.push_back(make_pair(string(val.first().string()), string(val.last().string())));
+        }
+        else if (val.name() && val.string()) {
+            m_values.push_back(make_pair(string(val.name()), string(val.string())));
+        }
         val = in.first().next();
     }
 }
@@ -110,7 +119,11 @@
         ddf.addmember("_delimeter").integer(m_delimeter);
     DDF vlist = ddf.first();
     for (vector< pair<string,string> >::const_iterator i=m_values.begin(); i!=m_values.end(); ++i) {
-        DDF val = DDF(i->first.c_str()).string(i->second.c_str());
+        DDF one = DDF(nullptr).string(i->first.c_str());
+        DDF two = DDF(nullptr).string(i->second.c_str());
+        DDF val = DDF(nullptr).list();
+        val.add(one);
+        val.add(two);
         vlist.add(val);
     }
     return ddf;



More information about the commits mailing list