index c512018..3f3fc46 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -1239,9 +1239,21 @@ static int mschap_authenticate(void * instance, REQUEST *request) response->vp_octets + 26, nthashhash, do_ntlm_auth) < 0) { RDEBUG2("FAILED: MS-CHAP2-Response is incorrect"); + + /* JCH - changes to include challenge and message */ + char msg[100]; + strcpy(msg, "E=691 R=0 C="); + int i, offset = strlen(msg); + char *ptr = &msg[offset]; + for (i=0; i<16; i++, ptr+=2) { + sprintf(ptr, "%02X", response->vp_octets[i+2]); + } + *ptr = 0; + strcat(msg, " V=3 M=May Need to reset cached password"); + mschap_add_reply(request, &request->reply->vps, *response->vp_octets, - "MS-CHAP-Error", "E=691 R=1", 9); + "MS-CHAP-Error", msg, strlen(msg)); return RLM_MODULE_REJECT; }