X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=moonshot%2Fmech_eap%2Futil_shib.cpp;h=0ee894b5e3efe3e5033e3a5cfc5149a82efe16a6;hb=5e6d3b372b94f98e621f3845f25d58b50fde1599;hp=418cb774011254501a195d03ecefdd281ef3e923;hpb=edb29949782b32da6ff4b24898324baacfc15a00;p=moonshot.git diff --git a/moonshot/mech_eap/util_shib.cpp b/moonshot/mech_eap/util_shib.cpp index 418cb77..0ee894b 100644 --- a/moonshot/mech_eap/util_shib.cpp +++ b/moonshot/mech_eap/util_shib.cpp @@ -304,7 +304,23 @@ gss_eap_shib_attr_provider::getAttribute(const gss_buffer_t attr, buf.value = (void *)shibAttr->getSerializedValues()[*more].c_str(); buf.length = strlen((char *)buf.value); - if (buf.length != 0) { + /* FIXME treating all valid base64 values as binary is bad */ + if (base64Valid((char *)buf.value)) { + ssize_t octetLen; + + value->value = GSSEAP_MALLOC(buf.length); + if (value->value == NULL) + throw std::bad_alloc(); + + 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);