From ba7b98841db381bf4be73509e8d33cab7f07111b Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 10 Nov 2003 21:56:02 +0000 Subject: Ignore case when comparing CHAP/CHAP81 responses PR: 31771 --- usr.sbin/ppp/chap.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index 46dcd31..305e5c7 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -624,18 +624,23 @@ chap_Cmp(u_char type, char *myans, int mylen, char *hisans, int hislen #endif ) { + int off; + if (mylen != hislen) return 0; -#ifndef NODES - else if (type == 0x80) { - int off = lm ? 0 : 24; - if (memcmp(myans + off, hisans + off, 24)) - return 0; + off = 0; + +#ifndef NODES + if (type == 0x80) { + off = lm ? 0 : 24; + mylen = 24; } #endif - else if (memcmp(myans, hisans, mylen)) - return 0; + + for (; mylen; off++, mylen--) + if (toupper(myans[off]) != toupper(hisans[off])) + return 0; return 1; } -- cgit v1.1