[network-manager-applet/th/sec-type-compat] all: add compat defines for NMU_SEC_SAE, NMU_SEC_OWE
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/th/sec-type-compat] all: add compat defines for NMU_SEC_SAE, NMU_SEC_OWE
- Date: Wed, 18 Nov 2020 15:59:42 +0000 (UTC)
commit 7366f7d23b5a6dbb6080dc7593988fe6dc714d73
Author: Thomas Haller <thaller redhat com>
Date: Wed Nov 18 16:56:47 2020 +0100
all: add compat defines for NMU_SEC_SAE,NMU_SEC_OWE
shared/nm-libnm-compat.h | 12 ++++++++++++
src/ap-menu-item.c | 8 +-------
src/connection-editor/page-wifi-security.c | 14 --------------
3 files changed, 13 insertions(+), 21 deletions(-)
---
diff --git a/shared/nm-libnm-compat.h b/shared/nm-libnm-compat.h
index 9cfac52bc..82e0c3768 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 8e957e925..1da010faf 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 41e2ccdc8..e8c9d7e2a 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]