summaryrefslogtreecommitdiff
path: root/src/devices/wifi
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-20 13:52:23 -0400
committerDan Winship <danw@gnome.org>2014-10-22 08:29:07 -0400
commit2d8e7bd2476011e7b156d6365b28a78a3ecd84bf (patch)
tree72967281ffe2f06ad97c3d4f02425f2d1ab2e611 /src/devices/wifi
parentaeb3d093f66aea3c5bf7e235226bdb0431cf9a9a (diff)
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them had exactly the same three errors ("unknown", "missing property", and "invalid property"), and none of the other values was of much use programmatically anyway. So, this commit merges NMSettingError, NMSettingAdslError, etc, all into NMConnectionError. (The reason for merging into NMConnectionError rather than NMSettingError is that we also already have "NMSettingsError", for errors related to the settings service, so "NMConnectionError" is a less-confusable name for settings/connection errors than "NMSettingError".) Also, make sure that all of the affected error messages are localized, and (where appropriate) prefix them with the relevant property name. Renamed error codes: NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET Remapped error codes: NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY Dropped error codes (were previously defined but unused): NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
Diffstat (limited to 'src/devices/wifi')
-rw-r--r--src/devices/wifi/nm-device-wifi.c16
-rw-r--r--src/devices/wifi/nm-wifi-ap-utils.c292
-rw-r--r--src/devices/wifi/tests/test-wifi-ap-utils.c118
3 files changed, 253 insertions, 173 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index cf5a4f631..3441ae3a7 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -1107,9 +1107,10 @@ complete_connection (NMDevice *device,
*/
if (is_adhoc_wpa (connection)) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_ERROR,
- NM_SETTING_WIRELESS_ERROR_INVALID_PROPERTY,
- "WPA Ad-Hoc disabled due to kernel bugs");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("WPA Ad-Hoc disabled due to kernel bugs"));
+ g_prefix_error (error, "%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
if (tmp_ssid)
g_byte_array_unref (tmp_ssid);
return FALSE;
@@ -1136,10 +1137,11 @@ complete_connection (NMDevice *device,
if (setting_mac) {
/* Make sure the setting MAC (if any) matches the device's permanent MAC */
if (!nm_utils_hwaddr_matches (setting_mac, -1, priv->perm_hw_addr, -1)) {
- g_set_error (error,
- NM_SETTING_WIRELESS_ERROR,
- NM_SETTING_WIRELESS_ERROR_INVALID_PROPERTY,
- NM_SETTING_WIRELESS_MAC_ADDRESS);
+ g_set_error_literal (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("connection does not match device"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_MAC_ADDRESS);
return FALSE;
}
} else {
diff --git a/src/devices/wifi/nm-wifi-ap-utils.c b/src/devices/wifi/nm-wifi-ap-utils.c
index 19d8307e6..85d76d218 100644
--- a/src/devices/wifi/nm-wifi-ap-utils.c
+++ b/src/devices/wifi/nm-wifi-ap-utils.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*-*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,6 +22,8 @@
#include <string.h>
#include <stdlib.h>
+#include <glib/gi18n.h>
+
#include "nm-wifi-ap-utils.h"
#include "nm-utils.h"
@@ -36,9 +38,10 @@ verify_no_wep (NMSettingWirelessSecurity *s_wsec, const char *tag, GError **erro
|| nm_setting_wireless_security_get_wep_key_type (s_wsec)) {
/* Dynamic WEP cannot have any WEP keys set */
g_set_error (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "%s is incompatible with static WEP keys", tag);
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("%s is incompatible with static WEP keys"), tag);
+ g_prefix_error (error, "%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
return FALSE;
}
@@ -69,17 +72,21 @@ verify_leap (NMSettingWirelessSecurity *s_wsec,
/* LEAP authentication requires at least a LEAP username */
if (!leap_username) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME,
- "LEAP requires a LEAP username");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_MISSING_PROPERTY,
+ _("LEAP authentication requires a LEAP username"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
return FALSE;
}
} else if (leap_username) {
/* Leap username requires 'leap' auth */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "LEAP requires 'leap' authentication");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("LEAP username requires 'leap' authentication"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
return FALSE;
}
}
@@ -88,9 +95,11 @@ verify_leap (NMSettingWirelessSecurity *s_wsec,
if (key_mgmt && strcmp (key_mgmt, "ieee8021x")) {
/* LEAP requires ieee8021x key management */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X,
- "LEAP requires IEEE 802.1x key management");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("LEAP authentication requires IEEE 802.1x key management"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
return FALSE;
}
}
@@ -106,9 +115,10 @@ verify_leap (NMSettingWirelessSecurity *s_wsec,
if (adhoc) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "LEAP incompatible with Ad-Hoc mode");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("LEAP authentication is incompatible with Ad-Hoc mode"));
+ g_prefix_error (error, "%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
return FALSE;
}
@@ -117,9 +127,10 @@ verify_leap (NMSettingWirelessSecurity *s_wsec,
if (s_8021x) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME,
- "LEAP incompatible with 802.1x setting");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("LEAP authentication is incompatible with 802.1x setting"));
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
}
@@ -138,17 +149,23 @@ verify_no_wpa (NMSettingWirelessSecurity *s_wsec,
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec);
if (key_mgmt && !strncmp (key_mgmt, "wpa", 3)) {
g_set_error (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "%s incompatible with any WPA key management", tag);
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("a connection using '%s' authentication cannot use WPA key management"),
+ tag);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
return FALSE;
}
if (nm_setting_wireless_security_get_num_protos (s_wsec)) {
g_set_error (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "%s incompatible with any 'proto' setting", tag);
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("a connection using '%s' authentication cannot specific WPA protocols"),
+ tag);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_PROTO);
return FALSE;
}
@@ -159,9 +176,12 @@ verify_no_wpa (NMSettingWirelessSecurity *s_wsec,
pw = nm_setting_wireless_security_get_pairwise (s_wsec, i);
if (!strcmp (pw, "tkip") || !strcmp (pw, "ccmp")) {
g_set_error (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "%s is incompatible with WPA pairwise ciphers", tag);
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("a connection using '%s' authentication cannot specific WPA ciphers"),
+ tag);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
return FALSE;
}
}
@@ -173,18 +193,24 @@ verify_no_wpa (NMSettingWirelessSecurity *s_wsec,
gr = nm_setting_wireless_security_get_group (s_wsec, i);
if (strcmp (gr, "wep40") && strcmp (gr, "wep104")) {
g_set_error (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "%s is incompatible with WPA group ciphers", tag);
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("a connection using '%s' authentication cannot specific WPA ciphers"),
+ tag);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_GROUP);
return FALSE;
}
}
if (nm_setting_wireless_security_get_psk (s_wsec)) {
g_set_error (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "%s is incompatible with a WPA Pre-Shared Key", tag);
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("a connection using '%s' authentication cannot specific a WPA password"),
+ tag);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_PSK);
return FALSE;
}
@@ -210,18 +236,21 @@ verify_dynamic_wep (NMSettingWirelessSecurity *s_wsec,
if (!s_8021x) {
/* 802.1x key management requires an 802.1x setting */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Dynamic WEP requires an 802.1x setting");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_MISSING_SETTING,
+ _("Dynamic WEP requires an 802.1x setting"));
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
if (auth_alg && strcmp (auth_alg, "open")) {
/* 802.1x key management must use "open" authentication */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Dynamic WEP requires 'open' authentication");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Dynamic WEP requires 'open' authentication"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
return FALSE;
}
@@ -232,9 +261,11 @@ verify_dynamic_wep (NMSettingWirelessSecurity *s_wsec,
if (s_8021x) {
/* 802.1x setting requires 802.1x key management */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Dynamic WEP requires 'ieee8021x' key management");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Dynamic WEP requires 'ieee8021x' key management"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
return FALSE;
}
}
@@ -243,9 +274,11 @@ verify_dynamic_wep (NMSettingWirelessSecurity *s_wsec,
if (auth_alg && strcmp (auth_alg, "open")) {
/* 802.1x key management must use "open" authentication */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Dynamic WEP requires 'open' authentication");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Dynamic WEP requires 'open' authentication"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
return FALSE;
}
@@ -275,18 +308,21 @@ verify_wpa_psk (NMSettingWirelessSecurity *s_wsec,
if (!strcmp (key_mgmt, "wpa-psk") || !strcmp (key_mgmt, "wpa-none")) {
if (s_8021x) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA-PSK incompatible with 802.1x");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("WPA-PSK authentication is incompatible with 802.1x"));
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
if (auth_alg && strcmp (auth_alg, "open")) {
/* WPA must use "open" authentication */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA-PSK requires 'open' authentication");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA-PSK requires 'open' authentication"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
return FALSE;
}
}
@@ -294,9 +330,11 @@ verify_wpa_psk (NMSettingWirelessSecurity *s_wsec,
if (!strcmp (key_mgmt, "wpa-none")) {
if (!adhoc) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA Ad-Hoc requires an Ad-Hoc mode AP");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA Ad-Hoc authentication requires an Ad-Hoc mode AP"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SETTING_NAME,
+ NM_SETTING_WIRELESS_MODE);
return FALSE;
}
@@ -305,9 +343,11 @@ verify_wpa_psk (NMSettingWirelessSecurity *s_wsec,
tmp = (n > 0) ? nm_setting_wireless_security_get_proto (s_wsec, 0) : NULL;
if (n > 1 || !tmp || strcmp (tmp, "wpa")) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA Ad-Hoc requires 'wpa' proto");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA Ad-Hoc authentication requires 'wpa' protocol"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_PROTO);
return FALSE;
}
@@ -315,9 +355,11 @@ verify_wpa_psk (NMSettingWirelessSecurity *s_wsec,
tmp = (n > 0) ? nm_setting_wireless_security_get_pairwise (s_wsec, 0) : NULL;
if (n > 1 || g_strcmp0 (tmp, "none")) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA Ad-Hoc requires 'none' pairwise cipher");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA Ad-Hoc authentication requires 'none' pairwise cipher"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
return FALSE;
}
@@ -325,9 +367,11 @@ verify_wpa_psk (NMSettingWirelessSecurity *s_wsec,
tmp = (n > 0) ? nm_setting_wireless_security_get_group (s_wsec, 0) : NULL;
if (n > 1 || !tmp || strcmp (tmp, "tkip")) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA Ad-Hoc requires 'tkip' group cipher");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA Ad-Hoc requires 'tkip' group cipher"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_GROUP);
return FALSE;
}
}
@@ -337,9 +381,11 @@ verify_wpa_psk (NMSettingWirelessSecurity *s_wsec,
if ( !(wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
&& !(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "AP does not support PSK but setting requires it");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Access point does not support PSK but setting requires it"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
return FALSE;
}
}
@@ -365,27 +411,31 @@ verify_wpa_eap (NMSettingWirelessSecurity *s_wsec,
if (!strcmp (key_mgmt, "wpa-eap")) {
if (!s_8021x) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA-EAP requires an 802.1x setting");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_MISSING_SETTING,
+ _("WPA-EAP authentication requires an 802.1x setting"));
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
if (auth_alg && strcmp (auth_alg, "open")) {
/* WPA must use "open" authentication */
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA-EAP requires 'open' authentication");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA-EAP requires 'open' authentication"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
return FALSE;
}
is_wpa_eap = TRUE;
} else if (s_8021x) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Setting requires 802.1x but does not use 'wpa-eap' key management");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("802.1x setting requires 'wpa-eap' key management"));
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
}
@@ -395,9 +445,10 @@ verify_wpa_eap (NMSettingWirelessSecurity *s_wsec,
if ( !(wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
&& !(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "AP does not support 802.1x but setting requires it");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("Access point does not support 802.1x but setting requires it"));
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
}
@@ -422,41 +473,50 @@ verify_adhoc (NMSettingWirelessSecurity *s_wsec,
if (adhoc) {
if (key_mgmt && strcmp (key_mgmt, "wpa-none") && strcmp (key_mgmt, "none")) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "AP mode is Ad-Hoc but setting requires Infrastructure security");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Access point mode is Ad-Hoc but setting requires Infrastructure security"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
return FALSE;
}
if (s_8021x) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Ad-Hoc mode incompatible with 802.1x security");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("Ad-Hoc mode is incompatible with 802.1x security"));
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
if (leap_username) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Ad-Hoc mode incompatible with LEAP security");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Ad-Hoc mode is incompatible with LEAP security"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
return FALSE;
}
if (auth_alg && strcmp (auth_alg, "open")) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Ad-Hoc mode requires 'open' authentication");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Ad-Hoc mode requires 'open' authentication"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
return FALSE;
}
} else {
if (key_mgmt && !strcmp (key_mgmt, "wpa-none")) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "AP mode is Infrastructure but setting requires Ad-Hoc security");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("Access point mode is Infrastructure but setting requires Ad-Hoc security"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
return FALSE;
}
}
@@ -494,9 +554,10 @@ nm_ap_utils_complete_connection (const GByteArray *ap_ssid,
g_object_set (G_OBJECT (s_wifi), NM_SETTING_WIRELESS_SSID, ap_ssid_bytes, NULL);
else if (!g_bytes_equal (ssid, ap_ssid_bytes)) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_ERROR,
- NM_SETTING_WIRELESS_ERROR_INVALID_PROPERTY,
- "Setting SSID did not match AP SSID");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("connection does not match access point"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_SSID);
g_bytes_unref (ap_ssid_bytes);
return FALSE;
}
@@ -523,9 +584,10 @@ nm_ap_utils_complete_connection (const GByteArray *ap_ssid,
if (valid == FALSE) {
g_set_error (error,
- NM_SETTING_WIRELESS_ERROR,
- NM_SETTING_WIRELESS_ERROR_INVALID_PROPERTY,
- NM_SETTING_WIRELESS_MODE);
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("connection does not match access point"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_MODE);
return FALSE;
}
} else {
@@ -546,9 +608,13 @@ nm_ap_utils_complete_connection (const GByteArray *ap_ssid,
/* Make sure the connection doesn't specify security */
if (s_wsec || s_8021x) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "AP is unencrypted but setting specifies security");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ _("Access point is unencrypted but setting specifies security"));
+ if (s_wsec)
+ g_prefix_error (error, "%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
+ else
+ g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
return FALSE;
}
return TRUE;
@@ -631,18 +697,20 @@ nm_ap_utils_complete_connection (const GByteArray *ap_ssid,
/* Ensure key management is valid for WPA */
if ((key_mgmt && !strcmp (key_mgmt, "ieee8021x")) || leap_username) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA incompatible with non-EAP (original) LEAP or Dynamic WEP");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA authentication is incompatible with non-EAP (original) LEAP or Dynamic WEP"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
return FALSE;
}
/* 'shared' auth incompatible with any type of WPA */
if (auth_alg && strcmp (auth_alg, "open")) {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "WPA incompatible with Shared Key authentication");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("WPA authentication is incompatible with Shared Key authentication"));
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
return FALSE;
}
@@ -686,9 +754,9 @@ nm_ap_utils_complete_connection (const GByteArray *ap_ssid,
*/
} else {
g_set_error_literal (error,
- NM_SETTING_WIRELESS_SECURITY_ERROR,
- NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
- "Failed to determine AP security information");
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_FAILED,
+ _("Failed to determine AP security information"));
return FALSE;
}
diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c
index 9ca49e488..8a1772293 100644
--- a/src/devices/wifi/tests/test-wifi-ap-utils.c
+++ b/src/devices/wifi/tests/test-wifi-ap-utils.c
@@ -327,7 +327,7 @@ test_open_ap_leap_connection_1 (gconstpointer add_wifi)
FALSE,
src, &error);
/* We expect failure */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_SETTING);
g_object_unref (src);
}
@@ -357,7 +357,7 @@ test_open_ap_leap_connection_2 (void)
FALSE,
src, &error);
/* We expect failure */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_SETTING);
g_object_unref (src);
}
@@ -391,7 +391,7 @@ test_open_ap_wep_connection (gconstpointer add_wifi)
FALSE,
src, &error);
/* We expect failure */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_SETTING);
g_object_unref (src);
}
@@ -405,6 +405,7 @@ test_ap_wpa_psk_connection_base (const char *key_mgmt,
guint32 wpa_flags,
guint32 rsn_flags,
gboolean add_wifi,
+ guint error_code,
NMConnection *expected)
{
NMConnection *src;
@@ -433,7 +434,7 @@ test_ap_wpa_psk_connection_base (const char *key_mgmt,
fill_wifi (expected, exp_wifi);
fill_wsec (expected, both_wsec);
}
- COMPARE (src, expected, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, expected, success, error, NM_CONNECTION_ERROR, error_code);
g_object_unref (src);
}
@@ -449,7 +450,9 @@ test_open_ap_wpa_psk_connection_1 (void)
NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ NULL);
}
static void
@@ -463,7 +466,9 @@ test_open_ap_wpa_psk_connection_2 (void)
NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- TRUE, NULL);
+ TRUE,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ NULL);
}
static void
@@ -476,7 +481,9 @@ test_open_ap_wpa_psk_connection_3 (void)
NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ NULL);
}
static void
@@ -490,7 +497,9 @@ test_open_ap_wpa_psk_connection_4 (void)
NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ NULL);
}
static void
@@ -503,7 +512,9 @@ test_open_ap_wpa_psk_connection_5 (void)
NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_SETTING,
+ NULL);
}
/*******************************************/
@@ -515,7 +526,6 @@ test_ap_wpa_eap_connection_base (const char *key_mgmt,
guint32 wpa_flags,
guint32 rsn_flags,
gboolean add_wifi,
- guint error_domain,
guint error_code)
{
NMConnection *src;
@@ -537,7 +547,7 @@ test_ap_wpa_eap_connection_base (const char *key_mgmt,
flags, wpa_flags, rsn_flags,
FALSE, src, &error);
/* Failure expected */
- COMPARE (src, NULL, success, error, error_domain, error_code);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, error_code);
g_object_unref (src);
}
@@ -614,37 +624,22 @@ rsn_flags_for_idx (guint32 idx)
}
static guint32
-error_domain_for_idx (guint32 idx, guint num)
-{
- if (idx == IDX_OPEN)
- return NM_SETTING_WIRELESS_SECURITY_ERROR;
- else if (idx == IDX_PRIV) {
- if (num <= 3)
- return NM_SETTING_802_1X_ERROR;
- else
- return NM_SETTING_WIRELESS_SECURITY_ERROR;
- } else if (idx == IDX_WPA_PSK_PTKIP_GTKIP || idx == IDX_WPA_PSK_PTKIP_PCCMP_GTKIP
- || idx == IDX_WPA_RSN_PSK_PCCMP_GCCMP || idx == IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP
- || idx == IDX_RSN_PSK_PTKIP_PCCMP_GTKIP || idx == IDX_RSN_PSK_PCCMP_GCCMP)
- return NM_SETTING_WIRELESS_SECURITY_ERROR;
- else
- g_assert_not_reached ();
-}
-
-static guint32
error_code_for_idx (guint32 idx, guint num)
{
if (idx == IDX_OPEN)
- return NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY;
+ return NM_CONNECTION_ERROR_INVALID_SETTING;
else if (idx == IDX_PRIV) {
if (num <= 3)
- return NM_SETTING_802_1X_ERROR_MISSING_PROPERTY;
+ return NM_CONNECTION_ERROR_MISSING_PROPERTY;
else
- return NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY;
- } else if (idx == IDX_WPA_PSK_PTKIP_GTKIP || idx == IDX_WPA_PSK_PTKIP_PCCMP_GTKIP
+ return NM_CONNECTION_ERROR_INVALID_PROPERTY;
+ } else if ( idx == IDX_WPA_PSK_PTKIP_GTKIP || idx == IDX_WPA_PSK_PTKIP_PCCMP_GTKIP
|| idx == IDX_WPA_RSN_PSK_PCCMP_GCCMP || idx == IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP
|| idx == IDX_RSN_PSK_PTKIP_PCCMP_GTKIP || idx == IDX_RSN_PSK_PCCMP_GCCMP)
- return NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY;
+ if (num == 4)
+ return NM_CONNECTION_ERROR_INVALID_PROPERTY;
+ else
+ return NM_CONNECTION_ERROR_INVALID_SETTING;
else
g_assert_not_reached ();
}
@@ -659,7 +654,6 @@ test_ap_wpa_eap_connection_1 (gconstpointer data)
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
FALSE,
- error_domain_for_idx (idx, 1),
error_code_for_idx (idx, 1));
}
@@ -673,7 +667,6 @@ test_ap_wpa_eap_connection_2 (gconstpointer data)
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
TRUE,
- error_domain_for_idx (idx, 2),
error_code_for_idx (idx, 2));
}
@@ -687,7 +680,6 @@ test_ap_wpa_eap_connection_3 (gconstpointer data)
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
FALSE,
- error_domain_for_idx (idx, 3),
error_code_for_idx (idx, 3));
}
@@ -701,7 +693,6 @@ test_ap_wpa_eap_connection_4 (gconstpointer data)
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
FALSE,
- error_domain_for_idx (idx, 4),
error_code_for_idx (idx, 4));
}
@@ -715,7 +706,6 @@ test_ap_wpa_eap_connection_5 (gconstpointer data)
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
FALSE,
- error_domain_for_idx (idx, 5),
error_code_for_idx (idx, 5));
}
@@ -827,7 +817,7 @@ test_priv_ap_leap_connection_2 (void)
FALSE,
src, &error);
/* We expect failure here, we need a LEAP username */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_MISSING_PROPERTY);
g_object_unref (src);
}
@@ -959,7 +949,7 @@ test_priv_ap_dynamic_wep_3 (void)
FALSE,
src, &error);
/* Expect failure; shared is not compatible with dynamic WEP */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY);
g_object_unref (src);
}
@@ -977,7 +967,9 @@ test_priv_ap_wpa_psk_connection_1 (void)
NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ NULL);
}
static void
@@ -991,7 +983,9 @@ test_priv_ap_wpa_psk_connection_2 (void)
NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- TRUE, NULL);
+ TRUE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ NULL);
}
static void
@@ -1006,7 +1000,9 @@ test_priv_ap_wpa_psk_connection_3 (void)
NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ NULL);
}
static void
@@ -1021,7 +1017,9 @@ test_priv_ap_wpa_psk_connection_4 (void)
NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ NULL);
}
static void
@@ -1036,7 +1034,9 @@ test_priv_ap_wpa_psk_connection_5 (void)
NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_SEC_NONE,
NM_802_11_AP_SEC_NONE,
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ NULL);
}
/*******************************************/
@@ -1107,7 +1107,7 @@ test_wpa_ap_leap_connection_1 (gconstpointer data)
FALSE,
src, &error);
/* Expect failure here; WPA APs don't support old-school LEAP */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY);
g_object_unref (src);
}
@@ -1141,7 +1141,7 @@ test_wpa_ap_leap_connection_2 (gconstpointer data)
FALSE,
src, &error);
/* We expect failure here, we need a LEAP username */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY);
g_object_unref (src);
}
@@ -1174,7 +1174,7 @@ test_wpa_ap_dynamic_wep_connection (gconstpointer data)
FALSE,
src, &error);
/* We expect failure here since Dynamic WEP is incompatible with WPA */
- COMPARE (src, NULL, success, error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY);
+ COMPARE (src, NULL, success, error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY);
g_object_unref (src);
}
@@ -1197,7 +1197,9 @@ test_wpa_ap_wpa_psk_connection_1 (gconstpointer data)
NM_802_11_AP_FLAGS_PRIVACY,
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
- FALSE, expected);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ expected);
g_object_unref (expected);
}
@@ -1217,7 +1219,9 @@ test_wpa_ap_wpa_psk_connection_2 (gconstpointer data)
NM_802_11_AP_FLAGS_PRIVACY,
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
- TRUE, expected);
+ TRUE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ expected);
g_object_unref (expected);
}
@@ -1237,7 +1241,9 @@ test_wpa_ap_wpa_psk_connection_3 (gconstpointer data)
NM_802_11_AP_FLAGS_PRIVACY,
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
- FALSE, expected);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ expected);
g_object_unref (expected);
}
@@ -1249,7 +1255,9 @@ test_wpa_ap_wpa_psk_connection_4 (gconstpointer data)
NM_802_11_AP_FLAGS_PRIVACY,
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
- FALSE, NULL);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ NULL);
}
static void
@@ -1268,7 +1276,9 @@ test_wpa_ap_wpa_psk_connection_5 (gconstpointer data)
NM_802_11_AP_FLAGS_PRIVACY,
wpa_flags_for_idx (idx),
rsn_flags_for_idx (idx),
- FALSE, expected);
+ FALSE,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ expected);
g_object_unref (expected);
}