diff options
| author | Michael Biebl <biebl@debian.org> | 2019-12-18 18:29:24 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2019-12-18 18:29:24 +0100 |
| commit | 28028b26b3371756811e95d894f709f4b1207c00 (patch) | |
| tree | 6fe7316fd743b51042db47601a8ef8814b3134ac /libnm-core/nm-setting-wireless-security.c | |
| parent | e22609983008e1a669196ad64ba3a59ae8c76e0d (diff) | |
New upstream version 1.22.0 upstream/1.22.0
Diffstat (limited to 'libnm-core/nm-setting-wireless-security.c')
| -rw-r--r-- | libnm-core/nm-setting-wireless-security.c | 74 |
1 files changed, 17 insertions, 57 deletions
diff --git a/libnm-core/nm-setting-wireless-security.c b/libnm-core/nm-setting-wireless-security.c index efb4860b..a634546d 100644 --- a/libnm-core/nm-setting-wireless-security.c +++ b/libnm-core/nm-setting-wireless-security.c @@ -1,21 +1,7 @@ +// SPDX-License-Identifier: LGPL-2.1+ /* - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright 2007 - 2017 Red Hat, Inc. - * Copyright 2007 - 2008 Novell, Inc. + * Copyright (C) 2007 - 2017 Red Hat, Inc. + * Copyright (C) 2007 - 2008 Novell, Inc. */ #include "nm-default.h" @@ -849,9 +835,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 +884,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 +1009,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 +1427,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 @@ -1852,12 +1811,13 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + _nm_properties_override_gobj (properties_override, + obj_properties[PROP_WEP_KEY_TYPE], + NM_SETT_INFO_PROPERT_TYPE ( + .dbus_type = G_VARIANT_TYPE_UINT32, + .gprop_to_dbus_fcn = wep_key_type_to_dbus, + )); - _properties_override_add_transform (properties_override, - obj_properties[PROP_WEP_KEY_TYPE], - G_VARIANT_TYPE_UINT32, - wep_key_type_to_dbus, - NULL); /** * NMSettingWirelessSecurity:wps-method: * |