From c97e0ce30b8b9b118d47d0e02e6ebe7556e9f0c4 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 19 Aug 2019 15:32:42 +0200 Subject: wifi: drop support for wpa-none key-mgmt NM didn't support wpa-none for years because kernel drivers used to be broken. Note that it wasn't even possible to *add* a connection with wpa-none because it was rejected in nm_settings_add_connection_dbus(). Given that wpa-none is also deprecated in wpa_supplicant and is considered insecure, drop altogether any reference to it. --- libnm-core/nm-setting-wireless-security.c | 43 ++++++------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'libnm-core/nm-setting-wireless-security.c') diff --git a/libnm-core/nm-setting-wireless-security.c b/libnm-core/nm-setting-wireless-security.c index efb4860be1..a3eb8a7ff3 100644 --- a/libnm-core/nm-setting-wireless-security.c +++ b/libnm-core/nm-setting-wireless-security.c @@ -849,9 +849,8 @@ need_secrets (NMSetting *setting) goto no_secrets; } - /* WPA-PSK infrastructure and adhoc */ - if ( (strcmp (priv->key_mgmt, "wpa-none") == 0) - || (strcmp (priv->key_mgmt, "wpa-psk") == 0)) { + /* WPA-PSK infrastructure */ + if (strcmp (priv->key_mgmt, "wpa-psk") == 0) { if (!nm_utils_wpa_psk_valid (priv->psk)) { g_ptr_array_add (secrets, NM_SETTING_WIRELESS_SECURITY_PSK); return secrets; @@ -899,7 +898,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) { NMSettingWirelessSecurity *self = NM_SETTING_WIRELESS_SECURITY (setting); NMSettingWirelessSecurityPrivate *priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (self); - const char *valid_key_mgmt[] = { "none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap", "sae", NULL }; + const char *valid_key_mgmt[] = { "none", "ieee8021x", "wpa-psk", "wpa-eap", "sae", NULL }; const char *valid_auth_algs[] = { "open", "shared", "leap", NULL }; const char *valid_protos[] = { "wpa", "rsn", NULL }; const char *valid_pairwise[] = { "tkip", "ccmp", NULL }; @@ -1024,33 +1023,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) } if (priv->pairwise) { - const char *wpa_none[] = { "wpa-none", NULL }; - - /* For ad-hoc connections, pairwise must be "none" */ - if (g_strv_contains (wpa_none, priv->key_mgmt)) { - GSList *iter; - gboolean found = FALSE; - - for (iter = priv->pairwise; iter; iter = g_slist_next (iter)) { - if (!strcmp ((char *) iter->data, "none")) { - found = TRUE; - break; - } - } - - /* pairwise cipher list didn't contain "none", which is invalid - * for WPA adhoc connections. - */ - if (!found) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("'%s' connections require '%s' in this property"), - NM_SETTING_WIRELESS_MODE_ADHOC, "none"); - g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PAIRWISE); - return FALSE; - } - } else if (!_nm_utils_string_slist_validate (priv->pairwise, valid_pairwise)) { + if (!_nm_utils_string_slist_validate (priv->pairwise, valid_pairwise)) { g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, @@ -1468,10 +1441,10 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *klass) /** * NMSettingWirelessSecurity:key-mgmt: * - * Key management used for the connection. One of "none" (WEP), "ieee8021x" - * (Dynamic WEP), "wpa-none" (Ad-Hoc WPA-PSK), "wpa-psk" (infrastructure - * WPA-PSK), "sae" (SAE) or "wpa-eap" (WPA-Enterprise). - * This property must be set for any Wi-Fi connection that uses security. + * Key management used for the connection. One of "none" (WEP), + * "ieee8021x" (Dynamic WEP), "wpa-psk" (infrastructure WPA-PSK), "sae" + * (SAE) or "wpa-eap" (WPA-Enterprise). This property must be set for + * any Wi-Fi connection that uses security. **/ /* ---ifcfg-rh--- * property: key-mgmt -- cgit v1.2.1