From 9a9d92a59e33708f6dfc4a458f4fc005a6777655 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Tue, 17 Nov 2020 00:39:27 +0100 Subject: [PATCH] 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. --- src/netif/ppp/upap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c index d41d152d..c8cd3941 100644 --- a/src/netif/ppp/upap.c +++ b/src/netif/ppp/upap.c @@ -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; 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; ppp_error(("PAP authentication failed"));