[JIRA] Created: (SSPCPP-468) Aliases support in XML Attribute Extractor no longer working in 2.5.0 Beta 1

Kaspar Brand (JIRA) noreply at shibboleth.net
Tue Jun 26 13:33:55 BST 2012


Aliases support in XML Attribute Extractor no longer working in 2.5.0 Beta 1
----------------------------------------------------------------------------

                 Key: SSPCPP-468
                 URL: https://issues.shibboleth.net/jira/browse/SSPCPP-468
             Project: Shibboleth SP - C++
          Issue Type: Bug
          Components: Attribute Resolution / Filtering
    Affects Versions: 2.5
            Reporter: Kaspar Brand
            Assignee: Scott Cantor


Same issue as SSPCPP-22, but different cause, actually: with 2.5.0, support for aliases (defined as an attribute on the <Attribute> element in attribute-map.xml) is no longer working.

It's a regression introduced by http://svn.shibboleth.net/view/cpp-sp?view=revision&revision=3554 ("Boost code changes"), specifically the following change to XMLAttributeExtractor.cpp:

         name = child->getAttributeNS(nullptr, _aliases);
         if (name && *name) {
             auto_ptr_char aliases(name);
-            char* pos;
-            char* start = const_cast<char*>(aliases.get());
-            while (start && *start) {
-                while (*start && isspace(*start))
-                    start++;
-                if (!*start)
-                    break;
-                pos = strchr(start,' ');
-                if (pos)
-                    *pos=0;
-                if (strcmp(start, "REMOTE_USER")) {
-                    decl.second.push_back(start);
-                    m_attributeIds.push_back(start);
-                }
-                else {
-                    m_log.warn("skipping alias, REMOTE_USER is a reserved name");
-                }
-                start = pos ? pos+1 : nullptr;
+            string dup(aliases.get());
+            set<string> new_aliases;
+            split(new_aliases, dup, is_space(), algorithm::token_compress_on);
+            set<string>::iterator ru = new_aliases.find("REMOTE_USER");
+            if (ru != new_aliases.end()) {
+                m_log.warn("skipping alias, REMOTE_USER is a reserved name");
+                new_aliases.erase(ru);
             }
+            m_attributeIds.insert(m_attributeIds.end(), new_aliases.begin(), new_aliases.end());
         }
 
         child = XMLHelper::getNextSiblingElement(child, shibspconstants::SHIB2ATTRIBUTEMAP_NS, saml1::Attribute::LOCAL_NAME);


(It's beyond my C++ skills to point out the exact issue with the new code, but perhaps the mix of <set>string [for new_aliases] and <vector>string [for m_attributeIds] is causing troubles?)


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the commits mailing list