X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=mech_eap%2Futil_shib.cpp;h=a83a7ea46ae633bc03dfd637d3674ba1274c1f90;hb=16f1f5fc519b45f8ec522843def18c9c8abc9b41;hp=418cb774011254501a195d03ecefdd281ef3e923;hpb=e3842cc03c700c076390c308c87be652accb4e1a;p=mech_eap.orig diff --git a/mech_eap/util_shib.cpp b/mech_eap/util_shib.cpp index 418cb77..a83a7ea 100644 --- a/mech_eap/util_shib.cpp +++ b/mech_eap/util_shib.cpp @@ -304,7 +304,22 @@ 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) { + 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);