head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.44 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.42 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.40 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.38 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.36 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.34 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.32 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.30 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.28 pkgsrc-2008Q2-base:1.2 pkgsrc-2008Q1:1.2.0.26 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.24 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.22 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.20 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.18 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.16 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.14 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.2.0.12 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.2.0.10 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.2.0.8 pkgsrc-2005Q4-base:1.2 pkgsrc-2005Q3:1.2.0.6 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.4 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.2.0.2 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.1.1.1.0.18 pkgsrc-2004Q4-base:1.1.1.1 pkgsrc-2004Q3:1.1.1.1.0.16 pkgsrc-2004Q3-base:1.1.1.1 pkgsrc-2004Q2:1.1.1.1.0.14 pkgsrc-2004Q2-base:1.1.1.1 pkgsrc-2004Q1:1.1.1.1.0.12 pkgsrc-2004Q1-base:1.1.1.1 pkgsrc-2003Q4:1.1.1.1.0.10 pkgsrc-2003Q4-base:1.1.1.1 netbsd-1-6-1:1.1.1.1.0.6 netbsd-1-6-1-base:1.1.1.1 netbsd-1-6:1.1.1.1.0.8 netbsd-1-6-RELEASE-base:1.1.1.1 pkgviews:1.1.1.1.0.4 pkgviews-base:1.1.1.1 buildlink2:1.1.1.1.0.2 buildlink2-base:1.1.1.1 netbsd-1-5-PATCH003:1.1.1.1 netbsd-1-5-PATCH001:1.1.1.1 netbsd-1-5-RELEASE:1.1.1.1 netbsd-1-4-PATCH003:1.1.1.1 netbsd-1-4-PATCH002:1.1.1.1 comdex-fall-1999:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.2 date 2005.01.02.03.01.56; author cube; state dead; branches; next 1.1; 1.1 date 99.10.08.04.34.43; author dbj; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.10.08.04.34.43; author dbj; state Exp; branches; next ; desc @@ 1.2 log @Remove ppp-mppe, obsoleted by pppd and mppe-lkm. I can't really say I will regret it. @ text @$NetBSD: patch-bf,v 1.1 1999/10/08 04:34:43 dbj Exp $ --- pppd/chap.c.orig Fri Aug 13 02:46:11 1999 +++ pppd/chap.c Sat Sep 25 13:23:26 1999 @@@@ -47,6 +47,8 @@@@ #include "pppd.h" #include "chap.h" #include "md5.h" +#include "fsm.h" +#include "lcp.h" #ifdef CHAPMS #include "chap_ms.h" #endif @@@@ -113,7 +115,7 @@@@ static void ChapSendStatus __P((chap_state *, int)); static void ChapSendChallenge __P((chap_state *)); static void ChapSendResponse __P((chap_state *)); -static void ChapGenChallenge __P((chap_state *)); +void ChapGenChallenge __P((chap_state *)); extern double drand48 __P((void)); extern void srand48 __P((long)); @@@@ -460,6 +462,7 @@@@ switch (cstate->resp_type) { case CHAP_DIGEST_MD5: + CHAPDEBUG(("ChapReceiveChallenge: rcvd type CHAP-DIGEST-MD5")); MD5Init(&mdContext); MD5Update(&mdContext, &cstate->resp_id, 1); MD5Update(&mdContext, secret, secret_len); @@@@ -471,8 +474,24 @@@@ #ifdef CHAPMS case CHAP_MICROSOFT: + CHAPDEBUG(("ChapReceiveChallenge: rcvd type MS-CHAP-V1.")); + if(rchallenge_len != 8) + { + CHAPDEBUG(("Invalid challenge length for MS-CHAP-V1")); + return; + } ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len); break; + + case CHAP_MICROSOFT_V2: + CHAPDEBUG(("ChapReceiveChallenge: rcvd type MS-CHAP-V2.")); + if(rchallenge_len != 16) + { + CHAPDEBUG(("Invalid challenge length for MS-CHAP-V2")); + return; + } + ChapMS_v2(cstate, rchallenge, rchallenge_len, secret, secret_len); + break; #endif default: @@@@ -560,7 +579,8 @@@@ /* generate MD based on negotiated type */ switch (cstate->chal_type) { - case CHAP_DIGEST_MD5: /* only MD5 is defined for now */ + case CHAP_DIGEST_MD5: + CHAPDEBUG(("ChapReceiveResponse: rcvd type CHAP-DIGEST-MD5")); if (remmd_len != MD5_SIGNATURE_SIZE) break; /* it's not even the right length */ MD5Init(&mdContext); @@@@ -574,6 +594,27 @@@@ code = CHAP_SUCCESS; /* they are the same! */ break; +#ifdef CHAPMS + case CHAP_MICROSOFT: + CHAPDEBUG(("ChapReceiveResponse: rcvd type MS-CHAP-V1")); + if(remmd_len != MS_CHAP_RESPONSE_LEN) + break; + if(ChapMS_Resp(cstate, secret, secret_len, remmd) == 0) + code = CHAP_SUCCESS; + break; + + case CHAP_MICROSOFT_V2: + CHAPDEBUG(("ChapReceiveResponse: rcvd type MS-CHAP-V2")); + if(remmd_len != MS_CHAP_RESPONSE_LEN) + break; + if(ChapMS_v2_Resp(cstate,secret,secret_len,remmd,rhostname) == 0) + { + code = CHAP_SUCCESS_R; + ChapMS_v2_Auth(cstate, secret, secret_len, remmd, rhostname); + } + break; +#endif + default: CHAPDEBUG(("unknown digest type %d", cstate->chal_type)); } @@@@ -582,7 +623,7 @@@@ BZERO(secret, sizeof(secret)); ChapSendStatus(cstate, code); - if (code == CHAP_SUCCESS) { + if ((code == CHAP_SUCCESS) || (code == CHAP_SUCCESS_R)) { old_state = cstate->serverstate; cstate->serverstate = CHAPSS_OPEN; if (old_state == CHAPSS_INITIAL_CHAL) { @@@@ -590,10 +631,43 @@@@ } if (cstate->chal_interval != 0) TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval); - notice("CHAP peer authentication succeeded for %q", rhostname); - + switch (cstate->chal_type) { + case CHAP_DIGEST_MD5: + notice("CHAP peer authentication succeeded for %q", rhostname); + break; +#ifdef CHAPMS + case CHAP_MICROSOFT: + notice("MSCHAP peer authentication succeeded for %q", rhostname); + break; + case CHAP_MICROSOFT_V2: + notice("MSCHAP-v2 peer authentication succeeded for %q", rhostname); + break; +#endif + default: + notice("CHAP (unknown) peer authentication succeeded for %q", + rhostname); + break; + } } else { - error("CHAP peer authentication failed for remote host %q", rhostname); + switch (cstate->chal_type) { + case CHAP_DIGEST_MD5: + error("CHAP peer authentication failed for remote host %q", + rhostname); + break; +#ifdef CHAPMS + case CHAP_MICROSOFT: + error("MSCHAP peer authentication failed for remote host %q", + rhostname); + break; + case CHAP_MICROSOFT_V2: + error("MSCHAP-v2 peer authentication failed for remote host %q", + rhostname); + break; +#endif + default: + error("CHAP (unknown) peer authentication failed for remote host %q", rhostname); + break; + } cstate->serverstate = CHAPSS_BADAUTH; auth_peer_fail(cstate->unit, PPP_CHAP); } @@@@ -712,6 +786,8 @@@@ if (code == CHAP_SUCCESS) slprintf(msg, sizeof(msg), "Welcome to %s.", hostname); + else if(code == CHAP_SUCCESS_R) + strcpy(msg, cstate->response); else slprintf(msg, sizeof(msg), "I don't like you. Go 'way."); msglen = strlen(msg); @@@@ -721,7 +797,7 @@@@ MAKEHEADER(outp, PPP_CHAP); /* paste in a header */ - PUTCHAR(code, outp); + PUTCHAR(code == CHAP_SUCCESS_R ? CHAP_SUCCESS : code, outp); PUTCHAR(cstate->chal_id, outp); PUTSHORT(outlen, outp); BCOPY(msg, outp, msglen); @@@@ -735,7 +811,7 @@@@ * *cstate are initialized. */ -static void +void ChapGenChallenge(cstate) chap_state *cstate; { @@@@ -743,6 +819,14 @@@@ u_char *ptr = cstate->challenge; unsigned int i; +#ifdef CHAPMS + if(cstate->chal_type == CHAP_MICROSOFT) + chal_len = 8; + else if(cstate->chal_type == CHAP_MICROSOFT_V2) + chal_len = 16; + else +#endif + /* pick a random challenge length between MIN_CHALLENGE_LENGTH and MAX_CHALLENGE_LENGTH */ chal_len = (unsigned) ((drand48() * @@@@ -857,4 +941,14 @@@@ } return len + CHAP_HEADERLEN; +} + +int +reqchap(argv) + char **argv; +{ + lcp_wantoptions[0].neg_chap = 1; + lcp_wantoptions[0].use_digest = 1; + auth_required = 1; + return 1; } @ 1.1 log @Initial revision @ text @d1 1 a1 1 $NetBSD$ @ 1.1.1.1 log @ PPP daemon and LKM with MPPE - Microsoft Point-to-Point Encryption @ text @@