mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 10:32:33 +01: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:
parent
ec0aab7829
commit
c0fe2b78c4
22
src/eap.c
22
src/eap.c
@ -369,21 +369,25 @@ bool eap_load_settings(struct eap_state *eap, struct l_settings *settings,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(setting, sizeof(setting), "%sIdentity", prefix);
|
if (eap->method->load_settings)
|
||||||
eap->identity = l_strdup(l_settings_get_value(settings,
|
if (!eap->method->load_settings(eap, settings, prefix))
|
||||||
"Security", setting));
|
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) {
|
if (!eap->identity) {
|
||||||
l_error("EAP Identity is missing");
|
l_error("EAP Identity is missing");
|
||||||
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eap->method->load_settings)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (!eap->method->load_settings(eap, settings, prefix))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
@ -102,6 +102,7 @@ struct eap_method {
|
|||||||
const uint8_t *pkt, size_t len);
|
const uint8_t *pkt, size_t len);
|
||||||
void (*handle_retransmit)(struct eap_state *eap,
|
void (*handle_retransmit)(struct eap_state *eap,
|
||||||
const uint8_t *pkt, size_t len);
|
const uint8_t *pkt, size_t len);
|
||||||
|
const char *(*get_identity)(struct eap_state *eap);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct eap_method_desc {
|
struct eap_method_desc {
|
||||||
|
Loading…
Reference in New Issue
Block a user