NetworkManager r3515 - in trunk: . libnm-util



Author: dcbw
Date: Sun Mar 30 15:25:54 2008
New Revision: 3515
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3515&view=rev

Log:
2008-03-30  Dan Williams  <dcbw redhat com>

	* 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



Modified:
   trunk/ChangeLog
   trunk/libnm-util/nm-setting-wireless-security.c

Modified: trunk/libnm-util/nm-setting-wireless-security.c
==============================================================================
--- trunk/libnm-util/nm-setting-wireless-security.c	(original)
+++ trunk/libnm-util/nm-setting-wireless-security.c	Sun Mar 30 15:25:54 2008
@@ -93,19 +93,19 @@
 
 	/* 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 @@
 		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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]