You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
6.3 KiB
126 lines
6.3 KiB
From 48193ae383de29c52bf37d869f2e0a8534fbe825 Mon Sep 17 00:00:00 2001 |
|
From: Thomas Haller <thaller@redhat.com> |
|
Date: Fri, 10 May 2019 14:35:52 +0200 |
|
Subject: [PATCH 1/2] settings: avoid assertion for LoadConnections D-Bus |
|
method with relative paths |
|
|
|
$ busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/Settings org.freedesktop.NetworkManager.Settings LoadConnections as 1 relative/filename |
|
|
|
triggers a g_critical() assertion in nm_utils_file_is_in_path(): |
|
|
|
... |
|
#3 0x00007ffff7a19e7d in g_return_if_fail_warning |
|
(log_domain=log_domain@entry=0x55555586c333 "NetworkManager", pretty_function=pretty_function@entry=0x55555586c0a0 <__FUNCTION__.38585> "nm_utils_file_is_in_path", expression=expression@entry=0x55555586c010 "abs_filename && abs_filename[0] == '/'") at ../glib/gmessages.c:2767 |
|
#4 0x00005555555f1128 in nm_utils_file_is_in_path (abs_filename=abs_filename@entry=0x555555b56670 "dfd", abs_path=<optimized out>) at src/NetworkManagerUtils.c:1077 |
|
#5 0x00005555555a4779 in load_connection (config=<optimized out>, filename=0x555555b56670 "dfd") at src/settings/plugins/keyfile/nms-keyfile-plugin.c:522 |
|
#6 0x00005555557ce291 in nm_settings_plugin_load_connection (self=0x5555559fd400 [NMSKeyfilePlugin], filename=0x555555b56670 "dfd") at src/settings/nm-settings-plugin.c:70 |
|
#7 0x000055555559ccdf in impl_settings_load_connections |
|
(obj=<optimized out>, interface_info=<optimized out>, method_info=<optimized out>, connection=<optimized out>, sender=<optimized out>, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], parameters=<optimized out>) at src/settings/nm-settings.c:1439 |
|
#8 0x00005555555a9bf9 in dbus_vtable_method_call |
|
(connection=0x5555559b91b0 [GDBusConnection], sender=sender@entry=0x555555b5c360 ":1.32283", object_path=object_path@entry=0x7fffe0019070 "/org/freedesktop/NetworkManager/Settings", interface_name=<optimized out>, interface_name@entry=0x7fffe002aa70 "org.freedesktop.NetworkManager.Settings", method_name=<optimized out>, |
|
method_name@entry=0x7fffe00276b0 "LoadConnections", parameters=parameters@entry=0x555555c4a690, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], user_data=0x5555559a1a00) |
|
at src/nm-dbus-manager.c:947 |
|
#9 0x00007ffff7c506c4 in call_in_idle_cb (user_data=user_data@entry=0x7fffe0015ed0) at ../gio/gdbusconnection.c:4874 |
|
#10 0x00007ffff7a0e8eb in g_idle_dispatch (source=source@entry=0x7fffe00208a0, callback=0x7ffff7c50590 <call_in_idle_cb>, user_data=0x7fffe0015ed0) at ../glib/gmain.c:5627 |
|
#11 0x00007ffff7a11fd0 in g_main_dispatch (context=0x555555994d00) at ../glib/gmain.c:3189 |
|
#12 0x00007ffff7a11fd0 in g_main_context_dispatch (context=context@entry=0x555555994d00) at ../glib/gmain.c:3854 |
|
#13 0x00007ffff7a12368 in g_main_context_iterate (context=0x555555994d00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3927 |
|
#14 0x00007ffff7a126b3 in g_main_loop_run (loop=0x555555995e60) at ../glib/gmain.c:4123 |
|
#15 0x000055555558a741 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:444 |
|
|
|
Filter out relative filenames early. |
|
|
|
(cherry picked from commit a1b102eae4bc412297b72c327530abc1ca38d659) |
|
(cherry picked from commit c21171e06987353868e91d6e1cd395ade05e9390) |
|
--- |
|
src/settings/nm-settings.c | 31 ++++++++++++++++++------------- |
|
1 file changed, 18 insertions(+), 13 deletions(-) |
|
|
|
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c |
|
index e594860bc..1f8314847 100644 |
|
--- a/src/settings/nm-settings.c |
|
+++ b/src/settings/nm-settings.c |
|
@@ -1409,8 +1409,6 @@ impl_settings_load_connections (NMDBusObject *obj, |
|
NMSettings *self = NM_SETTINGS (obj); |
|
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); |
|
gs_unref_ptrarray GPtrArray *failures = NULL; |
|
- GSList *iter; |
|
- guint i; |
|
gs_free const char **filenames = NULL; |
|
|
|
g_variant_get (parameters, "(^a&s)", &filenames); |
|
@@ -1427,21 +1425,28 @@ impl_settings_load_connections (NMDBusObject *obj, |
|
return; |
|
|
|
if (filenames) { |
|
+ gsize i; |
|
+ |
|
for (i = 0; filenames[i]; i++) { |
|
- for (iter = priv->plugins; iter; iter = g_slist_next (iter)) { |
|
- NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); |
|
+ GSList *iter; |
|
|
|
- if (nm_settings_plugin_load_connection (plugin, filenames[i])) |
|
- break; |
|
- } |
|
+ if (filenames[i][0] != '/') |
|
+ _LOGW ("load: connection filename '%s' is not an absolute path", filenames[i]); |
|
+ else { |
|
+ for (iter = priv->plugins; iter; iter = iter->next) { |
|
+ NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); |
|
|
|
- if (!iter) { |
|
- if (!g_path_is_absolute (filenames[i])) |
|
- _LOGW ("connection filename '%s' is not an absolute path", filenames[i]); |
|
- if (!failures) |
|
- failures = g_ptr_array_new (); |
|
- g_ptr_array_add (failures, (char *) filenames[i]); |
|
+ if (nm_settings_plugin_load_connection (plugin, filenames[i])) |
|
+ goto next_filename; |
|
+ } |
|
} |
|
+ |
|
+ if (!failures) |
|
+ failures = g_ptr_array_new (); |
|
+ g_ptr_array_add (failures, (char *) filenames[i]); |
|
+ |
|
+next_filename: |
|
+ ; |
|
} |
|
} |
|
|
|
-- |
|
2.21.0 |
|
|
|
|
|
From b9123eb59de18ddf30b2cb5eab0f5a0c0eeef345 Mon Sep 17 00:00:00 2001 |
|
From: Thomas Haller <thaller@redhat.com> |
|
Date: Fri, 10 May 2019 14:53:51 +0200 |
|
Subject: [PATCH 2/2] settings/d-bus: fix boolean return value of |
|
"LoadConnections" |
|
|
|
The boolean value is intended to indicate success. It would indicated |
|
failure due to a bug. |
|
|
|
Fixes: 297d4985abcc ('core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API'): |
|
(cherry picked from commit 22e830f0469a654159e71b5bbddb2774bb5342c2) |
|
(cherry picked from commit e73a505866a784b41393ae6082a26ff7389633d3) |
|
--- |
|
src/settings/nm-settings.c | 2 +- |
|
1 file changed, 1 insertion(+), 1 deletion(-) |
|
|
|
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c |
|
index 1f8314847..90dd892cb 100644 |
|
--- a/src/settings/nm-settings.c |
|
+++ b/src/settings/nm-settings.c |
|
@@ -1455,7 +1455,7 @@ next_filename: |
|
|
|
g_dbus_method_invocation_return_value (invocation, |
|
g_variant_new ("(b^as)", |
|
- (gboolean) (!!failures), |
|
+ (gboolean) (!failures), |
|
failures |
|
? (const char **) failures->pdata |
|
: NM_PTRARRAY_EMPTY (const char *))); |
|
-- |
|
2.21.0
|
|
|