From 62cebd438f03d2c5b2d12f344138f10075bc5f95 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 30 Mar 2008 14:25:54 +0000 Subject: [PATCH] 2008-03-30 Dan Williams * libnm-util/nm-setting-wireless-security.c - (need_secrets): only require key0 if the transmit key index is also 0 - (verify): reject non-NULL but zero-length WEP keys; these are invalid git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3515 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 7 +++++++ libnm-util/nm-setting-wireless-security.c | 25 +++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index edb4b7133c..35e625e6fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-03-30 Dan Williams + + * libnm-util/nm-setting-wireless-security.c + - (need_secrets): only require key0 if the transmit key index is also + 0 + - (verify): reject non-NULL but zero-length WEP keys; these are invalid + 2008-03-29 Dan Williams * libnm-util/nm-setting-8021x.c diff --git a/libnm-util/nm-setting-wireless-security.c b/libnm-util/nm-setting-wireless-security.c index eceb00cfe9..7415db1255 100644 --- a/libnm-util/nm-setting-wireless-security.c +++ b/libnm-util/nm-setting-wireless-security.c @@ -93,19 +93,19 @@ need_secrets (NMSetting *setting) /* Static WEP */ if (strcmp (self->key_mgmt, "none") == 0) { - if (!verify_wep_key (self->wep_key0)) { + if ((self->wep_tx_keyidx == 0) && !verify_wep_key (self->wep_key0)) { g_ptr_array_add (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0); return secrets; } - if (self->wep_tx_keyidx == 1 && !verify_wep_key (self->wep_key1)) { + if ((self->wep_tx_keyidx == 1) && !verify_wep_key (self->wep_key1)) { g_ptr_array_add (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY1); return secrets; } - if (self->wep_tx_keyidx == 2 && !verify_wep_key (self->wep_key2)) { + if ((self->wep_tx_keyidx == 2) && !verify_wep_key (self->wep_key2)) { g_ptr_array_add (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY2); return secrets; } - if (self->wep_tx_keyidx == 3 && !verify_wep_key (self->wep_key3)) { + if ((self->wep_tx_keyidx == 3) && !verify_wep_key (self->wep_key3)) { g_ptr_array_add (secrets, NM_SETTING_WIRELESS_SECURITY_WEP_KEY3); return secrets; } @@ -198,6 +198,23 @@ verify (NMSetting *setting, GSList *all_settings) return FALSE; } + if (self->wep_key0 && !strlen (self->wep_key0)) { + g_warning ("Invalid zero-length WEP key #0."); + return FALSE; + } + if (self->wep_key1 && !strlen (self->wep_key1)) { + g_warning ("Invalid zero-length WEP key #1."); + return FALSE; + } + if (self->wep_key2 && !strlen (self->wep_key2)) { + g_warning ("Invalid zero-length WEP key #2."); + return FALSE; + } + if (self->wep_key3 && !strlen (self->wep_key3)) { + g_warning ("Invalid zero-length WEP key #3."); + return FALSE; + } + if (self->auth_alg && !nm_utils_string_in_list (self->auth_alg, valid_auth_algs)) { g_warning ("Invalid authentication algorithm"); return FALSE;