X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Feap.c;fp=pppd%2Feap.c;h=54c3d42b85fe82edce41c3571e3a6af937b8dbae;hp=b758711117948eb29c6b0a0ce6221f5c2e641e41;hb=789e867f6e51b2d3e7f6ebe723f43764d5d8b595;hpb=4e2c49755175d05f7f4a3c1c70a42d2eef9d7839 diff --git a/pppd/eap.c b/pppd/eap.c index b758711..54c3d42 100644 --- a/pppd/eap.c +++ b/pppd/eap.c @@ -2221,7 +2221,24 @@ eap_request(eap_state *esp, u_char *inp, int id, int len) #endif /* CHAPMS */ #ifdef USE_PEAP case EAPT_PEAP: - peap_process(esp, id, inp, len, rhostname); + + /* Initialize the PEAP context (if not already initialized) */ + if (!esp->ea_peap) { + rhostname[0] = '\0'; + if (explicit_remote || (remote_name[0] != '\0')) { + strlcpy(rhostname, remote_name, sizeof (rhostname)); + } + if (peap_init(&esp->ea_peap, rhostname)) { + eap_send_nak(esp, id, EAPT_TLS); + break; + } + } + + /* Process the PEAP packet */ + if (peap_process(esp, id, inp, len)) { + eap_send_nak(esp, id, EAPT_TLS); + } + break; #endif /* USE_PEAP */ @@ -2777,6 +2794,10 @@ eap_success(eap_state *esp, u_char *inp, int id, int len) PRINTMSG(inp, len); } +#ifdef USE_PEAP + peap_finish(&esp->ea_peap); +#endif + esp->es_client.ea_state = eapOpen; auth_withpeer_success(esp->es_unit, PPP_EAP, 0); } @@ -2811,6 +2832,11 @@ eap_failure(eap_state *esp, u_char *inp, int id, int len) esp->es_client.ea_state = eapBadAuth; error("EAP: peer reports authentication failure"); + +#ifdef USE_PEAP + peap_finish(&esp->ea_peap); +#endif + auth_withpeer_fail(esp->es_unit, PPP_EAP); }