mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
eap-pwd: Standardize setting keys
Switch EAP-PWD to use the common password setting key nomenclature.
This commit is contained in:
parent
c256dbfbd8
commit
df59d57f96
@ -695,37 +695,50 @@ static int eap_pwd_check_settings(struct l_settings *settings,
|
|||||||
const char *prefix,
|
const char *prefix,
|
||||||
struct l_queue **out_missing)
|
struct l_queue **out_missing)
|
||||||
{
|
{
|
||||||
const char *password;
|
|
||||||
L_AUTO_FREE_VAR(char *, identity);
|
|
||||||
const struct eap_secret_info *secret;
|
const struct eap_secret_info *secret;
|
||||||
char setting[64], setting2[64];
|
char identity_key[72];
|
||||||
|
char password_key[72];
|
||||||
|
char password_key_old[72];
|
||||||
|
|
||||||
snprintf(setting, sizeof(setting), "%sIdentity", prefix);
|
L_AUTO_FREE_VAR(char *, identity);
|
||||||
identity = l_settings_get_string(settings, "Security", setting);
|
L_AUTO_FREE_VAR(char *, password) = NULL;
|
||||||
|
|
||||||
snprintf(setting2, sizeof(setting2), "%sPWD-Password", prefix);
|
snprintf(identity_key, sizeof(identity_key), "%sIdentity", prefix);
|
||||||
password = l_settings_get_value(settings, "Security", setting2);
|
snprintf(password_key, sizeof(password_key), "%sPassword", prefix);
|
||||||
|
|
||||||
|
identity = l_settings_get_string(settings, "Security", identity_key);
|
||||||
|
|
||||||
if (!identity) {
|
if (!identity) {
|
||||||
secret = l_queue_find(secrets, eap_secret_info_match, setting);
|
secret = l_queue_find(secrets, eap_secret_info_match,
|
||||||
if (!secret) {
|
identity_key);
|
||||||
eap_append_secret(out_missing,
|
if (secret)
|
||||||
EAP_SECRET_REMOTE_USER_PASSWORD,
|
return 0;
|
||||||
setting, setting2, NULL,
|
|
||||||
|
eap_append_secret(out_missing, EAP_SECRET_REMOTE_USER_PASSWORD,
|
||||||
|
identity_key, password_key, NULL,
|
||||||
EAP_CACHE_TEMPORARY);
|
EAP_CACHE_TEMPORARY);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
password = l_settings_get_string(settings, "Security", password_key);
|
||||||
|
|
||||||
if (!password) {
|
if (!password) {
|
||||||
secret = l_queue_find(secrets, eap_secret_info_match, setting2);
|
snprintf(password_key_old, sizeof(password_key_old),
|
||||||
if (!secret) {
|
"%sPWD-Password", prefix);
|
||||||
eap_append_secret(out_missing,
|
password = l_settings_get_string(settings, "Security",
|
||||||
EAP_SECRET_REMOTE_PASSWORD,
|
password_key_old);
|
||||||
setting2, NULL, identity,
|
if (password)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
secret = l_queue_find(secrets, eap_secret_info_match,
|
||||||
|
password_key);
|
||||||
|
if (secret)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
eap_append_secret(out_missing, EAP_SECRET_REMOTE_PASSWORD,
|
||||||
|
password_key, NULL, identity,
|
||||||
EAP_CACHE_TEMPORARY);
|
EAP_CACHE_TEMPORARY);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -736,26 +749,37 @@ static bool eap_pwd_load_settings(struct eap_state *eap,
|
|||||||
const char *prefix)
|
const char *prefix)
|
||||||
{
|
{
|
||||||
struct eap_pwd_handle *pwd;
|
struct eap_pwd_handle *pwd;
|
||||||
char setting[64];
|
char setting_key[72];
|
||||||
|
|
||||||
pwd = l_new(struct eap_pwd_handle, 1);
|
pwd = l_new(struct eap_pwd_handle, 1);
|
||||||
|
|
||||||
pwd->state = EAP_PWD_STATE_INIT;
|
pwd->state = EAP_PWD_STATE_INIT;
|
||||||
|
|
||||||
snprintf(setting, sizeof(setting), "%sIdentity", prefix);
|
snprintf(setting_key, sizeof(setting_key), "%sIdentity", prefix);
|
||||||
pwd->identity = l_settings_get_string(settings, "Security", setting);
|
pwd->identity = l_settings_get_string(settings, "Security",
|
||||||
|
setting_key);
|
||||||
|
|
||||||
if (!pwd->identity) {
|
if (!pwd->identity) {
|
||||||
l_error("EAP-Identity is missing");
|
l_error("'%s' setting is missing", setting_key);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(setting, sizeof(setting), "%sPWD-Password", prefix);
|
snprintf(setting_key, sizeof(setting_key), "%sPassword", prefix);
|
||||||
pwd->password = l_settings_get_string(settings, "Security", setting);
|
pwd->password = l_settings_get_string(settings, "Security",
|
||||||
|
setting_key);
|
||||||
|
|
||||||
if (!pwd->password) {
|
if (!pwd->password) {
|
||||||
l_error("EAP-PWD password is missing");
|
snprintf(setting_key, sizeof(setting_key), "%sPWD-Password",
|
||||||
goto error;
|
prefix);
|
||||||
|
pwd->password = l_settings_get_string(settings, "Security",
|
||||||
|
setting_key);
|
||||||
|
|
||||||
|
if (!pwd->password) {
|
||||||
|
snprintf(setting_key, sizeof(setting_key), "%sPassword",
|
||||||
|
prefix);
|
||||||
|
l_error("'%s' setting is missing", setting_key);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eap_set_data(eap, pwd);
|
eap_set_data(eap, pwd);
|
||||||
@ -766,6 +790,7 @@ error:
|
|||||||
l_free(pwd->identity);
|
l_free(pwd->identity);
|
||||||
l_free(pwd->password);
|
l_free(pwd->password);
|
||||||
l_free(pwd);
|
l_free(pwd);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user