From 843a05f7cc95f864bb898f670cb6adbdf813dfce Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 19 Apr 2016 19:55:38 +0200 Subject: [PATCH] libnm/vpn-service-plugin: don't register a bus name before creating the VPN object Otherwise NetworkManager can be too fast calling a method: [1461073999.2362] vpn-connection[0x7fe39ec491e0,be049803-a705-438f-b8f5-49db87640c93,"libreswan",0]: plugin NeedSecrets request #1 failed: No such interface 'org.freedesktop.NetworkManager.VPN.Plugin' on object at path /org/freedesktop/NetworkManager/VPN/Plugin --- libnm/nm-vpn-service-plugin.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c index 82e29ee8a..bf4369e4a 100644 --- a/libnm/nm-vpn-service-plugin.c +++ b/libnm/nm-vpn-service-plugin.c @@ -994,19 +994,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) if (!proxy) goto out; - ret = g_dbus_proxy_call_sync (proxy, - "RequestName", - g_variant_new ("(su)", priv->dbus_service_name, 0), - G_DBUS_CALL_FLAGS_NONE, -1, - cancellable, error); - g_object_unref (proxy); - if (!ret) { - if (error && *error) - g_dbus_error_strip_remote_error (*error); - goto out; - } - g_variant_unref (ret); - priv->dbus_vpn_service_plugin = nmdbus_vpn_plugin_skeleton_new (); if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (priv->dbus_vpn_service_plugin), connection, @@ -1030,6 +1017,19 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) nm_vpn_service_plugin_set_connection (plugin, connection); nm_vpn_service_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_INIT); + ret = g_dbus_proxy_call_sync (proxy, + "RequestName", + g_variant_new ("(su)", priv->dbus_service_name, 0), + G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + g_object_unref (proxy); + if (!ret) { + if (error && *error) + g_dbus_error_strip_remote_error (*error); + goto out; + } + g_variant_unref (ret); + success = TRUE; out: