From 16f1f5fc519b45f8ec522843def18c9c8abc9b41 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 16 May 2011 01:16:41 +0200 Subject: [PATCH 1/1] allow binary resolved attributes --- mech_eap/util_shib.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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); -- 2.1.4