3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

eap-mschapv2: Warn if required fields are missing

This commit is contained in:
Tim Kourt 2019-01-10 14:34:23 -08:00 committed by Denis Kenzior
parent bfb69e930f
commit bb4e1ebd4f

View File

@ -556,17 +556,20 @@ static bool eap_mschapv2_load_settings(struct eap_state *eap,
snprintf(setting, sizeof(setting), "%sPassword", prefix); snprintf(setting, sizeof(setting), "%sPassword", prefix);
password = l_settings_get_string(settings, "Security", setting); password = l_settings_get_string(settings, "Security", setting);
if (password) if (password) {
set_password_from_string(state, password); set_password_from_string(state, password);
else { } else {
unsigned char *tmp; unsigned char *tmp;
size_t len; size_t len;
const char *hash_str; const char *hash_str;
snprintf(setting, sizeof(setting), "%sPassword-Hash", prefix); snprintf(setting, sizeof(setting), "%sPassword-Hash", prefix);
hash_str = l_settings_get_value(settings, "Security", setting); hash_str = l_settings_get_value(settings, "Security", setting);
if (!hash_str) if (!hash_str) {
l_error("Neither '%sPassword' or '%sPassword-Hash' "
"setting was provided", prefix, prefix);
goto error; goto error;
}
tmp = l_util_from_hexstring(hash_str, &len); tmp = l_util_from_hexstring(hash_str, &len);
memcpy(state->password_hash, tmp, 16); memcpy(state->password_hash, tmp, 16);