summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-07-15 11:30:27 +0000
committerLubomir Rintel <lkundrak@v3.sk>2019-07-25 12:31:19 +0200
commit5480ec853702787a39bba2eec4cc7d03d07600c2 (patch)
treec0175111d9656ae08af002cf25ce5d489f1093f9
parentf5cd641c05bc9ced749a39852cb5a59bcdf2154b (diff)
downloadNetworkManager-5480ec853702787a39bba2eec4cc7d03d07600c2.tar.gz
supplicant: reorganize the routine that sets key_mgmt a bit
This is functionally equivalent, it only makes it easier to plug in the FT enablement logic at a later point.
-rw-r--r--src/supplicant/nm-supplicant-config.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c
index 2fc898c9ea..0e20a2790a 100644
--- a/src/supplicant/nm-supplicant-config.c
+++ b/src/supplicant/nm-supplicant-config.c
@@ -754,7 +754,8 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self,
GError **error)
{
NMSupplicantConfigPrivate *priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self);
- const char *key_mgmt, *key_mgmt_conf, *auth_alg;
+ nm_auto_free_gstring GString *key_mgmt_conf = NULL;
+ const char *key_mgmt, *auth_alg;
const char *psk;
gboolean set_pmf;
@@ -773,28 +774,28 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self,
fils = NM_SETTING_WIRELESS_SECURITY_FILS_DISABLE;
}
- key_mgmt = key_mgmt_conf = nm_setting_wireless_security_get_key_mgmt (setting);
+ key_mgmt = nm_setting_wireless_security_get_key_mgmt (setting);
+ key_mgmt_conf = g_string_new (key_mgmt);
if (nm_streq (key_mgmt, "wpa-psk")) {
if (priv->support_pmf)
- key_mgmt_conf = "wpa-psk wpa-psk-sha256";
+ g_string_append (key_mgmt_conf, " wpa-psk-sha256");
} else if (nm_streq (key_mgmt, "wpa-eap")) {
+ if (priv->support_pmf)
+ g_string_append (key_mgmt_conf, " wpa-eap-sha256");
switch (fils) {
- case NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL:
- key_mgmt_conf = priv->support_pmf
- ? "wpa-eap wpa-eap-sha256 fils-sha256 fils-sha384"
- : "wpa-eap fils-sha256 fils-sha384";
- break;
case NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED:
- key_mgmt_conf = "fils-sha256 fils-sha384";
+ g_string_assign (key_mgmt_conf, "fils-sha256 fils-sha384");
break;
- default:
+ case NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL:
if (priv->support_pmf)
- key_mgmt_conf = "wpa-eap wpa-eap-sha256";
+ g_string_append (key_mgmt_conf, " fils-sha256 fils-sha384");
+ break;
+ default:
break;
}
}
- if (!add_string_val (self, key_mgmt_conf, "key_mgmt", TRUE, NULL, error))
+ if (!add_string_val (self, key_mgmt_conf->str, "key_mgmt", TRUE, NULL, error))
return FALSE;
auth_alg = nm_setting_wireless_security_get_auth_alg (setting);