X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;ds=sidebyside;f=pppd%2Fplugins%2Fradius%2Fradius.c;h=9fe5e5a33bed434d0a753f774165e86a5748e4cb;hb=1372300c7bb089278ee84fe8376e7f60306a503e;hp=932c89aaec389ec5577d5c01c5afd186321d30e6;hpb=f8583676904957554c5a8bd14ede415688835f6c;p=ppp.git diff --git a/pppd/plugins/radius/radius.c b/pppd/plugins/radius/radius.c index 932c89a..9fe5e5a 100644 --- a/pppd/plugins/radius/radius.c +++ b/pppd/plugins/radius/radius.c @@ -24,7 +24,7 @@ * ***********************************************************************/ static char const RCSID[] = -"$Id: radius.c,v 1.28 2004/11/14 10:27:57 paulus Exp $"; +"$Id: radius.c,v 1.30 2005/07/10 10:28:55 paulus Exp $"; #include "pppd.h" #include "chap-new.h" @@ -410,18 +410,14 @@ radius_chap_verify(char *user, char *ourname, int id, case CHAP_MICROSOFT: { /* MS-CHAP-Challenge and MS-CHAP-Response */ - MS_ChapResponse *rmd = (MS_ChapResponse *) response; u_char *p = cpassword; if (response_len != MS_CHAP_RESPONSE_LEN) return 0; *p++ = id; /* The idiots use a different field order in RADIUS than PPP */ - memcpy(p, rmd->UseNT, sizeof(rmd->UseNT)); - p += sizeof(rmd->UseNT); - memcpy(p, rmd->LANManResp, sizeof(rmd->LANManResp)); - p += sizeof(rmd->LANManResp); - memcpy(p, rmd->NTResp, sizeof(rmd->NTResp)); + *p++ = response[MS_CHAP_USENT]; + memcpy(p, response, MS_CHAP_LANMANRESP_LEN + MS_CHAP_NTRESP_LEN); rc_avpair_add(&send, PW_MS_CHAP_CHALLENGE, challenge, challenge_len, VENDOR_MICROSOFT); @@ -433,20 +429,15 @@ radius_chap_verify(char *user, char *ourname, int id, case CHAP_MICROSOFT_V2: { /* MS-CHAP-Challenge and MS-CHAP2-Response */ - MS_Chap2Response *rmd = (MS_Chap2Response *) response; u_char *p = cpassword; if (response_len != MS_CHAP2_RESPONSE_LEN) return 0; *p++ = id; /* The idiots use a different field order in RADIUS than PPP */ - memcpy(p, rmd->Flags, sizeof(rmd->Flags)); - p += sizeof(rmd->Flags); - memcpy(p, rmd->PeerChallenge, sizeof(rmd->PeerChallenge)); - p += sizeof(rmd->PeerChallenge); - memcpy(p, rmd->Reserved, sizeof(rmd->Reserved)); - p += sizeof(rmd->Reserved); - memcpy(p, rmd->NTResp, sizeof(rmd->NTResp)); + *p++ = response[MS_CHAP2_FLAGS]; + memcpy(p, response, (MS_CHAP2_PEER_CHAL_LEN + MS_CHAP2_RESERVED_LEN + + MS_CHAP2_NTRESP_LEN)); rc_avpair_add(&send, PW_MS_CHAP_CHALLENGE, challenge, challenge_len, VENDOR_MICROSOFT); @@ -480,6 +471,8 @@ radius_chap_verify(char *user, char *ourname, int id, req_info); } + strlcpy(message, radius_msg, message_space); + if (result == OK_RC) { if (!rstate.done_chap_once) { if (radius_setparams(received, radius_msg, req_info, digest,