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

Description

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?)

Environment

None

Activity

Scott Cantor June 26, 2012 at 2:14 PM

http://svn.shibboleth.net/view/cpp-sp?rev=3718&view=rev

I'm probably going to formally deprecate this feature in this release. It creates problems all over the attribute code, and the transform plugin should be adequate as a workaround for any code that still needs it. Just FYI.

Fixed

Assignee

Reporter

Fix versions

Affects versions

Created June 26, 2012 at 12:32 PM
Updated June 26, 2012 at 2:15 PM
Resolved June 26, 2012 at 2:14 PM