3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-04 02:18:49 +02:00

eap: Allow methods to request the Identity from agent

In eap_check_settings move the check for the EAP-Identity setting so
that the method's check_setting call back has a chance to request it
from the agent.  Note the check can be also moved to the EAP methods
so that they are free to skip it if not NULL identity is ok.
This commit is contained in:
Andrew Zaborowski 2018-06-14 03:45:24 +02:00 committed by Denis Kenzior
parent b9aaab9c63
commit 1a465aed4a

View File

@ -422,6 +422,7 @@ int eap_check_settings(struct l_settings *settings, struct l_queue *secrets,
const char *method_name;
const struct l_queue_entry *entry;
struct eap_method *method;
int ret = 0;
snprintf(setting, sizeof(setting), "%sMethod", prefix);
method_name = l_settings_get_value(settings, "Security", setting);
@ -454,20 +455,32 @@ int eap_check_settings(struct l_settings *settings, struct l_queue *secrets,
return -ENOTSUP;
}
/* method may not store identity in settings file */
if (!method->get_identity) {
if (method->check_settings)
ret = method->check_settings(settings, secrets,
prefix, out_missing);
if (ret)
return ret;
/*
* Methods that provide the get_identity callback are responsible
* for ensuring, inside check_settings(), that they have enough data
* to return the identity after load_settings().
*/
if (method->get_identity)
return 0;
snprintf(setting, sizeof(setting), "%sIdentity", prefix);
if (!l_settings_get_value(settings, "Security", setting)) {
if (!l_settings_get_value(settings, "Security", setting) &&
!l_queue_find(secrets, eap_secret_info_match,
setting) &&
!l_queue_find(*out_missing, eap_secret_info_match,
setting)) {
l_error("Property %s is missing", setting);
return -ENOENT;
}
}
if (!method->check_settings)
return 0;
return method->check_settings(settings, secrets, prefix, out_missing);
}
bool eap_load_settings(struct eap_state *eap, struct l_settings *settings,