From: Luke Howard Date: Mon, 23 May 2011 15:05:30 +0000 (-0400) Subject: Upgrade Shibboleth for binary attribute support X-Git-Tag: tr-beta1~140 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=commitdiff_plain;h=0f93de8a14210cdfbdd072ada46d4e2d8f61b496 Upgrade Shibboleth for binary attribute support --- diff --git a/moonshot/mech_eap/util_shib.cpp b/moonshot/mech_eap/util_shib.cpp index 15a8b44..ba83762 100644 --- a/moonshot/mech_eap/util_shib.cpp +++ b/moonshot/mech_eap/util_shib.cpp @@ -54,6 +54,7 @@ #include #include +#include #include #include @@ -193,7 +194,7 @@ gss_eap_shib_attr_provider::setAttribute(int complete GSSEAP_UNUSED, { string attrStr((char *)attr->value, attr->length); vector ids(1, attrStr); - SimpleAttribute *a = new SimpleAttribute(ids); + BinaryAttribute *a = new BinaryAttribute(ids); assert(m_initialized); @@ -283,7 +284,8 @@ gss_eap_shib_attr_provider::getAttribute(const gss_buffer_t attr, int *more) const { const Attribute *shibAttr = NULL; - gss_buffer_desc buf; + gss_buffer_desc valueBuf = GSS_C_EMPTY_BUFFER; + gss_buffer_desc displayValueBuf = GSS_C_EMPTY_BUFFER; int nvalues, i = *more; assert(m_initialized); @@ -301,39 +303,30 @@ gss_eap_shib_attr_provider::getAttribute(const gss_buffer_t attr, if (i >= nvalues) return false; - buf.value = (void *)shibAttr->getSerializedValues()[*more].c_str(); - buf.length = strlen((char *)buf.value); + if (typeid(*shibAttr) == typeid(BinaryAttribute)) { + const BinaryAttribute *binaryAttr = + dynamic_cast(shibAttr); + std::string str = binaryAttr->getValues()[*more]; - /* XXX hack until we have proper binary attribute support */ - if (attr->length == sizeof("urn:mspac:") - 1 && - memcmp(attr->value, "urn:mspac:", attr->length) == 0) { - ssize_t octetLen; + valueBuf.value = (void *)str.data(); + valueBuf.length = str.size(); + } else { + std::string str = shibAttr->getSerializedValues()[*more]; - value->value = GSSEAP_MALLOC(buf.length); - if (value->value == NULL) - throw std::bad_alloc(); + valueBuf.value = (void *)str.c_str(); + valueBuf.length = str.length(); - octetLen = base64Decode((char *)buf.value, value->value); - if (octetLen < 0) { - GSSEAP_FREE(value->value); - value->value = NULL; - return false; - } - - value->length = octetLen; - } else if (buf.length != 0) { - if (value != NULL) - duplicateBuffer(buf, value); - - if (display_value != NULL) - duplicateBuffer(buf, display_value); + displayValueBuf = valueBuf; } if (authenticated != NULL) *authenticated = m_authenticated; if (complete != NULL) *complete = true; - + if (value != NULL) + duplicateBuffer(valueBuf, value); + if (display_value != NULL) + duplicateBuffer(displayValueBuf, display_value); if (nvalues > ++i) *more = i; diff --git a/shibboleth/opensaml2 b/shibboleth/opensaml2 index c1d7574..99dbaa4 160000 --- a/shibboleth/opensaml2 +++ b/shibboleth/opensaml2 @@ -1 +1 @@ -Subproject commit c1d75749e438628900ae880a3dafd96f4a97f15e +Subproject commit 99dbaa4bd3135146178eb201c76f024770a02713 diff --git a/shibboleth/resolver b/shibboleth/resolver index 24967b2..e1448b2 160000 --- a/shibboleth/resolver +++ b/shibboleth/resolver @@ -1 +1 @@ -Subproject commit 24967b25cc7d6573d3ab76d0d8a1f02d93c6b106 +Subproject commit e1448b2d4c30435dc69124cfb7b6371275910355 diff --git a/shibboleth/sp b/shibboleth/sp index bdbac80..52e973a 160000 --- a/shibboleth/sp +++ b/shibboleth/sp @@ -1 +1 @@ -Subproject commit bdbac801c636a747fdb3c0a39a564f3f77452cf3 +Subproject commit 52e973ac041e2fc3ae3131b1099d435dce6a730d diff --git a/shibboleth/xmltooling b/shibboleth/xmltooling index ec12184..353b772 160000 --- a/shibboleth/xmltooling +++ b/shibboleth/xmltooling @@ -1 +1 @@ -Subproject commit ec12184bd72287b88af4301bde2df916fc475615 +Subproject commit 353b7728052ee906e8950756c5dfacefc1be3089