diff options
author | phk <phk@FreeBSD.org> | 1996-03-01 19:29:44 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1996-03-01 19:29:44 +0000 |
commit | 8bc36c3dbc3c59e9d8632ddda344652ff44d3ec1 (patch) | |
tree | 1c9cbef7f7c1e9feb2933a403aacaa972df34957 /usr.sbin/pppd/chap.c | |
parent | 0d3859fc4832bd1d80625f81b97b1e37cc44bb93 (diff) | |
download | FreeBSD-src-8bc36c3dbc3c59e9d8632ddda344652ff44d3ec1.zip FreeBSD-src-8bc36c3dbc3c59e9d8632ddda344652ff44d3ec1.tar.gz |
Use libmd.
Add support for negotiating (more like "informing peer") about DNS.
Various cleanup of warnings.
Diffstat (limited to 'usr.sbin/pppd/chap.c')
-rw-r--r-- | usr.sbin/pppd/chap.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/pppd/chap.c b/usr.sbin/pppd/chap.c index d72c36d..4b2c733 100644 --- a/usr.sbin/pppd/chap.c +++ b/usr.sbin/pppd/chap.c @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: chap.c,v 1.8 1995/07/04 12:32:26 paulus Exp $"; +static char rcsid[] = "$Id: chap.c,v 1.4 1995/10/31 21:20:55 peter Exp $"; #endif /* @@ -31,10 +31,10 @@ static char rcsid[] = "$Id: chap.c,v 1.8 1995/07/04 12:32:26 paulus Exp $"; #include <sys/types.h> #include <sys/time.h> #include <syslog.h> +#include <md5.h> #include "pppd.h" #include "chap.h" -#include "md5.h" chap_state chap[NUM_PPP]; /* CHAP state; one for each unit */ @@ -342,6 +342,7 @@ ChapReceiveChallenge(cstate, inp, id, len) char secret[MAXSECRETLEN]; char rhostname[256]; MD5_CTX mdContext; + unsigned char digest[16]; CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: Rcvd id %d.", id)); if (cstate->clientstate == CHAPCS_CLOSED || @@ -396,8 +397,8 @@ ChapReceiveChallenge(cstate, inp, id, len) MD5Update(&mdContext, &cstate->resp_id, 1); MD5Update(&mdContext, secret, secret_len); MD5Update(&mdContext, rchallenge, rchallenge_len); - MD5Final(&mdContext); - BCOPY(mdContext.digest, cstate->response, MD5_SIGNATURE_SIZE); + MD5Final(digest, &mdContext); + BCOPY(digest, cstate->response, MD5_SIGNATURE_SIZE); cstate->resp_length = MD5_SIGNATURE_SIZE; break; @@ -426,6 +427,7 @@ ChapReceiveResponse(cstate, inp, id, len) char rhostname[256]; u_char buf[256]; MD5_CTX mdContext; + unsigned char digest[16]; u_char msg[256]; char secret[MAXSECRETLEN]; @@ -500,10 +502,10 @@ ChapReceiveResponse(cstate, inp, id, len) MD5Update(&mdContext, &cstate->chal_id, 1); MD5Update(&mdContext, secret, secret_len); MD5Update(&mdContext, cstate->challenge, cstate->chal_len); - MD5Final(&mdContext); + MD5Final(digest, &mdContext); /* compare local and remote MDs and send the appropriate status */ - if (memcmp (mdContext.digest, remmd, MD5_SIGNATURE_SIZE) == 0) + if (memcmp (digest, remmd, MD5_SIGNATURE_SIZE) == 0) code = CHAP_SUCCESS; /* they are the same! */ break; |