From f3bf67e02e98ed3e41af70bc6f87e2c757b2c908 Mon Sep 17 00:00:00 2001 From: Frank Cusack Date: Fri, 11 Oct 2002 22:11:13 +0000 Subject: [PATCH] Make authentication success/failure messages uniform. --- pppd/chap.c | 5 +++-- pppd/upap.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pppd/chap.c b/pppd/chap.c index a48f69f..85c860f 100644 --- a/pppd/chap.c +++ b/pppd/chap.c @@ -33,7 +33,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define RCSID "$Id: chap.c,v 1.33 2002/09/01 12:00:15 dfs Exp $" +#define RCSID "$Id: chap.c,v 1.34 2002/10/11 22:11:13 fcusack Exp $" /* * TODO: @@ -700,7 +700,7 @@ ChapReceiveResponse(cstate, inp, id, len) notice("CHAP peer authentication succeeded for %q", rhostname); } else { - error("CHAP peer authentication failed for remote host %q", rhostname); + error("CHAP peer authentication failed for %q", rhostname); cstate->serverstate = CHAPSS_BADAUTH; auth_peer_fail(cstate->unit, PPP_CHAP); } @@ -768,6 +768,7 @@ ChapReceiveSuccess(cstate, inp, id, len) cstate->clientstate = CHAPCS_OPEN; + notice("CHAP authentication succeeded"); auth_withpeer_success(cstate->unit, PPP_CHAP, cstate->resp_type); } diff --git a/pppd/upap.c b/pppd/upap.c index d3d9d9f..e15c93c 100644 --- a/pppd/upap.c +++ b/pppd/upap.c @@ -17,7 +17,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define RCSID "$Id: upap.c,v 1.25 2002/04/02 13:54:59 dfs Exp $" +#define RCSID "$Id: upap.c,v 1.26 2002/10/11 22:11:13 fcusack Exp $" /* * TODO: @@ -353,6 +353,7 @@ upap_rauthreq(u, inp, id, len) { u_char ruserlen, rpasswdlen; char *ruser, *rpasswd; + char rhostname[256]; int retcode; char *msg; int msglen; @@ -407,11 +408,18 @@ upap_rauthreq(u, inp, id, len) upap_sresp(u, retcode, id, msg, msglen); + if (ruserlen >= sizeof(rhostname)) + ruserlen = sizeof(rhostname) - 1; + BCOPY(ruser, rhostname, ruserlen); + rhostname[ruserlen] = '\000'; + if (retcode == UPAP_AUTHACK) { u->us_serverstate = UPAPSS_OPEN; + notice("PAP peer authentication succeeded for %q", rhostname); auth_peer_success(u->us_unit, PPP_PAP, 0, ruser, ruserlen); } else { u->us_serverstate = UPAPSS_BADAUTH; + error("PAP peer authentication failed for %q", rhostname); auth_peer_fail(u->us_unit, PPP_PAP); } @@ -456,12 +464,13 @@ upap_rauthack(u, inp, id, len) u->us_clientstate = UPAPCS_OPEN; + notice("PAP authentication succeeded"); auth_withpeer_success(u->us_unit, PPP_PAP, 0); } /* - * upap_rauthnak - Receive Authenticate-Nakk. + * upap_rauthnak - Receive Authenticate-Nak. */ static void upap_rauthnak(u, inp, id, len) -- 2.39.2