3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

eap-gtc: added support for agent in gtc

Now, EAP-GTC behaves similar to MSCHAPv2 where check_settings allows
for missing EAP-Identity and GTC-Secret fields. Either or both can be
missing and the agent will request the missing fields.
This commit is contained in:
James Prestwood 2018-07-31 12:04:39 -07:00 committed by Denis Kenzior
parent 2e08b3e129
commit 3d2285ec7e

View File

@ -77,14 +77,33 @@ static int eap_gtc_check_settings(struct l_settings *settings,
struct l_queue **out_missing)
{
char setting[64];
char setting2[64];
L_AUTO_FREE_VAR(char *, identity);
const struct eap_secret_info *secret;
snprintf(setting, sizeof(setting), "%sGTC-Secret", prefix);
snprintf(setting, sizeof(setting), "%sIdentity", prefix);
identity = l_settings_get_string(settings, "Security", setting);
if (!l_settings_get_value(settings, "Security", setting)) {
l_error("Property %s is missing", setting);
return -ENOENT;
snprintf(setting2, sizeof(setting2), "%sGTC-Secret", prefix);
/* no identity setting found */
if (!identity) {
secret = l_queue_find(secrets, eap_secret_info_match, setting);
/* no secret found either */
if (!secret)
eap_append_secret(out_missing, EAP_SECRET_REMOTE_USER_PASSWORD,
setting, setting2, NULL);
return 0;
}
secret = l_queue_find(secrets, eap_secret_info_match, setting2);
/* identity found, but secret missing */
if (!secret)
eap_append_secret(out_missing, EAP_SECRET_REMOTE_PASSWORD,
setting2, NULL, identity);
return 0;
}