Commit ae4b47ca authored by Dan Williams's avatar Dan Williams

core: PolicyKit protect Deactivate and Disconnect

parent 25e758c7
......@@ -65,10 +65,11 @@
</property>
<method name="Disconnect">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_disconnect"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Disconnects a device and prevents the device from automatically activating further connections without user intervention.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_disconnect"/>
</method>
<signal name="StateChanged">
......
......@@ -31,16 +31,19 @@ object. dbus-glib generates the same bound function names for D-Bus the methods
<method name="DeactivateConnection">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_deactivate_connection"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="active_connection" type="o" direction="in"/>
</method>
<method name="Sleep">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_sleep"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="sleep" type="b" direction="in"/>
</method>
<method name="Enable">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_enable"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="enable" type="b" direction="in"/>
</method>
......
......@@ -77,6 +77,7 @@
Deactivate an active connection.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_deactivate_connection"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="active_connection" type="o" direction="in">
<tp:docstring>
The currently active connection to deactivate.
......
......@@ -19,6 +19,8 @@
* Copyright (C) 2007 - 2010 Red Hat, Inc.
*/
#include <dbus/dbus-glib.h>
#include "nm-marshal.h"
#include "nm-setting-connection.h"
#include "nm-device-interface.h"
......@@ -26,8 +28,8 @@
#include "nm-properties-changed-signal.h"
#include "nm-rfkill.h"
static gboolean impl_device_disconnect (NMDeviceInterface *device,
GError **error);
static void impl_device_disconnect (NMDeviceInterface *device,
DBusGMethodInvocation *context);
#include "nm-device-interface-glue.h"
......@@ -211,6 +213,13 @@ nm_device_interface_init (gpointer g_iface)
G_TYPE_NONE, 3,
G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
g_signal_new (NM_DEVICE_INTERFACE_DISCONNECT_REQUEST,
iface_type,
G_SIGNAL_RUN_FIRST,
0, NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
dbus_g_object_type_install_info (iface_type,
&dbus_glib_nm_device_interface_object_info);
......@@ -334,11 +343,11 @@ nm_device_interface_disconnect (NMDeviceInterface *device,
return success;
}
static gboolean
static void
impl_device_disconnect (NMDeviceInterface *device,
GError **error)
DBusGMethodInvocation *context)
{
return nm_device_interface_disconnect (device, error);
g_signal_emit_by_name (device, NM_DEVICE_INTERFACE_DISCONNECT_REQUEST, context);
}
void
......
......@@ -45,6 +45,8 @@ typedef enum
#define NM_DEVICE_INTERFACE_ERROR (nm_device_interface_error_quark ())
#define NM_TYPE_DEVICE_INTERFACE_ERROR (nm_device_interface_error_get_type ())
#define NM_DEVICE_INTERFACE_DISCONNECT_REQUEST "disconnect-request"
#define NM_DEVICE_INTERFACE_UDI "udi"
#define NM_DEVICE_INTERFACE_IFACE "interface"
#define NM_DEVICE_INTERFACE_DRIVER "driver"
......
This diff is collapsed.
......@@ -304,6 +304,33 @@ nm_vpn_manager_get_active_connections (NMVPNManager *manager)
return list;
}
NMConnection *
nm_vpn_manager_get_connection_for_active (NMVPNManager *manager,
const char *active_path)
{
NMVPNManagerPrivate *priv;
GSList *iter;
g_return_val_if_fail (NM_IS_VPN_MANAGER (manager), NULL);
priv = NM_VPN_MANAGER_GET_PRIVATE (manager);
for (iter = priv->services; iter; iter = g_slist_next (iter)) {
GSList *active, *elt;
active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (iter->data));
for (elt = active; elt; elt = g_slist_next (elt)) {
NMVPNConnection *candidate = NM_VPN_CONNECTION (elt->data);
const char *ac_path;
ac_path = nm_vpn_connection_get_active_connection_path (candidate);
if (ac_path && !strcmp (ac_path, active_path))
return nm_vpn_connection_get_connection (candidate);
}
}
return NULL;
}
NMVPNManager *
nm_vpn_manager_get (void)
{
......
......@@ -83,4 +83,7 @@ void nm_vpn_manager_add_active_connections (NMVPNManager *manager,
GSList *nm_vpn_manager_get_active_connections (NMVPNManager *manager);
NMConnection *nm_vpn_manager_get_connection_for_active (NMVPNManager *manager,
const char *active_path);
#endif /* NM_VPN_VPN_MANAGER_H */
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