NetworkManager r3508 - in trunk: . system-settings/plugins/ifcfg-fedora



Author: dcbw
Date: Sat Mar 29 12:01:25 2008
New Revision: 3508
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3508&view=rev

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

	* system-settings/plugins/ifcfg-fedora/parser.c
		- (get_one_wep_key, make_wireless_security_setting): handle "KEY" too



Modified:
   trunk/ChangeLog
   trunk/system-settings/plugins/ifcfg-fedora/parser.c

Modified: trunk/system-settings/plugins/ifcfg-fedora/parser.c
==============================================================================
--- trunk/system-settings/plugins/ifcfg-fedora/parser.c	(original)
+++ trunk/system-settings/plugins/ifcfg-fedora/parser.c	Sat Mar 29 12:01:25 2008
@@ -383,15 +383,11 @@
 
 
 static char *
-get_one_wep_key (shvarFile *ifcfg, guint8 idx, GError **error)
+get_one_wep_key (shvarFile *ifcfg, const char *shvar_key, GError **error)
 {
-	char *shvar_key;
 	char *key = NULL;
 	char *value = NULL;
 
-	g_return_val_if_fail (idx <= 3, NULL);
-
-	shvar_key = g_strdup_printf ("KEY%d", idx);
 	value = svGetValue (ifcfg, shvar_key);
 	if (!value || !strlen (value))
 		goto out;
@@ -430,13 +426,12 @@
 
 out:
 	g_free (value);
-	g_free (shvar_key);
 	return key;
 }
 
-#define READ_WEP_KEY(idx, ifcfg_file, cdata) \
+#define READ_WEP_KEY(shvar_key, idx, ifcfg_file, cdata) \
 	{ \
-		char *key = get_one_wep_key (ifcfg_file, idx, error); \
+		char *key = get_one_wep_key (ifcfg_file, shvar_key, error); \
 		if (*error) \
 			goto error; \
 		if (key) { \
@@ -487,18 +482,20 @@
 
 	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ());
 
-	READ_WEP_KEY(0, ifcfg, cdata)
-	READ_WEP_KEY(1, ifcfg, cdata)
-	READ_WEP_KEY(2, ifcfg, cdata)
-	READ_WEP_KEY(3, ifcfg, cdata)
+	READ_WEP_KEY("KEY", 0, ifcfg, cdata)
+	READ_WEP_KEY("KEY0", 0, ifcfg, cdata)
+	READ_WEP_KEY("KEY1", 1, ifcfg, cdata)
+	READ_WEP_KEY("KEY2", 2, ifcfg, cdata)
+	READ_WEP_KEY("KEY3", 3, ifcfg, cdata)
 
 	/* Try to get keys from the "shadow" key file */
 	keys_ifcfg = get_keys_ifcfg (file);
 	if (keys_ifcfg) {
-		READ_WEP_KEY(0, keys_ifcfg, cdata)
-		READ_WEP_KEY(1, keys_ifcfg, cdata)
-		READ_WEP_KEY(2, keys_ifcfg, cdata)
-		READ_WEP_KEY(3, keys_ifcfg, cdata)
+		READ_WEP_KEY("KEY", 0, keys_ifcfg, cdata)
+		READ_WEP_KEY("KEY0", 0, keys_ifcfg, cdata)
+		READ_WEP_KEY("KEY1", 1, keys_ifcfg, cdata)
+		READ_WEP_KEY("KEY2", 2, keys_ifcfg, cdata)
+		READ_WEP_KEY("KEY3", 3, keys_ifcfg, cdata)
 	}
 
 	value = svGetValue (ifcfg, "DEFAULTKEY");



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