summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-03-18 15:30:57 +0100
committerLubomir Rintel <lkundrak@v3.sk>2016-03-18 18:04:55 +0100
commitd568eb0e6c22f3828705530dd6d6cc34e79ae002 (patch)
tree4489d278b199c64bbd112917a06f71fc365c8f10
parent99ad9df34262a7eafac1127c2e47952b9f5c45dd (diff)
downloadNetworkManager-d568eb0e6c22f3828705530dd6d6cc34e79ae002.tar.gz
vpn-connection: don't dispose the proxy before we get the disconnect response
The return_method would be rejected by the dbus-daemon when the NM drops its match, resulting in an ugly message in the log: method call time=1458301860.187048 sender=:1.267 -> destination=:1.276 serial=5302 path=/org/freedesktop/NetworkManager/VPN/Plugin; interface=org.freedesktop.NetworkManager.VPN.Plugin; member=Disconnect method call time=1458301860.187054 sender=:1.267 -> destination=org.freedesktop.DBus serial=5303 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch string "type='signal',sender='org.freedesktop.DBus', interface='org.freedesktop.DBus', member='NameOwnerChanged', path='/org/freedesktop/DBus', arg0='org.freedesktop.NetworkManager.libreswan.Connection_10'" method return time=1458301860.187061 sender=org.freedesktop.DBus -> destination=:1.267 serial=1835 reply_serial=5303 ... method return time=1458301860.195351 sender=:1.276 -> destination=:1.267 serial=19 reply_serial=5302 error time=1458301860.195361 sender=org.freedesktop.DBus -> destination=:1.276 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=19 string "Rejected send message, 7 matched rules; type="method_return", sender=":1.276" (uid=0 pid=26915 comm="/usr/libexec/nm-libreswan-service --bus-name org.f") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.267" (uid=0 pid=25724 comm="/usr/sbin/NetworkManager --no-daemon ")" Also, refcount the connection instance. While the proxy is alive, it invokes singal callbacks that get the object as a parameter.
-rw-r--r--src/vpn-manager/nm-vpn-connection.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 27132d7f1d..0c0a42357b 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -319,14 +319,25 @@ _get_applied_connection (NMVpnConnection *connection)
}
static void
+disconnect_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
+{
+ g_dbus_proxy_call_finish (proxy, result, NULL);
+ g_object_unref (user_data);
+}
+
+static void
call_plugin_disconnect (NMVpnConnection *self)
{
NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self);
- if (priv->proxy) {
- g_dbus_proxy_call (priv->proxy, "Disconnect", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
- g_clear_object (&priv->proxy);
- }
+ g_dbus_proxy_call (priv->proxy,
+ "Disconnect",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ priv->cancellable,
+ (GAsyncReadyCallback) disconnect_cb,
+ g_object_ref (self));
}
static void