From: Alan T. DeKok Date: Mon, 22 May 2023 19:50:02 +0000 (-0400) Subject: more cleanups X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04e2c42c3fd02559f204fe4f21b65e9aa79a56a5;p=thirdparty%2Ffreeradius-server.git more cleanups --- diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c index 971431fef30..9ed54510f22 100644 --- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c @@ -780,6 +780,9 @@ static unlang_action_t mod_session_init(rlm_rcode_t *p_result, module_ctx_t cons fr_pair_list_init(&data->mppe_keys); fr_pair_list_init(&data->reply); + /* + * Allow the administrator to set the CHAP-Challenge and Peer-Challenge attributes. + */ auth_challenge = fr_pair_find_by_da(&parent->control_pairs, NULL, attr_ms_chap_challenge); if (auth_challenge && (auth_challenge->vp_length != MSCHAPV2_CHALLENGE_LEN)) { RWDEBUG("&parent.control.MS-CHAP-Challenge is incorrect length. Ignoring it"); @@ -792,16 +795,12 @@ static unlang_action_t mod_session_init(rlm_rcode_t *p_result, module_ctx_t cons peer_challenge = NULL; } - if (auth_challenge) { - created_auth_challenge = false; - - } else { - created_auth_challenge = true; - peer_challenge = NULL; + created_auth_challenge = (auth_challenge == NULL); - /* - * Get a random challenge. - */ + /* + * if the administrator didn't set a challenge, then create one ourselves. + */ + if (!auth_challenge) { MEM(auth_challenge = fr_pair_afrom_da(eap_session, attr_ms_chap_challenge)); MEM(fr_pair_value_mem_alloc(auth_challenge, &p, MSCHAPV2_CHALLENGE_LEN, false) == 0); for (i = 0; i < MSCHAPV2_CHALLENGE_LEN; i++) p[i] = fr_rand();