From c1aaea48ff856e5de8acf8ae2cae8ce3ba502a13 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 29 Mar 2008 12:01:25 +0000 Subject: [PATCH] 2008-03-29 Dan Williams * system-settings/plugins/ifcfg-fedora/parser.c - (get_one_wep_key, make_wireless_security_setting): handle "KEY" too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3508 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 5 ++++ system-settings/plugins/ifcfg-fedora/parser.c | 29 +++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5aab3d3098..7b08693304 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-29 Dan Williams + + * system-settings/plugins/ifcfg-fedora/parser.c + - (get_one_wep_key, make_wireless_security_setting): handle "KEY" too + 2008-03-27 Dan Williams * nm-object.c diff --git a/system-settings/plugins/ifcfg-fedora/parser.c b/system-settings/plugins/ifcfg-fedora/parser.c index b0c65a00d0..6160c1d8c5 100644 --- a/system-settings/plugins/ifcfg-fedora/parser.c +++ b/system-settings/plugins/ifcfg-fedora/parser.c @@ -383,15 +383,11 @@ utils_bin2hexstr (const char *bytes, int len, int final_len) 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 @@ get_one_wep_key (shvarFile *ifcfg, guint8 idx, GError **error) 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 @@ make_wireless_security_setting (shvarFile *ifcfg, 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");