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
This commit is contained in:
Lubomir Rintel
2016-04-19 19:55:38 +02:00
parent 745d22f08e
commit 843a05f7cc

View File

@@ -994,19 +994,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
if (!proxy) if (!proxy)
goto out; 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 (); 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), if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (priv->dbus_vpn_service_plugin),
connection, 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_connection (plugin, connection);
nm_vpn_service_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_INIT); 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; success = TRUE;
out: out: