mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-07 00:30:32 +01:00
ifnet: fix quote handling for global data (bgo #673548)
This commit is contained in:
parent
de3353d58c
commit
5f4d238baa
3 changed files with 12 additions and 6 deletions
|
|
@ -143,12 +143,13 @@ init_block_by_line (gchar * buf)
|
|||
pos = g_strrstr (key_value[0], "_");
|
||||
if (pos == NULL || is_global_setting (key_value[0])) {
|
||||
/* global data */
|
||||
PLUGIN_PRINT (IFNET_PLUGIN_NAME, "global:%s-%s\n", key_value[0],
|
||||
key_value[1]);
|
||||
g_hash_table_insert (global_settings_table,
|
||||
g_strdup (key_value[0]),
|
||||
g_strdup (key_value[1]));
|
||||
data = g_strdup (key_value[1]);
|
||||
tmp = strip_string (data, '"');
|
||||
strip_string (tmp, '\'');
|
||||
PLUGIN_PRINT (IFNET_PLUGIN_NAME, "global:%s-%s\n", key_value[0], tmp);
|
||||
g_hash_table_insert (global_settings_table, g_strdup (key_value[0]), g_strdup (tmp));
|
||||
g_strfreev (key_value);
|
||||
g_free (data);
|
||||
return;
|
||||
}
|
||||
*pos++ = '\0';
|
||||
|
|
@ -593,7 +594,7 @@ ifnet_flush_to_file (const char *config_file)
|
|||
/* Writing global data */
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
out_line =
|
||||
g_strdup_printf ("%s=%s\n", (gchar *) key, (gchar *) value);
|
||||
g_strdup_printf ("%s=\"%s\"\n", (gchar *) key, (gchar *) value);
|
||||
g_io_channel_write_chars (channel, out_line, -1,
|
||||
&bytes_written, error);
|
||||
if (bytes_written == 0 || (error && *error))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
# please review /etc/conf.d/net.example and save your configuration
|
||||
# in /etc/conf.d/net (this file :]!).
|
||||
|
||||
modules="!wpa_supplicant"
|
||||
|
||||
config_eth0=(
|
||||
"202.117.16.121 netmask 255.255.255.0 brd 202.117.16.255"
|
||||
"192.168.4.121/24"
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ test_getdata ()
|
|||
&& strcmp (ifnet_get_data ("ppp0", "password"),
|
||||
"password") == 0, "get data",
|
||||
"config_ppp0 password is not correctly read");
|
||||
ASSERT (ifnet_get_global_data ("modules")
|
||||
&& strcmp ("!wpa_supplicant", ifnet_get_global_data ("modules")) == 0,
|
||||
"get data", "config_eth1 is not correct");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue