/[gentoo-x86]/net-misc/networkmanager/files/networkmanager-0.9.4.0-fix-quote-handling.patch
Gentoo

Contents of /net-misc/networkmanager/files/networkmanager-0.9.4.0-fix-quote-handling.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Thu Apr 5 03:09:08 2012 UTC (2 years, 5 months ago) by qiaomuf
Branch: MAIN
CVS Tags: HEAD
Fix quote handling for global data

(Portage version: 2.1.10.52/cvs/Linux x86_64)

1 qiaomuf 1.1 From 593f87514484aa82c9f1b39c96ee859671186831 Mon Sep 17 00:00:00 2001
2     From: Mu Qiao <qiaomuf@gentoo.org>
3     Date: Thu, 5 Apr 2012 10:12:37 +0800
4     Subject: [PATCH] ifnet: fix quote handling for global data
5    
6     ---
7     src/settings/plugins/ifnet/net_parser.c | 13 +++++++------
8     src/settings/plugins/ifnet/tests/net | 2 ++
9     src/settings/plugins/ifnet/tests/test_all.c | 3 +++
10     3 files changed, 12 insertions(+), 6 deletions(-)
11    
12     diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c
13     index 38765f5..c230138 100644
14     --- a/src/settings/plugins/ifnet/net_parser.c
15     +++ b/src/settings/plugins/ifnet/net_parser.c
16     @@ -143,12 +143,13 @@ init_block_by_line (gchar * buf)
17     pos = g_strrstr (key_value[0], "_");
18     if (pos == NULL || is_global_setting (key_value[0])) {
19     /* global data */
20     - PLUGIN_PRINT (IFNET_PLUGIN_NAME, "global:%s-%s\n", key_value[0],
21     - key_value[1]);
22     - g_hash_table_insert (global_settings_table,
23     - g_strdup (key_value[0]),
24     - g_strdup (key_value[1]));
25     + data = g_strdup (key_value[1]);
26     + tmp = strip_string (data, '"');
27     + strip_string (tmp, '\'');
28     + PLUGIN_PRINT (IFNET_PLUGIN_NAME, "global:%s-%s\n", key_value[0], tmp);
29     + g_hash_table_insert (global_settings_table, g_strdup (key_value[0]), g_strdup (tmp));
30     g_strfreev (key_value);
31     + g_free (data);
32     return;
33     }
34     *pos++ = '\0';
35     @@ -593,7 +594,7 @@ ifnet_flush_to_file (const char *config_file)
36     /* Writing global data */
37     while (g_hash_table_iter_next (&iter, &key, &value)) {
38     out_line =
39     - g_strdup_printf ("%s=%s\n", (gchar *) key, (gchar *) value);
40     + g_strdup_printf ("%s=\"%s\"\n", (gchar *) key, (gchar *) value);
41     g_io_channel_write_chars (channel, out_line, -1,
42     &bytes_written, error);
43     if (bytes_written == 0 || (error && *error))
44     diff --git a/src/settings/plugins/ifnet/tests/net b/src/settings/plugins/ifnet/tests/net
45     index 27d39f4..a5ac9ca 100644
46     --- a/src/settings/plugins/ifnet/tests/net
47     +++ b/src/settings/plugins/ifnet/tests/net
48     @@ -3,6 +3,8 @@
49     # please review /etc/conf.d/net.example and save your configuration
50     # in /etc/conf.d/net (this file :]!).
51    
52     +modules="!wpa_supplicant"
53     +
54     config_eth0=(
55     "202.117.16.121 netmask 255.255.255.0 brd 202.117.16.255"
56     "192.168.4.121/24"
57     diff --git a/src/settings/plugins/ifnet/tests/test_all.c b/src/settings/plugins/ifnet/tests/test_all.c
58     index 50441d4..974258b 100644
59     --- a/src/settings/plugins/ifnet/tests/test_all.c
60     +++ b/src/settings/plugins/ifnet/tests/test_all.c
61     @@ -56,6 +56,9 @@ test_getdata ()
62     && strcmp (ifnet_get_data ("ppp0", "password"),
63     "password") == 0, "get data",
64     "config_ppp0 password is not correctly read");
65     + ASSERT (ifnet_get_global_data ("modules")
66     + && strcmp ("!wpa_supplicant", ifnet_get_global_data ("modules")) == 0,
67     + "get data", "config_eth1 is not correct");
68     }
69    
70     static void
71     --
72     1.7.3.4

  ViewVC Help
Powered by ViewVC 1.1.20