From cf141d059db0db1419e99b99099389c4c2e0ca0f Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 13 Jul 2005 10:41:58 +0000 Subject: [PATCH] Log a message when we succeed or fail in authenticating ourselves to the peer. The message in the success case is printed in auth_withpeer_success, but the message in the failure case is printed by the caller of auth_withpeer_fail (since there are many possible reasons for failure). --- pppd/auth.c | 8 +++++++- pppd/chap-new.c | 4 +++- pppd/upap.c | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pppd/auth.c b/pppd/auth.c index e435e6c..9f677c2 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -68,7 +68,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: auth.c,v 1.105 2005/07/12 01:07:59 paulus Exp $" +#define RCSID "$Id: auth.c,v 1.106 2005/07/13 10:41:58 paulus Exp $" #include #include @@ -994,10 +994,12 @@ auth_withpeer_success(unit, protocol, prot_flavor) int unit, protocol, prot_flavor; { int bit; + const char *prot = ""; switch (protocol) { case PPP_CHAP: bit = CHAP_WITHPEER; + prot = "CHAP"; switch (prot_flavor) { case CHAP_MD5: bit |= CHAP_MD5_WITHPEER; @@ -1016,15 +1018,19 @@ auth_withpeer_success(unit, protocol, prot_flavor) if (passwd_from_file) BZERO(passwd, MAXSECRETLEN); bit = PAP_WITHPEER; + prot = "PAP"; break; case PPP_EAP: bit = EAP_WITHPEER; + prot = "EAP"; break; default: warn("auth_withpeer_success: unknown protocol %x", protocol); bit = 0; } + notice("%s authentication succeeded", prot); + /* Save the authentication method for later. */ auth_done[unit] |= bit; diff --git a/pppd/chap-new.c b/pppd/chap-new.c index e5fe161..cf54f57 100644 --- a/pppd/chap-new.c +++ b/pppd/chap-new.c @@ -28,7 +28,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: chap-new.c,v 1.7 2005/07/10 07:31:26 paulus Exp $" +#define RCSID "$Id: chap-new.c,v 1.8 2005/07/13 10:41:58 paulus Exp $" #include #include @@ -501,6 +501,7 @@ chap_handle_status(struct chap_client_state *cs, int code, int id, auth_withpeer_success(0, PPP_CHAP, cs->digest->code); else { cs->flags |= AUTH_FAILED; + error("CHAP authentication failed"); auth_withpeer_fail(0, PPP_CHAP); } } @@ -552,6 +553,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); } } diff --git a/pppd/upap.c b/pppd/upap.c index 02fd8f8..8a73621 100644 --- a/pppd/upap.c +++ b/pppd/upap.c @@ -40,7 +40,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: upap.c,v 1.29 2002/12/04 23:03:33 paulus Exp $" +#define RCSID "$Id: upap.c,v 1.30 2005/07/13 10:41:58 paulus Exp $" /* * TODO: @@ -498,7 +498,6 @@ upap_rauthack(u, inp, id, len) u->us_clientstate = UPAPCS_OPEN; - notice("PAP authentication succeeded"); auth_withpeer_success(u->us_unit, PPP_PAP, 0); } -- 2.39.2