diff options
author | brian <brian@FreeBSD.org> | 1997-06-09 03:27:43 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-06-09 03:27:43 +0000 |
commit | 94d661ac8cb907e0a869759f76cd7134c9105e6c (patch) | |
tree | 5fa88c28cbdec0d4a0d3d118b33c1042dc49c526 /usr.sbin/ppp/chap.c | |
parent | 328d28c6502cfec45b8ead98e18b2d8638499efb (diff) | |
download | FreeBSD-src-94d661ac8cb907e0a869759f76cd7134c9105e6c.zip FreeBSD-src-94d661ac8cb907e0a869759f76cd7134c9105e6c.tar.gz |
Overhaul ppp:
o Use syslog
o Remove references to stdout/stderr (incl perror())
o Introduce VarTerm - the interactive terminal or zero
o Allow "set timeout" to affect current session
o Change "set debug" to "set log"
o Allow "set log [+|-]flag"
o Make MSEXT and PASSWDAUTH stuff the default
o Move all #ifdef DEBUG stuff into the code - this
shouldn't be too much overhead. It's now controlled
with "set log +debug"
o Add "set log command, debug, tun, warn, error, alert"
o Remove cdefs.h, and assume an ansi compiler.
o Improve all diagnostic output
o Don't trap SIGSEGV
o SIGHUP now terminates again (log files are controlled
by syslog)
o Call CloseModem() when changing devices
o Fix parsing of third arg of "delete"
I think this fixes the "magic is same" problems that some
people have been experiencing.
The man page is being rewritten. It'll follow soon.
Diffstat (limited to 'usr.sbin/ppp/chap.c')
-rw-r--r-- | usr.sbin/ppp/chap.c | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index ee40421..0ca0c7f 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.c,v 1.16 1997/05/24 17:32:32 brian Exp $ + * $Id: chap.c,v 1.17 1997/05/26 00:43:56 brian Exp $ * * TODO: */ @@ -62,10 +62,8 @@ int count; bcopy(&lh, MBUF_CTOP(bp), sizeof(struct fsmheader)); if (count) bcopy(ptr, MBUF_CTOP(bp) + sizeof(struct fsmheader), count); -#ifdef DEBUG - DumpBp(bp); -#endif - LogPrintf(LOG_LCP_BIT, "ChapOutput: %s\n", chapcodes[code]); + LogDumpBp(LogDEBUG, "ChapOutput", bp); + LogPrintf(LogLCP, "ChapOutput: %s\n", chapcodes[code]); HdlcOutput(PRI_LINK, PROTO_CHAP, bp); } @@ -96,23 +94,6 @@ int chapid; ChapOutput(CHAP_CHALLENGE, chapid, challenge_data, cp - challenge_data); } -#ifdef DEBUG -void -DumpDigest(mes, cp, len) -char *mes; -char *cp; -int len; -{ - int i; - - logprintf("%s: ", mes); - for (i = 0; i < len; i++) { - logprintf(" %02x", *cp++ & 0xff); - } - logprintf("\n"); -} -#endif - void RecvChapTalk(chp, bp) struct fsmheader *chp; @@ -127,16 +108,14 @@ struct mbuf *bp; char cdigest[16]; len = ntohs(chp->length); -#ifdef DEBUG - logprintf("length: %d\n", len); -#endif + LogPrintf(LogDEBUG, "RecvChapTalk: length: %d\n", len); arglen = len - sizeof(struct fsmheader); cp = (char *)MBUF_CTOP(bp); valsize = *cp++ & 255; name = cp + valsize; namelen = arglen - valsize - 1; name[namelen] = 0; - LogPrintf(LOG_PHASE_BIT, " Valsize = %d, Name = %s\n", valsize, name); + LogPrintf(LogPHASE, " Valsize = %d, Name = %s\n", valsize, name); /* * Get a secret key corresponds to the peer @@ -165,16 +144,12 @@ struct mbuf *bp; bcopy(keyp, ap, keylen); ap += keylen; bcopy(cp, ap, valsize); -#ifdef DEBUG - DumpDigest("recv", ap, valsize); -#endif + LogDumpBuff(LogDEBUG, "recv", ap, valsize); ap += valsize; MD5Init(&context); MD5Update(&context, answer, ap - answer); MD5Final(digest, &context); -#ifdef DEBUG - DumpDigest("answer", digest, 16); -#endif + LogDumpBuff(LogDEBUG, "answer", digest, 16); bcopy(name, digest + 16, namelen); ap += namelen; /* Send answer to the peer */ @@ -195,10 +170,8 @@ struct mbuf *bp; MD5Update(&context, answer, ap - answer); MD5Update(&context, challenge_data+1, challenge_len); MD5Final(cdigest, &context); -#ifdef DEBUG - DumpDigest("got", cp, 16); - DumpDigest("expect", cdigest, 16); -#endif + LogDumpBuff(LogDEBUG, "got", cp, 16); + LogDumpBuff(LogDEBUG, "expect", cdigest, 16); /* * Compare with the response */ @@ -227,9 +200,7 @@ struct mbuf *bp; struct lcpstate *lcp = &LcpInfo; len = ntohs(chp->length); -#ifdef DEBUG - logprintf("length: %d\n", len); -#endif + LogPrintf(LogDEBUG, "RecvChapResult: length: %d\n", len); if (chp->code == CHAP_SUCCESS) { if (lcp->auth_iwait == PROTO_CHAP) { lcp->auth_iwait = 0; @@ -255,7 +226,7 @@ ChapInput(struct mbuf *bp) if (len >= ntohs(chp->length)) { if (chp->code < 1 || chp->code > 4) chp->code = 0; - LogPrintf(LOG_LCP_BIT, "ChapInput: %s\n", chapcodes[chp->code]); + LogPrintf(LogLCP, "ChapInput: %s\n", chapcodes[chp->code]); bp->offset += sizeof(struct fsmheader); bp->cnt -= sizeof(struct fsmheader); |