X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fauth.c;h=a8e50042570286e55d3cd14af09d5b091eea70fe;hp=9a04ecf53793edc646520e59b8038dae0aa43164;hb=c6f8d6a7f8325a40950cc9334acf1f453bb1dfeb;hpb=ca831b6745bc15245654acac88b0f428f060cdcc diff --git a/pppd/auth.c b/pppd/auth.c index 9a04ecf..a8e5004 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: auth.c,v 1.5 1994/05/24 11:20:26 paulus Exp $"; +static char rcsid[] = "$Id: auth.c,v 1.7 1994/08/09 06:29:14 paulus Exp $"; #endif #include @@ -55,14 +55,11 @@ static char rcsid[] = "$Id: auth.c,v 1.5 1994/05/24 11:20:26 paulus Exp $"; #include "upap.h" #include "chap.h" #include "ipcp.h" +#include "ccp.h" #include "pathnames.h" #ifdef sparc #include -#ifndef __GNUC__ -/* why alloca.h doesn't define what alloca() returns is a mystery */ -/* char *alloca __ARGS((int)); */ -#endif /*__GNUC__*/ #endif /*sparc*/ /* Used for storing a sequence of words. Usually malloced. */ @@ -104,6 +101,7 @@ static struct wordlist *addresses[NPPP]; /* Prototypes */ void check_access __ARGS((FILE *, char *)); +static void network_phase __ARGS((int)); static int login __ARGS((char *, char *, char **, int *)); static void logout __ARGS((void)); static int null_login __ARGS((int)); @@ -134,6 +132,8 @@ void link_terminated(unit) int unit; { + if (phase == PHASE_DEAD) + return; if (logged_in) logout(); phase = PHASE_DEAD; @@ -147,6 +147,8 @@ void link_down(unit) int unit; { + ipcp_close(0); + ccp_close(0); phase = PHASE_TERMINATE; } @@ -195,10 +197,20 @@ link_established(unit) } auth_pending[unit] = auth; - if (!auth) { - phase = PHASE_NETWORK; - ipcp_open(unit); - } + if (!auth) + network_phase(unit); +} + +/* + * Proceed to the network phase. + */ +static void +network_phase(unit) + int unit; +{ + phase = PHASE_NETWORK; + ipcp_open(unit); + ccp_open(unit); } /* @@ -244,6 +256,7 @@ auth_peer_success(unit, protocol) if ((auth_pending[unit] &= ~bit) == 0) { phase = PHASE_NETWORK; ipcp_open(unit); + ccp_open(unit); } } @@ -287,10 +300,8 @@ auth_withpeer_success(unit, protocol) * If there is no more authentication still being done, * proceed to the network phase. */ - if ((auth_pending[unit] &= ~bit) == 0) { - phase = PHASE_NETWORK; - ipcp_open(unit); - } + if ((auth_pending[unit] &= ~bit) == 0) + network_phase(unit); }