70 lines
2.6 KiB
Diff
70 lines
2.6 KiB
Diff
From 5480ec853702787a39bba2eec4cc7d03d07600c2 Mon Sep 17 00:00:00 2001
|
|
From: Lubomir Rintel <lkundrak@v3.sk>
|
|
Date: Mon, 15 Jul 2019 11:30:27 +0000
|
|
Subject: [PATCH 4/7] 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.
|
|
---
|
|
src/supplicant/nm-supplicant-config.c | 25 +++++++++++++------------
|
|
1 file changed, 13 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c
|
|
index 2fc898c9e..0e20a2790 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);
|
|
--
|
|
2.17.1
|
|
|