From: Luke Howard Date: Tue, 15 Mar 2011 07:56:27 +0000 (+1100) Subject: add a testing path for setting initiator credentials X-Git-Tag: dvd/201105~12^2~108 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=mech_eap.orig;a=commitdiff_plain;h=467f50650ab18728412014371179afee6bab8286 add a testing path for setting initiator credentials requires GSSEAP_DEBUG to be defined, set environment variable GSSEAP_CREDS to password --- diff --git a/util_cred.c b/util_cred.c index 6330118..64b9284 100644 --- a/util_cred.c +++ b/util_cred.c @@ -120,6 +120,9 @@ gssEapAcquireCred(OM_uint32 *minor, { OM_uint32 major, tmpMinor; gss_cred_id_t cred; +#ifdef GSSEAP_DEBUG + gss_buffer_desc envPassword; +#endif /* XXX TODO validate with changed set_cred_option API */ *pCred = GSS_C_NO_CREDENTIAL; @@ -189,6 +192,15 @@ gssEapAcquireCred(OM_uint32 *minor, cred->flags |= CRED_FLAG_DEFAULT_IDENTITY; } +#ifdef GSSEAP_DEBUG + if (password == GSS_C_NO_BUFFER && + (envPassword.value = getenv("GSSEAP_CREDS")) != NULL) { + envPassword.length = strlen((char *)envPassword.value); + major = duplicateBuffer(minor, &envPassword, &cred->password); + if (GSS_ERROR(major)) + goto cleanup; + } else +#endif /* GSSEAP_DEBUG */ if (password != GSS_C_NO_BUFFER) { major = duplicateBuffer(minor, password, &cred->password); if (GSS_ERROR(major))