X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=blobdiff_plain;f=moonshot%2Fmech_eap%2Futil_cred.c;h=b481118b4750135eb6f29d9612575540c95c4388;hp=28cb76c22c1a3f8479c0182a1ac997f44fa203b6;hb=57135a1070518a0c1228a29ed9fcf726357856a1;hpb=77cf1ecdf16dee09c9eb88c59eac8c11aa0188bf diff --git a/moonshot/mech_eap/util_cred.c b/moonshot/mech_eap/util_cred.c index 28cb76c..b481118 100644 --- a/moonshot/mech_eap/util_cred.c +++ b/moonshot/mech_eap/util_cred.c @@ -38,6 +38,9 @@ #include +const gss_OID_desc gssEapPasswordCredType = + { 7, "\x2a\x85\x70\x2b\x0d\x81\x48" }; + OM_uint32 gssEapAllocCred(OM_uint32 *minor, gss_cred_id_t *pCred) { @@ -197,7 +200,8 @@ cleanup: OM_uint32 gssEapAcquireCred(OM_uint32 *minor, const gss_name_t desiredName, - const gss_buffer_t password, + gss_const_OID credType, + const void *credData, OM_uint32 timeReq GSSEAP_UNUSED, const gss_OID_set desiredMechs, int credUsage, @@ -211,10 +215,21 @@ gssEapAcquireCred(OM_uint32 *minor, gss_name_t defaultIdentityName = GSS_C_NO_NAME; gss_buffer_desc defaultCreds = GSS_C_EMPTY_BUFFER; gss_OID nameMech = GSS_C_NO_OID; + gss_buffer_t password = GSS_C_NO_BUFFER; /* XXX TODO validate with changed set_cred_option API */ *pCred = GSS_C_NO_CREDENTIAL; + if (credType != GSS_C_NO_OID) { + if (oidEqual(credType, &gssEapPasswordCredType)) { + password = (gss_buffer_t)credData; + } else { + major = GSS_S_CRED_UNAVAIL; + *minor = GSSEAP_BAD_CRED_TYPE; + goto cleanup; + } + } + major = gssEapAllocCred(minor, &cred); if (GSS_ERROR(major)) goto cleanup;