PPP, PAP: cancel PAP timeout when authentication succeed or fail

upap_timeout is not currently stopped on authentication success or
fail events. This may have strange results if session is restarted
in a high pace because even if the timeout callback have a sanity
check against the PAP state the session can be restarted and be
back in the valid state before the timeout callback is actually
called.
This commit is contained in:
Sylvain Rochet 2020-11-17 00:39:27 +01:00
parent 3013e1fc19
commit 9a9d92a59e

View File

@ -481,6 +481,7 @@ static void upap_rauthack(ppp_pcb *pcb, u_char *inp, int id, int len) {
} }
} }
UNTIMEOUT(upap_timeout, pcb);
pcb->upap.us_clientstate = UPAPCS_OPEN; pcb->upap.us_clientstate = UPAPCS_OPEN;
auth_withpeer_success(pcb, PPP_PAP, 0); auth_withpeer_success(pcb, PPP_PAP, 0);
@ -516,6 +517,7 @@ static void upap_rauthnak(ppp_pcb *pcb, u_char *inp, int id, int len) {
} }
} }
UNTIMEOUT(upap_timeout, pcb);
pcb->upap.us_clientstate = UPAPCS_BADAUTH; pcb->upap.us_clientstate = UPAPCS_BADAUTH;
ppp_error(("PAP authentication failed")); ppp_error(("PAP authentication failed"));