/*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
krb5_context krbContext;
struct eap_peer_config *eapPeerConfig = &ctx->initiatorCtx.eapPeerConfig;
krb5_error_code code;
- char *identity;
+ char *identity, *anonymousIdentity;
eapPeerConfig->identity = NULL;
eapPeerConfig->identity_len = 0;
return GSS_S_FAILURE;
}
+ anonymousIdentity = strchr(identity, '@');
+ if (anonymousIdentity == NULL)
+ anonymousIdentity = "";
+
eapPeerConfig->identity = (unsigned char *)identity;
eapPeerConfig->identity_len = strlen(identity);
+ eapPeerConfig->anonymous_identity = (unsigned char *)anonymousIdentity;
+ eapPeerConfig->anonymous_identity_len = strlen(anonymousIdentity);
eapPeerConfig->password = (unsigned char *)cred->password.value;
eapPeerConfig->password_len = cred->password.length;
major = load_uint32_be(&p[0]);
*minor = ERROR_TABLE_BASE_eapg + load_uint32_be(&p[4]);
- if (!GSS_ERROR(major)) {
+ if (!GSS_ERROR(major) || !IS_WIRE_ERROR(*minor)) {
major = GSS_S_FAILURE;
*minor = GSSEAP_BAD_ERROR_TOKEN;
}
gss_buffer_desc innerInputToken;
gss_buffer_desc innerOutputToken = GSS_C_EMPTY_BUFFER;
enum gss_eap_token_type tokType;
- gss_cred_id_t defaultCred = GSS_C_NO_CREDENTIAL;
int initialContextToken = 0;
*minor = 0;
GSSEAP_MUTEX_LOCK(&ctx->mutex);
if (cred == GSS_C_NO_CREDENTIAL) {
- if (ctx->initiatorCtx.defaultCred == GSS_C_NO_CREDENTIAL) {
+ if (ctx->defaultCred == GSS_C_NO_CREDENTIAL) {
major = gssEapAcquireCred(minor,
GSS_C_NO_NAME,
GSS_C_NO_BUFFER,
time_req,
GSS_C_NO_OID_SET,
GSS_C_INITIATE,
- &defaultCred,
+ &ctx->defaultCred,
NULL,
NULL);
if (GSS_ERROR(major))
goto cleanup;
}
- cred = ctx->initiatorCtx.defaultCred;
+ cred = ctx->defaultCred;
}
GSSEAP_MUTEX_LOCK(&cred->mutex);
sm = &eapGssInitiatorSm[ctx->state];
- if (input_token != GSS_C_NO_BUFFER) {
+ if (input_token != GSS_C_NO_BUFFER && input_token->length != 0) {
major = gssEapVerifyToken(minor, ctx, input_token,
&tokType, &innerInputToken);
if (GSS_ERROR(major))