summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-18 16:56:47 +0100
committerThomas Haller <thaller@redhat.com>2021-02-02 16:37:02 +0100
commitade0f1b7e1a29090f97a90357d0300a8d07fd932 (patch)
tree12caa658bf339f2b07a5e048609e322ba8059854
parent297610d0c5b21b51d3bdf606317dd701a7e6524a (diff)
downloadnetwork-manager-applet-ade0f1b7e1a29090f97a90357d0300a8d07fd932.tar.gz
all: add compat defines for NMU_SEC_SAE,NMU_SEC_OWE
https://gitlab.gnome.org/GNOME/network-manager-applet/-/merge_requests/91
-rw-r--r--shared/nm-libnm-compat.h12
-rw-r--r--src/ap-menu-item.c8
-rw-r--r--src/connection-editor/page-wifi-security.c14
3 files changed, 13 insertions, 21 deletions
diff --git a/shared/nm-libnm-compat.h b/shared/nm-libnm-compat.h
index 9cfac52b..8f8de685 100644
--- a/shared/nm-libnm-compat.h
+++ b/shared/nm-libnm-compat.h
@@ -28,4 +28,16 @@
G_GNUC_END_IGNORE_DEPRECATIONS \
})
+#define _NMU_SEC_SAE ((NMUtilsSecurityType) 9)
+#if !NM_CHECK_VERSION (1,22,0)
+#define NMU_SEC_SAE _NMU_SEC_SAE
+#endif
+G_STATIC_ASSERT(NMU_SEC_SAE == _NMU_SEC_SAE);
+
+#define _NMU_SEC_OWE ((NMUtilsSecurityType) 10)
+#if !NM_CHECK_VERSION (1,24,0)
+#define NMU_SEC_OWE _NMU_SEC_OWE
+#endif
+G_STATIC_ASSERT(NMU_SEC_OWE == _NMU_SEC_OWE);
+
#endif /* __NM_LIBNM_COMPAT_H__ */
diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c
index 8e957e92..1da010fa 100644
--- a/src/ap-menu-item.c
+++ b/src/ap-menu-item.c
@@ -291,15 +291,9 @@ nm_network_menu_item_new (NMAccessPoint *ap,
&& !nm_utils_security_valid (NMU_SEC_WPA2_PSK, dev_caps, TRUE, priv->is_adhoc, ap_flags, ap_wpa, ap_rsn)
&& !nm_utils_security_valid (NMU_SEC_WPA_ENTERPRISE, dev_caps, TRUE, priv->is_adhoc, ap_flags, ap_wpa, ap_rsn)
&& !nm_utils_security_valid (NMU_SEC_WPA2_ENTERPRISE, dev_caps, TRUE, priv->is_adhoc, ap_flags, ap_wpa, ap_rsn)
-#if NM_CHECK_VERSION(1,24,0)
&& !nm_utils_security_valid (NMU_SEC_OWE, dev_caps, TRUE, priv->is_adhoc, ap_flags, ap_wpa, ap_rsn)
-#endif
-#if NM_CHECK_VERSION(1,22,0)
- && !nm_utils_security_valid (NMU_SEC_SAE, dev_caps, TRUE, priv->is_adhoc, ap_flags, ap_wpa, ap_rsn)
-#endif
- ) {
+ && !nm_utils_security_valid (NMU_SEC_SAE, dev_caps, TRUE, priv->is_adhoc, ap_flags, ap_wpa, ap_rsn))
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
- }
update_label (item, FALSE);
update_icon (item, applet);
diff --git a/src/connection-editor/page-wifi-security.c b/src/connection-editor/page-wifi-security.c
index 41e2ccdc..e8c9d7e2 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -129,15 +129,11 @@ get_default_type_for_security (NMSettingWirelessSecurity *sec)
return NMU_SEC_WPA_ENTERPRISE;
}
-#if NM_CHECK_VERSION(1,22,0)
if (!strcmp (key_mgmt, "sae"))
return NMU_SEC_SAE;
-#endif
-#if NM_CHECK_VERSION(1,24,0)
if (!strcmp (key_mgmt, "owe"))
return NMU_SEC_OWE;
-#endif
return NMU_SEC_INVALID;
}
@@ -273,10 +269,6 @@ security_valid (NMUtilsSecurityType sectype, NM80211Mode mode)
switch (mode) {
case NM_802_11_MODE_AP:
-#if NM_CHECK_VERSION(1,22,0)
- if (sectype == NMU_SEC_SAE)
- return TRUE;
-#endif
return nm_utils_ap_mode_security_valid (sectype, NM_WIFI_DEVICE_CAP_AP);
case NM_802_11_MODE_ADHOC:
case NM_802_11_MODE_INFRA:
@@ -420,7 +412,6 @@ finish_setup (CEPageWifiSecurity *self, gpointer user_data)
}
}
-#if NM_CHECK_VERSION(1,22,0)
if (security_valid (NMU_SEC_SAE, mode)) {
NMAWsSae *ws_sae;
@@ -433,9 +424,7 @@ finish_setup (CEPageWifiSecurity *self, gpointer user_data)
item++;
}
}
-#endif
-#if NM_CHECK_VERSION(1,24,0)
if (security_valid (NMU_SEC_OWE, mode)) {
gtk_list_store_append (sec_model, &iter);
gtk_list_store_set (sec_model, &iter,
@@ -447,7 +436,6 @@ finish_setup (CEPageWifiSecurity *self, gpointer user_data)
active = item;
item++;
}
-#endif
combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "wifi_security_combo"));
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (sec_model));
@@ -513,9 +501,7 @@ ce_page_wifi_security_new (NMConnectionEditor *editor,
/* Get secrets if the connection is not 802.1X enabled */
if ( default_type == NMU_SEC_STATIC_WEP
|| default_type == NMU_SEC_LEAP
-#if NM_CHECK_VERSION(1,22,0)
|| default_type == NMU_SEC_SAE
-#endif
|| default_type == NMU_SEC_WPA_PSK
|| default_type == NMU_SEC_WPA2_PSK) {
*out_secrets_setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;