summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-03-08 15:38:50 +0100
committerLubomir Rintel <lkundrak@v3.sk>2022-03-21 13:51:52 +0100
commitb8a8593a6d2e3cdcd4a171cf89319992b23ea579 (patch)
tree4bf470356e2dd7c63906fedfd9febf2765fca194
parent41e602a9d75ef121f8a785963bd3d95d2f58ddcd (diff)
downloadnetwork-manager-applet-b8a8593a6d2e3cdcd4a171cf89319992b23ea579.tar.gz
editor: do not provide WEP by defaultlr/editor-no-wep
Allow editing existing WEP profiles, but don't offer it for new ones. Add a chicken bit for turning it back on, if necessary.
-rw-r--r--src/connection-editor/page-wifi-security.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/connection-editor/page-wifi-security.c b/src/connection-editor/page-wifi-security.c
index 5260d08c..ae0e1cd0 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -282,6 +282,13 @@ security_valid (NMUtilsSecurityType sectype, NM80211Mode mode)
g_assert_not_reached ();
}
+static gboolean
+allow_wep (void)
+{
+ /* Note to whoever uses this: this might go away! */
+ return !!getenv ("NM_ALLOW_INSECURE_WEP");
+}
+
static void
finish_setup (CEPageWifiSecurity *self, gpointer user_data)
{
@@ -340,24 +347,31 @@ finish_setup (CEPageWifiSecurity *self, gpointer user_data)
wep_type = NM_WEP_KEY_TYPE_KEY;
}
- ws_wep = nma_ws_wep_key_new (connection, NM_WEP_KEY_TYPE_KEY, FALSE, FALSE);
- g_return_if_fail (ws_wep);
- add_security_item (self, NMA_WS (ws_wep), sec_model,
- &iter, _("WEP 40/128-bit Key (Hex or ASCII)"),
- TRUE, TRUE);
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP) && (wep_type == NM_WEP_KEY_TYPE_KEY))
active = item;
- item++;
-
- ws_wep = nma_ws_wep_key_new (connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
- g_return_if_fail (ws_wep);
+ if (item == active || allow_wep()) {
+ /* If WEP is disabled, only add add the choice if the connection already uses it. */
+ ws_wep = nma_ws_wep_key_new (connection, NM_WEP_KEY_TYPE_KEY, FALSE, FALSE);
+ g_return_if_fail (ws_wep);
+
+ add_security_item (self, NMA_WS (ws_wep), sec_model,
+ &iter, _("WEP 40/128-bit Key (Hex or ASCII)"),
+ TRUE, TRUE);
+ item++;
+ }
- add_security_item (self, NMA_WS (ws_wep), sec_model,
- &iter, _("WEP 128-bit Passphrase"), TRUE, TRUE);
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP) && (wep_type == NM_WEP_KEY_TYPE_PASSPHRASE))
active = item;
- item++;
+ if (item == active || allow_wep()) {
+ /* If WEP is disabled, only add add the choice if the connection already uses it. */
+ ws_wep = nma_ws_wep_key_new (connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
+ g_return_if_fail (ws_wep);
+
+ add_security_item (self, NMA_WS (ws_wep), sec_model,
+ &iter, _("WEP 128-bit Passphrase"), TRUE, TRUE);
+ item++;
+ }
}
if (security_valid (NMU_SEC_LEAP, mode)) {