Commit 843a05f7 authored by Lubomir Rintel's avatar Lubomir Rintel 🥕
Browse files

libnm/vpn-service-plugin: don't register a bus name before creating the VPN object

Otherwise NetworkManager can be too fast calling a method:

  <error> [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
parent 745d22f0
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment