diff options
author | brian <brian@FreeBSD.org> | 1998-07-28 21:54:30 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-07-28 21:54:30 +0000 |
commit | a8040b983130775d11758b3701ec79c170d7ef70 (patch) | |
tree | b7d32e72f71da1bd5358823b4116b671f5381053 /usr.sbin/ppp/pap.c | |
parent | 8f59e52f08b133a1d71386d1dc834fdb82ff122c (diff) | |
download | FreeBSD-src-a8040b983130775d11758b3701ec79c170d7ef70.zip FreeBSD-src-a8040b983130775d11758b3701ec79c170d7ef70.tar.gz |
o Tidy up PAP and CHAP diagnostics. They're now all logged as PHASE
diagnostics (which are on by default).
o Deal correctly with both sides wanting CHAP.
o Output a warning if we're using an empty ``authname''. This is
*not* what we want to do.
Diffstat (limited to 'usr.sbin/ppp/pap.c')
-rw-r--r-- | usr.sbin/ppp/pap.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c index 79a89c7..afbc3a2 100644 --- a/usr.sbin/ppp/pap.c +++ b/usr.sbin/ppp/pap.c @@ -18,7 +18,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pap.c,v 1.23 1998/05/21 21:47:18 brian Exp $ + * $Id: pap.c,v 1.24 1998/06/27 23:48:51 brian Exp $ * * TODO: */ @@ -58,7 +58,7 @@ #include "chap.h" #include "datalink.h" -static const char *papcodes[] = { "???", "REQUEST", "ACK", "NAK" }; +static const char *papcodes[] = { "???", "REQUEST", "SUCCESS", "FAILURE" }; void pap_SendChallenge(struct authinfo *auth, int papid, struct physical *physical) @@ -73,7 +73,10 @@ pap_SendChallenge(struct authinfo *auth, int papid, struct physical *physical) plen = namelen + keylen + 2; log_Printf(LogDEBUG, "pap_SendChallenge: namelen = %d, keylen = %d\n", namelen, keylen); - log_Printf(LogPHASE, "PAP: %s\n", physical->dl->bundle->cfg.auth.name); + log_Printf(LogPHASE, "Pap Output: %s ********\n", + physical->dl->bundle->cfg.auth.name); + if (*physical->dl->bundle->cfg.auth.name == '\0') + log_Printf(LogWARN, "Sending empty PAP authname!\n"); lh.code = PAP_REQUEST; lh.id = papid; lh.length = htons(plen + sizeof(struct fsmheader)); @@ -107,7 +110,7 @@ SendPapCode(int id, int code, const char *message, struct physical *physical) cp = MBUF_CTOP(bp) + sizeof(struct fsmheader); *cp++ = mlen; memcpy(cp, message, mlen); - log_Printf(LogPHASE, "PapOutput: %s\n", papcodes[code]); + log_Printf(LogPHASE, "Pap Output: %s\n", papcodes[code]); hdlc_Output(&physical->link, PRI_LINK, PROTO_PAP, bp); } @@ -142,11 +145,11 @@ pap_Input(struct bundle *bundle, struct mbuf *bp, struct physical *physical) if (len >= ntohs(php->length)) { if (php->code < PAP_REQUEST || php->code > PAP_NAK) php->code = 0; - log_Printf(LogPHASE, "pap_Input: %s\n", papcodes[php->code]); - switch (php->code) { case PAP_REQUEST: cp = (u_char *) (php + 1); + log_Printf(LogPHASE, "Pap Input: %s (%.*s)\n", + papcodes[php->code], *cp, cp + 1); if (PapValidate(bundle, cp, cp + *cp + 1, physical)) { datalink_GotAuthname(physical->dl, cp+1, *cp); SendPapCode(php->id, PAP_ACK, "Greetings!!", physical); @@ -171,7 +174,7 @@ pap_Input(struct bundle *bundle, struct mbuf *bp, struct physical *physical) cp = (u_char *) (php + 1); len = *cp++; cp[len] = 0; - log_Printf(LogPHASE, "Received PAP_ACK (%s)\n", cp); + log_Printf(LogPHASE, "Pap Input: %s (%s)\n", papcodes[php->code], cp); if (physical->link.lcp.auth_iwait == PROTO_PAP) { physical->link.lcp.auth_iwait = 0; if (physical->link.lcp.auth_ineed == 0) @@ -188,7 +191,7 @@ pap_Input(struct bundle *bundle, struct mbuf *bp, struct physical *physical) cp = (u_char *) (php + 1); len = *cp++; cp[len] = 0; - log_Printf(LogPHASE, "Received PAP_NAK (%s)\n", cp); + log_Printf(LogPHASE, "Pap Input: %s (%s)\n", papcodes[php->code], cp); datalink_AuthNotOk(physical->dl); break; } |