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

eap-gtc: Implement .check_settings

Only do the same validation that .load_settings would do for GTC.
This commit is contained in:
Andrew Zaborowski 2018-04-18 07:03:29 +02:00 committed by Denis Kenzior
parent 8650bddcfe
commit 86aa4e8af1

View File

@ -69,6 +69,23 @@ error:
eap_method_error(eap); eap_method_error(eap);
} }
static bool eap_gtc_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), "%sGTC-Secret", prefix);
if (!l_settings_get_value(settings, "Security", setting)) {
l_error("Property %s is missing", setting);
return false;
}
return true;
}
static bool eap_gtc_load_settings(struct eap_state *eap, static bool eap_gtc_load_settings(struct eap_state *eap,
struct l_settings *settings, struct l_settings *settings,
const char *prefix) const char *prefix)
@ -80,11 +97,6 @@ static bool eap_gtc_load_settings(struct eap_state *eap,
snprintf(setting, sizeof(setting), "%sGTC-Secret", prefix); snprintf(setting, sizeof(setting), "%sGTC-Secret", prefix);
secret = l_strdup(l_settings_get_value(settings, "Security", setting)); secret = l_strdup(l_settings_get_value(settings, "Security", setting));
if (!secret) {
l_error("EAP-GTC secret is missing");
return false;
}
gtc = l_new(struct eap_gtc_state, 1); gtc = l_new(struct eap_gtc_state, 1);
gtc->secret = secret; gtc->secret = secret;
eap_set_data(eap, gtc); eap_set_data(eap, gtc);
@ -98,6 +110,7 @@ static struct eap_method eap_gtc = {
.name = "GTC", .name = "GTC",
.free = eap_gtc_free, .free = eap_gtc_free,
.handle_request = eap_gtc_handle_request, .handle_request = eap_gtc_handle_request,
.check_settings = eap_gtc_check_settings,
.load_settings = eap_gtc_load_settings, .load_settings = eap_gtc_load_settings,
}; };