index bdf4668..051fe71 100644 --- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c @@ -195,7 +195,9 @@ static int eapmschapv2_compose(EAP_HANDLER *handler, VALUE_PAIR *reply) case PW_MSCHAP_ERROR: DEBUG2("MSCHAP Failure\n"); - length = 4 + MSCHAPV2_FAILURE_MESSAGE_LEN; + /* JCH need to be change length to work with full v2 message */ + // length = 4 + MSCHAPV2_FAILURE_MESSAGE_LEN; + length = 4 + reply->length-1; eap_ds->request->type.data = malloc(length); /* @@ -212,7 +214,11 @@ static int eapmschapv2_compose(EAP_HANDLER *handler, VALUE_PAIR *reply) eap_ds->request->type.data[1] = eap_ds->response->id; length = htons(length); memcpy((eap_ds->request->type.data + 2), &length, sizeof(uint16_t)); - memcpy((eap_ds->request->type.data + 4), MSCHAPV2_FAILURE_MESSAGE, MSCHAPV2_FAILURE_MESSAGE_LEN); + /* JCH need to copy the failure message from mschapv2 - it contains ascii version of the challenge C=... */ + memcpy((eap_ds->request->type.data + 4), + (reply->vp_strvalue+1), + (reply->length-1)); + //MSCHAPV2_FAILURE_MESSAGE, MSCHAPV2_FAILURE_MESSAGE_LEN); break; default: @@ -485,6 +491,18 @@ static int mschapv2_authenticate(void *arg, EAP_HANDLER *handler) return 1; break; + /*JCH added - is this is an ack of a failure message */ + case PW_EAP_MSCHAPV2_FAILURE: + if (data->code != PW_EAP_MSCHAPV2_FAILURE) { + radlog(L_ERR, "rlm_eap_mschapv2: Unexpected FAILURE received"); + return 0; + } + //JCH needed??? handler->request->options &= ~RAD_REQUEST_OPTION_PROXY_EAP; + eap_ds->request->code = PW_EAP_FAILURE; + return 1; + break; + + /* * Something else, we don't know what it is. */ @@ -657,12 +675,12 @@ static int mschapv2_authenticate(void *arg, EAP_HANDLER *handler) * Don't return anything in the error message. */ eap_ds->request->code = PW_EAP_FAILURE; - return 1; -#if 0 - pairmove2(&handler->request->reply->vps, &response +// return 1; +//#if 0 + pairmove2(&response, &handler->request->reply->vps, PW_MSCHAP_ERROR); data->code = PW_EAP_MSCHAPV2_FAILURE; -#endif +//#endif } /*