commit 726bf9d8e4d43ba6ca414bc1c835546904356232
parent 782bd4a7ae2c173046e95718cf19eb72e0fa0af5
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Fri, 11 Jan 2019 15:27:15 -0800
eap: Make Identity optional
Some of the EAP methods don't require a clear-text identity to
be sent with the Identity Response packet. The mandatory identity
filed has resulted in unnecessary transmission of the garbage
values. This patch makes the Identity field to be optional and
shift responsibility to ensure its existence to the individual
methods if the field is required. All necessary identity checks
have been previously propagated to individual methods.
Diffstat:
| M | src/eap.c | | | 35 | +++-------------------------------- |
1 file changed, 3 insertions(+), 32 deletions(-)
diff --git a/src/eap.c b/src/eap.c
@@ -418,23 +418,6 @@ void eap_secret_info_free(void *data)
l_free(info);
}
-static int eap_setting_exists(struct l_settings *settings,
- const char *setting,
- struct l_queue *secrets,
- struct l_queue *missing)
-{
- if (l_settings_get_value(settings, "Security", setting))
- return 0;
-
- if (l_queue_find(secrets, eap_secret_info_match, setting))
- return 0;
-
- if (l_queue_find(missing, eap_secret_info_match, setting))
- return 0;
-
- return -ENOENT;
-}
-
int __eap_check_settings(struct l_settings *settings, struct l_queue *secrets,
const char *prefix, bool set_key_material,
struct l_queue **missing)
@@ -482,19 +465,10 @@ int __eap_check_settings(struct l_settings *settings, struct l_queue *secrets,
}
/*
- * 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().
+ * Individual methods are responsible for ensuring, inside their
+ * check_settings(), that they have enough data to return the
+ * identity after load_settings() if it is required.
*/
- if (!method->get_identity) {
- snprintf(setting, sizeof(setting), "%sIdentity", prefix);
-
- ret = eap_setting_exists(settings, setting, secrets, *missing);
- if (ret < 0) {
- l_error("Property %s is missing", setting);
- return -ENOENT;
- }
- }
return 0;
}
@@ -566,9 +540,6 @@ bool eap_load_settings(struct eap_state *eap, struct l_settings *settings,
eap->identity = l_strdup(eap->method->get_identity(eap));
}
- if (!eap->identity)
- goto err;
-
return true;
err: