From: Luke Howard Date: Sat, 25 Sep 2010 13:46:34 +0000 (+0200) Subject: add some SASL descriptions X-Git-Tag: vm/20110310~223 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=17349e5d0dbbea34c49ef52d49d55480f1a4e845;p=mech_eap.orig add some SASL descriptions --- diff --git a/inquire_mech_for_saslname.c b/inquire_mech_for_saslname.c index f42df28..0d0d60f 100644 --- a/inquire_mech_for_saslname.c +++ b/inquire_mech_for_saslname.c @@ -40,6 +40,24 @@ gss_inquire_saslname_for_mech(OM_uint32 *minor, gss_buffer_t mech_description) { gss_buffer_t name; + krb5_enctype etype = ENCTYPE_NULL; + krb5_context krbContext; + + GSSEAP_KRB_INIT(&krbContext); + + makeStringBuffer(minor, + "Extensible Authentication Protocol GSS-API Mechanism", + mech_description); + + /* Dynamically construct mechanism name from Kerberos string enctype */ + if (oidEqual(mech, GSS_EAP_MECHANISM)) { + makeStringBuffer(minor, "eap", mech_name); + } else if (gssEapOidToEnctype(minor, mech, &etype) == GSS_S_COMPLETE) { + char krbBuf[128] = "eap-"; + + if (krb5_enctype_to_name(etype, 0, &krbBuf[4], sizeof(krbBuf) - 4) == 0) + makeStringBuffer(minor, krbBuf, mech_name); + } name = gssEapOidToSaslName(mech); if (name == GSS_C_NO_BUFFER) diff --git a/util_mech.c b/util_mech.c index 1b554c5..9f3cb22 100644 --- a/util_mech.c +++ b/util_mech.c @@ -263,9 +263,9 @@ gssEapInternalizeOid(const gss_OID oid, } static gss_buffer_desc gssEapSaslMechs[] = { - { sizeof("GS2-EAP"), "GS2-EAP", }, - { sizeof("GS2-EAP-AES128"), "GS2-EAP-AES128" }, - { sizeof("GS2-EAP-AES256"), "GS2-EAP-AES256" }, + { sizeof("GS2-EAP") - 1, "GS2-EAP", }, + { sizeof("GS2-EAP-AES128") - 1, "GS2-EAP-AES128" }, + { sizeof("GS2-EAP-AES256") - 1, "GS2-EAP-AES256" }, }; gss_buffer_t diff --git a/util_token.c b/util_token.c index 02d6557..29614fd 100644 --- a/util_token.c +++ b/util_token.c @@ -181,10 +181,9 @@ makeTokenHeader( *(*buf)++ = (unsigned char)mech->length; memcpy(*buf, mech->elements, mech->length); *buf += mech->length; - if (tok_type != TOK_TYPE_NONE) { - *(*buf)++ = (unsigned char)((tok_type>>8) & 0xff); - *(*buf)++ = (unsigned char)(tok_type & 0xff); - } + assert(tok_type != TOK_TYPE_NONE); + *(*buf)++ = (unsigned char)((tok_type>>8) & 0xff); + *(*buf)++ = (unsigned char)(tok_type & 0xff); } /*