summaryrefslogtreecommitdiff
path: root/src/libnm-core-impl/nm-setting-wireless-security.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnm-core-impl/nm-setting-wireless-security.c')
-rw-r--r--src/libnm-core-impl/nm-setting-wireless-security.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/libnm-core-impl/nm-setting-wireless-security.c b/src/libnm-core-impl/nm-setting-wireless-security.c
index e5e6b979f4..47a9ca3286 100644
--- a/src/libnm-core-impl/nm-setting-wireless-security.c
+++ b/src/libnm-core-impl/nm-setting-wireless-security.c
@@ -904,33 +904,32 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if (g_strcmp0(wifi_mode, NM_SETTING_WIRELESS_MODE_MESH) == 0) {
- if ((strcmp(priv->key_mgmt, "none") == 0) || (strcmp(priv->key_mgmt, "sae") == 0)) {
- g_set_error(error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("'%s' is not a valid value for '%s' mode connections"),
- priv->key_mgmt,
- NM_SETTING_WIRELESS_MODE_MESH);
- g_prefix_error(error,
- "%s.%s: ",
- NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
- NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
- return FALSE;
- }
- } else {
- if (!g_strv_contains(valid_key_mgmt, priv->key_mgmt)) {
- g_set_error(error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("'%s' is not a valid value for the property"),
- priv->key_mgmt);
- g_prefix_error(error,
- "%s.%s: ",
- NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
- NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
- return FALSE;
- }
+ if (!g_strv_contains(valid_key_mgmt, priv->key_mgmt)) {
+ g_set_error(error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s' is not a valid value for the property"),
+ priv->key_mgmt);
+ g_prefix_error(error,
+ "%s.%s: ",
+ NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
+ return FALSE;
+ }
+
+ if (NM_IN_STRSET(wifi_mode, NM_SETTING_WIRELESS_MODE_MESH)
+ && !NM_IN_STRSET(priv->key_mgmt, "none", "sae")) {
+ g_set_error(error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s' is not a valid value for '%s' mode connections"),
+ priv->key_mgmt,
+ NM_SETTING_WIRELESS_MODE_MESH);
+ g_prefix_error(error,
+ "%s.%s: ",
+ NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+ NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
+ return FALSE;
}
if (priv->auth_alg && !strcmp(priv->auth_alg, "leap")) {