@@ -44,6 +44,17 @@ static CONF_PARSER module_config[] = {
4444 CONF_PARSER_TERMINATOR
4545};
4646
47+ /*
48+ * 0 1 2 3
49+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
50+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51+ * | Code | Identifier | Length |
52+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53+ * | Type | OpCode | MS-CHAPv2-ID | MS-Length...
54+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
55+ * | MS-Length | Data...
56+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57+ */
4758
4859static void fix_mppe_keys (eap_handler_t * handler , mschapv2_opaque_t * data )
4960{
@@ -423,8 +434,8 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler)
423434 int mschap_id ;
424435 int copied = 0 ,seq = 1 ;
425436
426- if (eap_ds -> response -> type .length < 544 ) {
427- RDEBUG2 ("Password change has invalid length %zu < 544 " ,
437+ if (eap_ds -> response -> type .length < 586 ) {
438+ RDEBUG2 ("Password change has invalid length %zu < 586 " ,
428439 eap_ds -> response -> type .length );
429440 return 0 ;
430441 }
@@ -492,19 +503,19 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler)
492503
493504 case PW_EAP_MSCHAPV2_SUCCESS :
494505 /*
495- * we sent a success to the client; some clients send a
506+ * we < sent a success to the client; some clients send a
496507 * success back as-per the RFC, some send an ACK. Permit
497508 * both, I guess...
498509 */
499510
500511 switch (ccode ) {
501512 case PW_EAP_MSCHAPV2_SUCCESS :
513+ case PW_EAP_MSCHAPV2_ACK :
502514 eap_ds -> request -> code = PW_EAP_SUCCESS ;
503515
504516 fr_pair_list_mcopy_by_num (request -> reply , & request -> reply -> vps , & data -> mppe_keys , 0 , 0 , TAG_ANY );
505517 /* FALL-THROUGH */
506518
507- case PW_EAP_MSCHAPV2_ACK :
508519#ifdef WITH_PROXY
509520 /*
510521 * It's a success. Don't proxy it.
@@ -578,8 +589,8 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler)
578589 }
579590
580591 length = (eap_ds -> response -> type .data [2 ] << 8 ) | eap_ds -> response -> type .data [3 ];
581- if ((length < (5 + 49 )) || (length > (256 + 5 + 49 ))) {
582- REDEBUG ("Response contains contradictory length %zu %d " , length , 5 + 49 );
592+ if ((length < (5 + 49 )) || (length > (256 + 5 + 49 )) || ( length != ( eap_ds -> response -> type . length - 5 )) ) {
593+ REDEBUG ("Response contains invalid length %zd " , length );
583594 return 0 ;
584595 }
585596
0 commit comments