3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-01-03 19:02:34 +01:00

eap-md5: Implement .check_settings

Only do the same validation that .load_settings would do for MD5.
This commit is contained in:
Andrew Zaborowski 2018-04-18 07:03:23 +02:00 committed by Denis Kenzior
parent 246e76c7b0
commit 9134743a97

View File

@ -86,6 +86,23 @@ err:
eap_method_error(eap);
}
static bool eap_md5_check_settings(struct l_settings *settings,
struct l_queue *secrets,
const char *prefix,
struct l_queue **out_missing)
{
char setting[64];
snprintf(setting, sizeof(setting), "%sMD5-Secret", prefix);
if (!l_settings_get_value(settings, "Security", setting)) {
l_error("Property %s is missing", setting);
return false;
}
return true;
}
static bool eap_md5_load_settings(struct eap_state *eap,
struct l_settings *settings,
const char *prefix)
@ -97,11 +114,6 @@ static bool eap_md5_load_settings(struct eap_state *eap,
snprintf(setting, sizeof(setting), "%sMD5-Secret", prefix);
secret = l_strdup(l_settings_get_value(settings, "Security", setting));
if (!secret) {
l_error("EAP-MD5 secret is missing");
return false;
}
md5 = l_new(struct eap_md5_state, 1);
md5->secret = secret;
eap_set_data(eap, md5);
@ -116,6 +128,7 @@ static struct eap_method eap_md5 = {
.free = eap_md5_free,
.handle_request = eap_md5_handle_request,
.check_settings = eap_md5_check_settings,
.load_settings = eap_md5_load_settings,
};