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