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

eap: new method API for getting EAP-Identity

EAP-SIM/AKA/AKA' retrieve the EAP-Identity off the SIM card
not from the settings file. This adds a new EAP method API
which can optionally be implemented to retrieve the identity.
If get_identity is implemented, the EAP layer will use it to
retrieve the identity rather than looking in the settings file.
This commit is contained in:
James Prestwood 2017-11-09 11:07:55 -08:00 committed by Denis Kenzior
parent ec0aab7829
commit c0fe2b78c4
2 changed files with 14 additions and 9 deletions

View File

@ -369,21 +369,25 @@ bool eap_load_settings(struct eap_state *eap, struct l_settings *settings,
goto err;
}
snprintf(setting, sizeof(setting), "%sIdentity", prefix);
eap->identity = l_strdup(l_settings_get_value(settings,
"Security", setting));
if (eap->method->load_settings)
if (!eap->method->load_settings(eap, settings, prefix))
goto err;
/* get identity from settings or from EAP method */
if (!eap->method->get_identity) {
snprintf(setting, sizeof(setting), "%sIdentity", prefix);
eap->identity = l_strdup(l_settings_get_value(settings,
"Security", setting));
} else {
eap->identity = l_strdup(eap->method->get_identity(eap));
}
if (!eap->identity) {
l_error("EAP Identity is missing");
goto err;
}
if (!eap->method->load_settings)
return true;
if (!eap->method->load_settings(eap, settings, prefix))
goto err;
return true;
err:

View File

@ -102,6 +102,7 @@ struct eap_method {
const uint8_t *pkt, size_t len);
void (*handle_retransmit)(struct eap_state *eap,
const uint8_t *pkt, size_t len);
const char *(*get_identity)(struct eap_state *eap);
};
struct eap_method_desc {