X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Flcp.c;h=dde1381abae4c95ca89d662f36da3b002950f913;hp=eabdfbabb61bca6083d1ead9fc23f954677a6158;hb=ae57a37fb6a716dddff877efde7c82a61f254c98;hpb=7f417198cd0911ddbd890565298a4a400e09cae2 diff --git a/pppd/lcp.c b/pppd/lcp.c index eabdfba..dde1381 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -40,7 +40,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: lcp.c,v 1.67 2003/05/09 11:49:46 carlsonj Exp $" +#define RCSID "$Id: lcp.c,v 1.71 2004/10/31 22:23:18 paulus Exp $" /* * TODO: @@ -53,7 +53,7 @@ #include "pppd.h" #include "fsm.h" #include "lcp.h" -#include "chap.h" +#include "chap-new.h" #include "magic.h" static const char rcsid[] = RCSID; @@ -359,7 +359,7 @@ lcp_init(unit) ao->mru = MAXMRU; ao->neg_asyncmap = 1; ao->neg_chap = 1; - ao->chap_mdtype = MDTYPE_ALL; + ao->chap_mdtype = chap_mdtype_all; ao->neg_upap = 1; ao->neg_eap = 1; ao->neg_magicnumber = 1; @@ -1029,6 +1029,10 @@ lcp_nakci(f, p, len) try.neg = 0; \ } + /* + * NOTE! There must be no assignments to individual fields of *go in + * the code below. Any such assignment is a BUG! + */ /* * We don't care if they want to send us smaller packets than * we want. Therefore, accept any MRU less than what we asked for, @@ -1089,7 +1093,7 @@ lcp_nakci(f, p, len) try.neg_eap = 0; /* Try to set up to use their suggestion, if possible */ if (CHAP_CANDIGEST(go->chap_mdtype, cichar)) - go->chap_mdtype = CHAP_MDTYPE_D(cichar); + try.chap_mdtype = CHAP_MDTYPE_D(cichar); } else if (go->neg_chap) { /* * We were asking for our preferred algorithm, they must @@ -1098,7 +1102,7 @@ lcp_nakci(f, p, len) if (cichar != CHAP_DIGEST(go->chap_mdtype)) { if (CHAP_CANDIGEST(go->chap_mdtype, cichar)) { /* Use their suggestion if we support it ... */ - go->chap_mdtype = CHAP_MDTYPE_D(cichar); + try.chap_mdtype = CHAP_MDTYPE_D(cichar); } else { /* ... otherwise, try our next-preferred algorithm. */ try.chap_mdtype &= ~(CHAP_MDTYPE(try.chap_mdtype)); @@ -1216,7 +1220,7 @@ lcp_nakci(f, p, len) * An option we don't recognize represents the peer asking to * negotiate some option we don't support, so ignore it. */ - while (len > CILEN_VOID) { + while (len >= CILEN_VOID) { GETCHAR(citype, p); GETCHAR(cilen, p); if (cilen < CILEN_VOID || (len -= cilen) < 0) @@ -1666,7 +1670,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree) if (ao->neg_chap) { PUTCHAR(CILEN_CHAP, nakp); PUTSHORT(PPP_CHAP, nakp); - PUTCHAR(ao->chap_mdtype, nakp); + PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakp); } else { PUTCHAR(CILEN_SHORT, nakp); PUTSHORT(PPP_PAP, nakp); @@ -2034,7 +2038,7 @@ lcp_printpkt(p, plen, printer, arg) printer(arg, "chap"); if (p < optend) { switch (*p) { - case CHAP_DIGEST_MD5: + case CHAP_MD5: printer(arg, " MD5"); ++p; break;