auth.c functions now use ppp_pcb* as first argument

This commit is contained in:
Sylvain Rochet 2012-06-14 00:08:56 +02:00
parent 81a0fd782f
commit 51bfac71b0
8 changed files with 113 additions and 168 deletions

View File

@ -139,8 +139,10 @@
#define ISWILD(word) (word[0] == '*' && word[1] == 0)
#endif /* UNUSED */
#if PPP_SERVER
/* The name by which the peer authenticated itself to us. */
char peer_authname[MAXNAMELEN];
#endif /* PPP_SERVER */
/* Records which authentication operations haven't completed yet. */
static int auth_pending[NUM_PPP];
@ -251,9 +253,9 @@ extern char *crypt (const char *, const char *);
#endif /* UNUSED */
/* Prototypes for procedures local to this file. */
static void network_phase (int);
static void check_idle (void *);
static void connect_time_expired (void *);
static void network_phase(ppp_pcb *pcb);
static void check_idle(void *arg);
static void connect_time_expired(void *arg);
#if 0 /* UNUSED */
static int null_login (int);
/* static int get_pap_passwd (char *); */
@ -556,10 +558,7 @@ set_permitted_number(argv)
/*
* An Open on LCP has requested a change from Dead to Establish phase.
*/
void
link_required(unit)
int unit;
{
void link_required(ppp_pcb *pcb) {
}
#if 0
@ -630,11 +629,7 @@ void start_link(unit)
* LCP has terminated the link; go to the Dead phase and take the
* physical layer down.
*/
void
link_terminated(unit)
int unit;
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
void link_terminated(ppp_pcb *pcb) {
if (pcb->phase == PHASE_DEAD || pcb->phase == PHASE_MASTER)
return;
new_phase(pcb, PHASE_DISCONNECT);
@ -709,17 +704,13 @@ link_terminated(unit)
/*
* LCP has gone down; it will either die or try to re-establish.
*/
void
link_down(unit)
int unit;
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
void link_down(ppp_pcb *pcb) {
#if PPP_NOTIFY
notify(link_down_notifier, 0);
#endif /* #if PPP_NOTIFY */
if (!doing_multilink) {
upper_layers_down(unit);
upper_layers_down(pcb);
if (pcb->phase != PHASE_DEAD && pcb->phase != PHASE_MASTER)
new_phase(pcb, PHASE_ESTABLISH);
}
@ -729,8 +720,7 @@ link_down(unit)
ppp_link_down(pcb);
}
void upper_layers_down(int unit)
{
void upper_layers_down(ppp_pcb *pcb) {
int i;
struct protent *protp;
@ -738,9 +728,9 @@ void upper_layers_down(int unit)
if (!protp->enabled_flag)
continue;
if (protp->protocol != PPP_LCP && protp->lowerdown != NULL)
(*protp->lowerdown)(unit);
(*protp->lowerdown)(pcb->unit);
if (protp->protocol < 0xC000 && protp->close != NULL)
(*protp->close)(unit, "LCP down");
(*protp->close)(pcb->unit, "LCP down");
}
num_np_open = 0;
num_np_up = 0;
@ -750,19 +740,15 @@ void upper_layers_down(int unit)
* The link is established.
* Proceed to the Dead, Authenticate or Network phase as appropriate.
*/
void
link_established(unit)
int unit;
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
void link_established(ppp_pcb *pcb) {
int auth;
#if 0 /* UNUSED */
lcp_options *wo = &lcp_wantoptions[unit];
lcp_options *wo = &lcp_wantoptions[pcb->unit];
#endif /* UNUSED */
#if PPP_SERVER
lcp_options *go = &lcp_gotoptions[unit];
lcp_options *go = &lcp_gotoptions[pcb->unit];
#endif /* #if PPP_SERVER */
lcp_options *ho = &lcp_hisoptions[unit];
lcp_options *ho = &lcp_hisoptions[pcb->unit];
int i;
struct protent *protp;
@ -773,7 +759,7 @@ link_established(unit)
for (i = 0; (protp = protocols[i]) != NULL; ++i)
if (protp->protocol != PPP_LCP && protp->enabled_flag
&& protp->lowerup != NULL)
(*protp->lowerup)(unit);
(*protp->lowerup)(pcb->unit);
}
#if 0 /* UNUSED */
@ -809,7 +795,7 @@ link_established(unit)
if (!wo->neg_upap || uselogin || !null_login(unit)) {
warn("peer refused to authenticate: terminating link");
status = EXIT_PEER_AUTH_FAILED;
lcp_close(unit, "peer refused to authenticate");
lcp_close(pcb->unit, "peer refused to authenticate");
return;
}
}
@ -841,38 +827,35 @@ link_established(unit)
#if EAP_SUPPORT
if (ho->neg_eap) {
eap_authwithpeer(unit, pcb->settings.user);
eap_authwithpeer(pcb->unit, pcb->settings.user);
auth |= EAP_WITHPEER;
} else
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
if (ho->neg_chap) {
chap_auth_with_peer(unit, pcb->settings.user, CHAP_DIGEST(ho->chap_mdtype));
chap_auth_with_peer(pcb->unit, pcb->settings.user, CHAP_DIGEST(ho->chap_mdtype));
auth |= CHAP_WITHPEER;
} else
#endif /* CHAP_SUPPORT */
#if PAP_SUPPORT
if (ho->neg_upap) {
upap_authwithpeer(unit, pcb->settings.user, pcb->settings.passwd);
upap_authwithpeer(pcb->unit, pcb->settings.user, pcb->settings.passwd);
auth |= PAP_WITHPEER;
} else
#endif /* PAP_SUPPORT */
{}
auth_pending[unit] = auth;
auth_done[unit] = 0;
auth_pending[pcb->unit] = auth;
auth_done[pcb->unit] = 0;
if (!auth)
network_phase(unit);
network_phase(pcb);
}
/*
* Proceed to the network phase.
*/
static void
network_phase(unit)
int unit;
{
static void network_phase(ppp_pcb *pcb) {
#if CBCP_SUPPORT
ppp_pcb *pcb = &ppp_pcb_list[unit];
#endif
@ -926,14 +909,10 @@ network_phase(unit)
extra_options = 0;
}
#endif /* PPP_OPTIONS */
start_networks(unit);
start_networks(pcb);
}
void
start_networks(unit)
int unit;
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
void start_networks(ppp_pcb *pcb) {
#if CCP_SUPPORT || ECP_SUPPORT
int i;
struct protent *protp;
@ -997,13 +976,10 @@ start_networks(unit)
&& !mppe_required
#endif /* MPPE */
)
continue_networks(unit);
continue_networks(pcb);
}
void
continue_networks(unit)
int unit;
{
void continue_networks(ppp_pcb *pcb) {
int i;
struct protent *protp;
@ -1115,11 +1091,7 @@ auth_peer_success(unit, protocol, prot_flavor, name, namelen)
/*
* We have failed to authenticate ourselves to the peer using `protocol'.
*/
void
auth_withpeer_fail(unit, protocol)
int unit, protocol;
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
void auth_withpeer_fail(ppp_pcb *pcb, int protocol) {
int errcode = PPPERR_AUTHFAIL;
/*
* We've failed to authenticate ourselves to our peer.
@ -1135,16 +1107,13 @@ auth_withpeer_fail(unit, protocol)
* we can do except wait for that.
*/
ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode);
lcp_close(unit, "Failed to authenticate ourselves to peer");
lcp_close(pcb->unit, "Failed to authenticate ourselves to peer");
}
/*
* We have successfully authenticated ourselves with the peer using `protocol'.
*/
void
auth_withpeer_success(unit, protocol, prot_flavor)
int unit, protocol, prot_flavor;
{
void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) {
int bit;
const char *prot = "";
@ -1189,26 +1158,22 @@ auth_withpeer_success(unit, protocol, prot_flavor)
notice("%s authentication succeeded", prot);
/* Save the authentication method for later. */
auth_done[unit] |= bit;
auth_done[pcb->unit] |= bit;
/*
* If there is no more authentication still being done,
* proceed to the network (or callback) phase.
*/
if ((auth_pending[unit] &= ~bit) == 0)
network_phase(unit);
if ((auth_pending[pcb->unit] &= ~bit) == 0)
network_phase(pcb);
}
/*
* np_up - a network protocol has come up.
*/
void
np_up(unit, proto)
int unit, proto;
{
void np_up(ppp_pcb *pcb, int proto) {
int tlim;
ppp_pcb *pcb = &ppp_pcb_list[unit];
if (num_np_up == 0) {
/*
@ -1224,14 +1189,14 @@ np_up(unit, proto)
#endif /* UNUSED */
tlim = pcb->settings.idle_time_limit;
if (tlim > 0)
TIMEOUT(check_idle, NULL, tlim);
TIMEOUT(check_idle, (void*)pcb, tlim);
/*
* Set a timeout to close the connection once the maximum
* connect time has expired.
*/
if (pcb->settings.maxconnect > 0)
TIMEOUT(connect_time_expired, 0, pcb->settings.maxconnect);
TIMEOUT(connect_time_expired, (void*)pcb, pcb->settings.maxconnect);
#ifdef MAXOCTETS
if (maxoctets > 0)
@ -1252,13 +1217,9 @@ np_up(unit, proto)
/*
* np_down - a network protocol has gone down.
*/
void
np_down(unit, proto)
int unit, proto;
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
void np_down(ppp_pcb *pcb, int proto) {
if (--num_np_up == 0) {
UNTIMEOUT(check_idle, NULL);
UNTIMEOUT(check_idle, (void*)pcb);
UNTIMEOUT(connect_time_expired, NULL);
#ifdef MAXOCTETS
UNTIMEOUT(check_maxoctets, NULL);
@ -1270,10 +1231,7 @@ np_down(unit, proto)
/*
* np_finished - a network protocol has finished using the link.
*/
void
np_finished(unit, proto)
int unit, proto;
{
void np_finished(ppp_pcb *pcb, int proto) {
if (--num_np_open <= 0) {
/* no further use for the link: shut up shop. */
lcp_close(0, "No network protocols running");
@ -1324,12 +1282,8 @@ check_maxoctets(arg)
* check_idle - check whether the link has been idle for long
* enough that we can shut it down.
*/
static void
check_idle(arg)
void *arg;
{
/* FIXME: fix forced unit 0 */
ppp_pcb *pcb = &ppp_pcb_list[0];
static void check_idle(void *arg) {
ppp_pcb *pcb = (ppp_pcb*)arg;
struct ppp_idle idle;
time_t itime;
int tlim;
@ -1355,19 +1309,15 @@ check_idle(arg)
need_holdoff = 0;
#endif /* UNUSED */
} else {
TIMEOUT(check_idle, NULL, tlim);
TIMEOUT(check_idle, (void*)pcb, tlim);
}
}
/*
* connect_time_expired - log a message and close the connection.
*/
static void
connect_time_expired(arg)
void *arg;
{
/* FIXME: fix forced unit 0 */
ppp_pcb *pcb = &ppp_pcb_list[0];
static void connect_time_expired(void *arg) {
ppp_pcb *pcb = (ppp_pcb*)arg;
info("Connect time expired");
pcb->status = EXIT_CONNECT_TIME;
lcp_close(0, "Connect time expired"); /* Close connection */
@ -1517,13 +1467,9 @@ auth_check_options()
* authentication options, i.e. whether we have appropriate secrets
* to use for authenticating ourselves and/or the peer.
*/
void
auth_reset(unit)
int unit;
{
lcp_options *go = &lcp_gotoptions[unit];
lcp_options *ao = &lcp_allowoptions[unit];
ppp_pcb *pcb = &ppp_pcb_list[unit];
void auth_reset(ppp_pcb *pcb) {
lcp_options *go = &lcp_gotoptions[pcb->unit];
lcp_options *ao = &lcp_allowoptions[pcb->unit];
if( pcb->settings.passwd[0] ) {
@ -1986,19 +1932,9 @@ have_srp_secret(client, server, need_ip, lacks_ipp)
* for authenticating the given client on the given server.
* (We could be either client or server).
*/
int
get_secret(unit, client, server, secret, secret_len, am_server)
int unit;
char *client;
char *server;
char *secret;
int *secret_len;
int am_server;
{
int get_secret(ppp_pcb *pcb, char *client, char *server, char *secret, int *secret_len, int am_server) {
int len;
ppp_pcb *pcb = &ppp_pcb_list[unit];
LWIP_UNUSED_ARG(unit);
LWIP_UNUSED_ARG(server);
LWIP_UNUSED_ARG(am_server);

View File

@ -458,7 +458,7 @@ chap_verify_response(char *name, char *ourname, int id,
int secret_len;
/* Get the secret that the peer is supposed to know */
if (!get_secret(0, name, ourname, (char *)secret, &secret_len, 1)) {
if (!get_secret(pcb, name, ourname, (char *)secret, &secret_len, 1)) {
error("No CHAP secret found for authenticating %q", name);
return 0;
}
@ -503,7 +503,7 @@ chap_respond(struct chap_client_state *cs, int id,
strlcpy(rname, pc->settings.remote_name, sizeof(rname));
/* get secret for authenticating ourselves with the specified host */
if (!get_secret(0, cs->name, rname, secret, &secret_len, 0)) {
if (!get_secret(pcb, cs->name, rname, secret, &secret_len, 0)) {
secret_len = 0; /* assume null secret if can't find one */
warn("No CHAP secret found for authenticating us to %q", rname);
}
@ -534,6 +534,8 @@ static void
chap_handle_status(struct chap_client_state *cs, int code, int id,
unsigned char *pkt, int len)
{
/* FIXME: fix forced unit 0 */
ppp_pcb *pcb = &ppp_pcb_list[0];
const char *msg = NULL;
if ((cs->flags & (AUTH_DONE|AUTH_STARTED|LOWERUP))
@ -561,11 +563,11 @@ chap_handle_status(struct chap_client_state *cs, int code, int id,
info("%s", msg);
}
if (code == CHAP_SUCCESS)
auth_withpeer_success(0, PPP_CHAP, cs->digest->code);
auth_withpeer_success(pcb, PPP_CHAP, cs->digest->code);
else {
cs->flags |= AUTH_FAILED;
error("CHAP authentication failed");
auth_withpeer_fail(0, PPP_CHAP);
auth_withpeer_fail(pcb, PPP_CHAP);
}
}
@ -608,6 +610,7 @@ chap_input(int unit, unsigned char *pkt, int pktlen)
static void
chap_protrej(int unit)
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
struct chap_client_state *cs = &client;
#if PPP_SERVER
struct chap_server_state *ss = &server;
@ -624,7 +627,7 @@ chap_protrej(int unit)
if ((cs->flags & (AUTH_STARTED|AUTH_DONE)) == AUTH_STARTED) {
cs->flags &= ~AUTH_STARTED;
error("CHAP authentication failed due to protocol-reject");
auth_withpeer_fail(0, PPP_CHAP);
auth_withpeer_fail(pcb, PPP_CHAP);
}
}

View File

@ -222,12 +222,13 @@ eap_client_timeout(arg)
void *arg;
{
eap_state *esp = (eap_state *) arg;
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
if (!eap_client_active(esp))
return;
error("EAP: timeout waiting for Request from peer");
auth_withpeer_fail(esp->es_unit, PPP_EAP);
auth_withpeer_fail(pcb, PPP_EAP);
esp->es_client.ea_state = eapBadAuth;
}
@ -1043,16 +1044,17 @@ static void
eap_protrej(unit)
int unit;
{
ppp_pcb *pcb = &ppp_pcb_list[unit];
eap_state *esp = &eap_states[unit];
if (eap_client_active(esp)) {
error("EAP authentication failed due to Protocol-Reject");
auth_withpeer_fail(unit, PPP_EAP);
auth_withpeer_fail(pcb, PPP_EAP);
}
#if PPP_SERVER
if (eap_server_active(esp)) {
error("EAP authentication of peer failed on Protocol-Reject");
auth_peer_fail(unit, PPP_EAP);
auth_peer_fail(pcb, PPP_EAP);
}
#endif /* PPP_SERVER */
eap_lowerdown(unit);
@ -1341,7 +1343,7 @@ u_char *inp;
int id;
int len;
{
ppp_pcb *pc = &ppp_pcb_list[esp->es_unit];
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
u_char typenum;
u_char vallen;
int secret_len;
@ -1371,7 +1373,7 @@ int len;
if (esp->es_client.ea_timeout > 0) {
UNTIMEOUT(eap_client_timeout, (void *)esp);
}
auth_withpeer_fail(esp->es_unit, PPP_EAP);
auth_withpeer_fail(pcb, PPP_EAP);
return;
}
@ -1460,15 +1462,15 @@ int len;
}
/* In case the remote doesn't give us his name. */
if (pc->settings.explicit_remote ||
(pc->settings.remote_name[0] != '\0' && vallen == len))
strlcpy(rhostname, pc->settings.remote_name, sizeof (rhostname));
if (pcb->settings.explicit_remote ||
(pcb->settings.remote_name[0] != '\0' && vallen == len))
strlcpy(rhostname, pcb->settings.remote_name, sizeof (rhostname));
/*
* Get the secret for authenticating ourselves with
* the specified host.
*/
if (!get_secret(esp->es_unit, esp->es_client.ea_name,
if (!get_secret(pcb, esp->es_client.ea_name,
rhostname, secret, &secret_len, 0)) {
dbglog("EAP: no MD5 secret for auth to %q", rhostname);
eap_send_nak(esp, id, EAPT_SRP);
@ -1738,7 +1740,7 @@ client_failure:
}
esp->es_client.ea_session = NULL;
t_clientclose(tc);
auth_withpeer_fail(esp->es_unit, PPP_EAP);
auth_withpeer_fail(pcb, PPP_EAP);
#endif /* USE_SRP */
}
@ -1896,7 +1898,7 @@ int len;
* Get the secret for authenticating the specified
* host.
*/
if (!get_secret(esp->es_unit, rhostname,
if (!get_secret(pcb, rhostname,
esp->es_server.ea_name, secret, &secret_len, 1)) {
dbglog("EAP: no MD5 secret for auth of %q", rhostname);
eap_send_failure(esp);
@ -2050,6 +2052,7 @@ u_char *inp;
int id;
int len;
{
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
if (esp->es_client.ea_state != eapOpen && !eap_client_active(esp)) {
dbglog("EAP unexpected success message in state %s (%d)",
eap_state_name(esp->es_client.ea_state),
@ -2067,7 +2070,7 @@ int len;
}
esp->es_client.ea_state = eapOpen;
auth_withpeer_success(esp->es_unit, PPP_EAP, 0);
auth_withpeer_success(pcb, PPP_EAP, 0);
}
/*
@ -2080,6 +2083,7 @@ u_char *inp;
int id;
int len;
{
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
if (!eap_client_active(esp)) {
dbglog("EAP unexpected failure message in state %s (%d)",
eap_state_name(esp->es_client.ea_state),
@ -2098,7 +2102,7 @@ int len;
esp->es_client.ea_state = eapBadAuth;
error("EAP: peer reports authentication failure");
auth_withpeer_fail(esp->es_unit, PPP_EAP);
auth_withpeer_fail(pcb, PPP_EAP);
}
/*

View File

@ -1982,7 +1982,7 @@ ipcp_up(f)
reset_link_stats(f->unit);
#endif /* PPP_STATS_SUPPORT */
np_up(f->unit, PPP_IP);
np_up(pcb, PPP_IP);
ipcp_is_up = 1;
#if PPP_NOTIFY
@ -2023,7 +2023,7 @@ ipcp_down(f)
#endif /* UNUSED */
if (ipcp_is_up) {
ipcp_is_up = 0;
np_down(f->unit, PPP_IP);
np_down(pcb, PPP_IP);
}
sifvjcomp(pcb, 0, 0, 0);
@ -2087,9 +2087,10 @@ static void
ipcp_finished(f)
fsm *f;
{
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
if (ipcp_is_open) {
ipcp_is_open = 0;
np_finished(f->unit, PPP_IP);
np_finished(pcb, PPP_IP);
}
}

View File

@ -735,6 +735,7 @@ static void
lcp_resetci(f)
fsm *f;
{
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
lcp_options *wo = &lcp_wantoptions[f->unit];
lcp_options *go = &lcp_gotoptions[f->unit];
lcp_options *ao = &lcp_allowoptions[f->unit];
@ -754,7 +755,7 @@ lcp_resetci(f)
if (noendpoint)
ao->neg_endpoint = 0;
peer_mru[f->unit] = PPP_MRU;
auth_reset(f->unit);
auth_reset(pcb);
}
@ -2317,7 +2318,7 @@ lcp_up(f)
lcp_echo_lowerup(f->unit); /* Enable echo messages */
link_established(f->unit);
link_established(pcb);
}
@ -2335,7 +2336,7 @@ lcp_down(f)
lcp_echo_lowerdown(f->unit);
link_down(f->unit);
link_down(pcb);
ppp_send_config(pcb, PPP_MRU, 0xffffffff, 0, 0);
ppp_recv_config(pcb, PPP_MRU,
@ -2348,22 +2349,18 @@ lcp_down(f)
/*
* lcp_starting - LCP needs the lower layer up.
*/
static void
lcp_starting(f)
fsm *f;
{
link_required(f->unit);
static void lcp_starting(fsm *f) {
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
link_required(pcb);
}
/*
* lcp_finished - LCP has finished with the lower layer.
*/
static void
lcp_finished(f)
fsm *f;
{
link_terminated(f->unit);
static void lcp_finished(fsm *f) {
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
link_terminated(pcb);
}

View File

@ -482,7 +482,7 @@ static void ppp_stop(ppp_pcb *pcb) {
static void ppp_hup(ppp_pcb *pcb) {
PPPDEBUG(LOG_DEBUG, ("ppp_hup: unit %d\n", pcb->unit));
lcp_lowerdown(pcb->unit);
link_terminated(pcb->unit);
link_terminated(pcb);
}
/*

View File

@ -544,27 +544,27 @@ void update_link_stats(int u); /* Get stats at link termination */
#define EXIT_CNID_AUTH_FAILED 21
/* Procedures exported from auth.c */
void link_required (int); /* we are starting to use the link */
void link_terminated (int); /* we are finished with the link */
void link_down (int); /* the LCP layer has left the Opened state */
void upper_layers_down (int);/* take all NCPs down */
void link_established (int); /* the link is up; authenticate now */
void start_networks (int); /* start all the network control protos */
void continue_networks (int); /* start network [ip, etc] control protos */
void link_required(ppp_pcb *pcb); /* we are starting to use the link */
void link_terminated(ppp_pcb *pcb); /* we are finished with the link */
void link_down(ppp_pcb *pcb); /* the LCP layer has left the Opened state */
void upper_layers_down(ppp_pcb *pcb); /* take all NCPs down */
void link_established(ppp_pcb *pcb); /* the link is up; authenticate now */
void start_networks(ppp_pcb *pcb); /* start all the network control protos */
void continue_networks(ppp_pcb *pcb); /* start network [ip, etc] control protos */
void auth_peer_fail (int, int);
/* peer failed to authenticate itself */
void auth_peer_success (int, int, int, char *, int);
/* peer successfully authenticated itself */
void auth_withpeer_fail (int, int);
void auth_withpeer_fail(ppp_pcb *pcb, int protocol);
/* we failed to authenticate ourselves */
void auth_withpeer_success (int, int, int);
void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor);
/* we successfully authenticated ourselves */
void np_up (int, int); /* a network protocol has come up */
void np_down (int, int); /* a network protocol has gone down */
void np_finished (int, int); /* a network protocol no longer needs link */
void auth_reset (int); /* check what secrets we have */
int get_secret (int, char *, char *, char *, int *, int);
void np_up(ppp_pcb *pcb, int proto); /* a network protocol has come up */
void np_down(ppp_pcb *pcb, int proto); /* a network protocol has gone down */
void np_finished(ppp_pcb *pcb, int proto); /* a network protocol no longer needs link */
void auth_reset(ppp_pcb *pcb); /* check what secrets we have */
int get_secret(ppp_pcb *pcb, char *client, char *server, char *secret, int *secret_len, int am_server);
/* get "secret" for chap */
/* Procedures exported from ipcp.c */

View File

@ -222,6 +222,7 @@ upap_timeout(arg)
void *arg;
{
upap_state *u = (upap_state *) arg;
ppp_pcb *pcb = &ppp_pcb_list[u->us_unit];
if (u->us_clientstate != UPAPCS_AUTHREQ)
return;
@ -230,7 +231,7 @@ upap_timeout(arg)
/* give up in disgust */
error("No response to PAP authenticate-requests");
u->us_clientstate = UPAPCS_BADAUTH;
auth_withpeer_fail(u->us_unit, PPP_PAP);
auth_withpeer_fail(pcb, PPP_PAP);
return;
}
@ -321,15 +322,16 @@ upap_protrej(unit)
int unit;
{
upap_state *u = &upap[unit];
ppp_pcb *pcb = &ppp_pcb_list[u->us_unit];
if (u->us_clientstate == UPAPCS_AUTHREQ) {
error("PAP authentication failed due to protocol-reject");
auth_withpeer_fail(unit, PPP_PAP);
auth_withpeer_fail(pcb, PPP_PAP);
}
#if PPP_SERVER
if (u->us_serverstate == UPAPSS_LISTEN) {
error("PAP authentication of peer failed (protocol-reject)");
auth_peer_fail(unit, PPP_PAP);
auth_peer_fail(pcb, PPP_PAP);
}
#endif /* PPP_SERVER */
upap_lowerdown(unit);
@ -506,6 +508,7 @@ upap_rauthack(u, inp, id, len)
int id;
int len;
{
ppp_pcb *pcb = &ppp_pcb_list[u->us_unit];
u_char msglen;
char *msg;
@ -532,7 +535,7 @@ upap_rauthack(u, inp, id, len)
u->us_clientstate = UPAPCS_OPEN;
auth_withpeer_success(u->us_unit, PPP_PAP, 0);
auth_withpeer_success(pcb, PPP_PAP, 0);
}
@ -546,6 +549,7 @@ upap_rauthnak(u, inp, id, len)
int id;
int len;
{
ppp_pcb *pcb = &ppp_pcb_list[u->us_unit];
u_char msglen;
char *msg;
@ -573,7 +577,7 @@ upap_rauthnak(u, inp, id, len)
u->us_clientstate = UPAPCS_BADAUTH;
error("PAP authentication failed");
auth_withpeer_fail(u->us_unit, PPP_PAP);
auth_withpeer_fail(pcb, PPP_PAP);
}