Commit 34ba4e14 authored by Dan Winship's avatar Dan Winship

core: port NMManager to gdbus

parent 6c8f8608
......@@ -8,7 +8,6 @@
<tp:docstring>
Get the list of network devices.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_devices"/>
<arg name="devices" type="ao" direction="out">
<tp:docstring>
List of object paths of network devices known to the system.
......@@ -22,7 +21,6 @@
interface name. Note that some devices (usually modems) only have an
IP interface name when they are connected.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_device_by_ip_iface"/>
<arg name="iface" type="s" direction="in">
<tp:docstring>
Interface name of the device to find.
......@@ -36,8 +34,6 @@
</method>
<method name="ActivateConnection">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_activate_connection"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Activate a connection using the supplied device.
</tp:docstring>
......@@ -76,8 +72,6 @@
</method>
<method name="AddAndActivateConnection">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_add_and_activate_connection"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Adds a new connection using the given details (if any) as a template
(automatically filling in missing settings with the capabilities of the
......@@ -121,8 +115,6 @@
<tp:docstring>
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.
......@@ -131,8 +123,6 @@
</method>
<method name="Sleep">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_sleep"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Control the NetworkManager daemon's sleep state. When asleep, all
interfaces that it manages are deactivated. When awake, devices are
......@@ -147,8 +137,6 @@
</method>
<method name="Enable">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_enable"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Control whether overall networking is enabled or disabled. When
disabled, all interfaces that NM manages are deactivated. When enabled,
......@@ -165,8 +153,6 @@
</method>
<method name="GetPermissions">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_permissions"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Returns the permissions a caller has for various authenticated operations
that NetworkManager provides, like Enable/Disable networking, changing
......@@ -193,8 +179,6 @@
</signal>
<method name="SetLogging">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_set_logging"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Set logging verbosity and which operations are logged.
</tp:docstring>
......@@ -223,7 +207,6 @@
</method>
<method name="GetLogging">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_logging"/>
<tp:docstring>
Get current logging verbosity level and operations domains.
</tp:docstring>
......@@ -240,8 +223,6 @@
</method>
<method name="CheckConnectivity">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_check_connectivity"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Re-check the network connectivity state.
</tp:docstring>
......@@ -257,7 +238,6 @@
The overall networking state as determined by the NetworkManager daemon,
based on the state of network devices under it's management.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_state"/>
<arg name="state" type="u" direction="out" tp:type="NM_STATE"/>
</method>
......
......@@ -26,8 +26,6 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h>
#include "nm-default.h"
#include "nm-manager.h"
......@@ -35,7 +33,6 @@
#include "nm-vpn-manager.h"
#include "nm-device.h"
#include "nm-device-generic.h"
#include "nm-dbus-glib-types.h"
#include "nm-platform.h"
#include "nm-rfkill-manager.h"
#include "nm-dhcp-manager.h"
......@@ -55,60 +52,9 @@
#include "nm-core-internal.h"
#include "nm-config.h"
#include "nm-audit-manager.h"
#include "nm-dbus-compat.h"
static gboolean impl_manager_get_devices (NMManager *manager,
GPtrArray **devices,
GError **err);
static gboolean impl_manager_get_device_by_ip_iface (NMManager *self,
const char *iface,
char **out_object_path,
GError **error);
static void impl_manager_activate_connection (NMManager *manager,
const char *connection_path,
const char *device_path,
const char *specific_object_path,
DBusGMethodInvocation *context);
static void impl_manager_add_and_activate_connection (NMManager *manager,
GHashTable *settings,
const char *device_path,
const char *specific_object_path,
DBusGMethodInvocation *context);
static void impl_manager_deactivate_connection (NMManager *manager,
const char *connection_path,
DBusGMethodInvocation *context);
static void impl_manager_sleep (NMManager *manager,
gboolean do_sleep,
DBusGMethodInvocation *context);
static void impl_manager_enable (NMManager *manager,
gboolean enable,
DBusGMethodInvocation *context);
static void impl_manager_get_permissions (NMManager *manager,
DBusGMethodInvocation *context);
static gboolean impl_manager_get_state (NMManager *manager,
guint32 *state,
GError **error);
static void impl_manager_set_logging (NMManager *manager,
const char *level,
const char *domains,
DBusGMethodInvocation *context);
static void impl_manager_get_logging (NMManager *manager,
char **level,
char **domains);
static void impl_manager_check_connectivity (NMManager *manager,
DBusGMethodInvocation *context);
#include "nm-manager-glue.h"
#include "nmdbus-manager.h"
static void add_device (NMManager *self, NMDevice *device, gboolean try_assume);
......@@ -165,6 +111,7 @@ typedef struct {
NMPolicy *policy;
NMBusManager *dbus_mgr;
guint prop_filter;
NMRfkillManager *rfkill_mgr;
NMSettings *settings;
......@@ -1344,7 +1291,7 @@ nm_manager_rfkill_update (NMManager *self, RfKillType rtype)
static void
device_auth_done_cb (NMAuthChain *chain,
GError *auth_error,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
gpointer user_data)
{
NMManager *self = NM_MANAGER (user_data);
......@@ -1399,7 +1346,7 @@ device_auth_done_cb (NMAuthChain *chain,
static void
device_auth_request_cb (NMDevice *device,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
NMConnection *connection,
const char *permission,
gboolean allow_interaction,
......@@ -2063,43 +2010,46 @@ nm_manager_get_best_device_for_connection (NMManager *self,
return NULL;
}
static gboolean
impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err)
static void
impl_manager_get_devices (NMManager *self,
GDBusMethodInvocation *context)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
GPtrArray *paths;
GSList *iter;
*devices = g_ptr_array_sized_new (g_slist_length (priv->devices));
paths = g_ptr_array_sized_new (g_slist_length (priv->devices) + 1);
for (iter = priv->devices; iter; iter = iter->next)
g_ptr_array_add (*devices, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (iter->data))));
return TRUE;
g_ptr_array_add (paths, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (iter->data))));
g_ptr_array_add (paths, NULL);
g_dbus_method_invocation_return_value (context,
g_variant_new ("(^ao)", (char **) paths->pdata));
g_ptr_array_unref (paths);
}
static gboolean
static void
impl_manager_get_device_by_ip_iface (NMManager *self,
const char *iface,
char **out_object_path,
GError **error)
GDBusMethodInvocation *context,
const char *iface)
{
NMDevice *device;
const char *path = NULL;
device = find_device_by_ip_iface (self, iface);
if (device) {
if (device)
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (device));
if (path)
*out_object_path = g_strdup (path);
}
if (path == NULL) {
g_set_error_literal (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNKNOWN_DEVICE,
"No device found for the requested iface.");
g_dbus_method_invocation_return_error (context,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNKNOWN_DEVICE,
"No device found for the requested iface.");
} else {
g_dbus_method_invocation_return_value (context,
g_variant_new ("(o)", path));
}
return path ? TRUE : FALSE;
}
static gboolean
......@@ -2972,7 +2922,7 @@ nm_manager_activate_connection (NMManager *self,
static NMAuthSubject *
validate_activation_request (NMManager *self,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
NMConnection *connection,
const char *device_path,
NMDevice **out_device,
......@@ -3088,7 +3038,7 @@ _activation_auth_done (NMActiveConnection *active,
gpointer user_data2)
{
NMManager *self = user_data1;
DBusGMethodInvocation *context = user_data2;
GDBusMethodInvocation *context = user_data2;
GError *error = NULL;
NMAuthSubject *subject;
NMConnection *connection;
......@@ -3098,7 +3048,9 @@ _activation_auth_done (NMActiveConnection *active,
if (success) {
if (_internal_activate_generic (self, active, &error)) {
dbus_g_method_return (context, nm_exported_object_get_path (NM_EXPORTED_OBJECT (active)));
g_dbus_method_invocation_return_value (
context,
g_variant_new ("(o)", nm_exported_object_get_path (NM_EXPORTED_OBJECT (active))));
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ACTIVATE, connection, TRUE,
subject, NULL);
g_object_unref (active);
......@@ -3111,21 +3063,20 @@ _activation_auth_done (NMActiveConnection *active,
}
g_assert (error);
dbus_g_method_return_error (context, error);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ACTIVATE, connection, FALSE,
subject, error->message);
_internal_activation_failed (self, active, error->message);
g_object_unref (active);
g_error_free (error);
g_dbus_method_invocation_take_error (context, error);
}
static void
impl_manager_activate_connection (NMManager *self,
GDBusMethodInvocation *context,
const char *connection_path,
const char *device_path,
const char *specific_object_path,
DBusGMethodInvocation *context)
const char *specific_object_path)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
NMActiveConnection *active = NULL;
......@@ -3230,8 +3181,7 @@ error:
g_clear_object (&subject);
g_assert (error);
dbus_g_method_return_error (context, error);
g_error_free (error);
g_dbus_method_invocation_take_error (context, error);
}
/***********************************************************************/
......@@ -3245,7 +3195,7 @@ static void
activation_add_done (NMSettings *self,
NMSettingsConnection *new_connection,
GError *error,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
NMAuthSubject *subject,
gpointer user_data)
{
......@@ -3259,9 +3209,11 @@ activation_add_done (NMSettings *self,
nm_settings_connection_commit_changes (new_connection,
NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION | NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED,
NULL, NULL);
dbus_g_method_return (context,
nm_connection_get_path (NM_CONNECTION (new_connection)),
nm_exported_object_get_path (NM_EXPORTED_OBJECT (info->active)));
g_dbus_method_invocation_return_value (
context,
g_variant_new ("(oo)",
nm_connection_get_path (NM_CONNECTION (new_connection)),
nm_exported_object_get_path (NM_EXPORTED_OBJECT (info->active))));
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE,
nm_active_connection_get_connection (info->active),
TRUE,
......@@ -3275,7 +3227,7 @@ activation_add_done (NMSettings *self,
g_assert (error);
_internal_activation_failed (info->manager, info->active, error->message);
nm_settings_connection_delete (new_connection, NULL, NULL);
dbus_g_method_return_error (context, error);
g_dbus_method_invocation_return_gerror (context, error);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE,
nm_active_connection_get_connection (info->active),
FALSE,
......@@ -3297,7 +3249,7 @@ _add_and_activate_auth_done (NMActiveConnection *active,
{
NMManager *self = user_data1;
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
DBusGMethodInvocation *context = user_data2;
GDBusMethodInvocation *context = user_data2;
AddAndActivateInfo *info;
GError *error = NULL;
......@@ -3318,13 +3270,12 @@ _add_and_activate_auth_done (NMActiveConnection *active,
error = g_error_new_literal (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
error_desc);
dbus_g_method_return_error (context, error);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE,
nm_active_connection_get_connection (active),
FALSE,
nm_active_connection_get_subject (active),
error->message);
g_error_free (error);
g_dbus_method_invocation_take_error (context, error);
}
g_object_unref (active);
......@@ -3332,10 +3283,10 @@ _add_and_activate_auth_done (NMActiveConnection *active,
static void
impl_manager_add_and_activate_connection (NMManager *self,
GHashTable *settings,
GDBusMethodInvocation *context,
GVariant *settings,
const char *device_path,
const char *specific_object_path,
DBusGMethodInvocation *context)
const char *specific_object_path)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
NMConnection *connection = NULL;
......@@ -3360,12 +3311,8 @@ impl_manager_add_and_activate_connection (NMManager *self,
* validate_activation_request()).
*/
connection = nm_simple_connection_new ();
if (settings && g_hash_table_size (settings)) {
GVariant *settings_dict = nm_utils_connection_hash_to_dict (settings);
nm_connection_replace_settings (connection, settings_dict, NULL);
g_variant_unref (settings_dict);
}
if (settings && g_variant_n_children (settings))
nm_connection_replace_settings (connection, settings, NULL);
subject = validate_activation_request (self,
context,
......@@ -3437,8 +3384,7 @@ error:
g_clear_object (&active);
g_assert (error);
dbus_g_method_return_error (context, error);
g_error_free (error);
g_dbus_method_invocation_take_error (context, error);
}
/***********************************************************************/
......@@ -3487,7 +3433,7 @@ nm_manager_deactivate_connection (NMManager *manager,
static void
deactivate_net_auth_done_cb (NMAuthChain *chain,
GError *auth_error,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
gpointer user_data)
{
NMManager *self = NM_MANAGER (user_data);
......@@ -3524,11 +3470,6 @@ deactivate_net_auth_done_cb (NMAuthChain *chain,
g_assert (error);
}
if (error)
dbus_g_method_return_error (context, error);
else
dbus_g_method_return (context);
if (active) {
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_DEACTIVATE,
nm_active_connection_get_connection (active),
......@@ -3537,14 +3478,18 @@ deactivate_net_auth_done_cb (NMAuthChain *chain,
error ? error->message : NULL);
}
g_clear_error (&error);
if (error)
g_dbus_method_invocation_take_error (context, error);
else
g_dbus_method_invocation_return_value (context, NULL);
nm_auth_chain_unref (chain);
}
static void
impl_manager_deactivate_connection (NMManager *self,
const char *active_path,
DBusGMethodInvocation *context)
GDBusMethodInvocation *context,
const char *active_path)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
NMConnection *connection = NULL;
......@@ -3606,14 +3551,13 @@ impl_manager_deactivate_connection (NMManager *self,
done:
if (error) {
dbus_g_method_return_error (context, error);
if (connection) {
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_DEACTIVATE, connection, FALSE,
subject, error->message);
}
g_dbus_method_invocation_take_error (context, error);
}
g_clear_object (&subject);
g_clear_error (&error);
}
static gboolean
......@@ -3730,7 +3674,7 @@ _internal_sleep (NMManager *self, gboolean do_sleep)
static void
sleep_auth_done_cb (NMAuthChain *chain,
GError *error,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
gpointer user_data)
{
NMManager *self = NM_MANAGER (user_data);
......@@ -3748,19 +3692,17 @@ sleep_auth_done_cb (NMAuthChain *chain,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Sleep/wake request failed: %s",
error->message);
dbus_g_method_return_error (context, ret_error);
g_error_free (ret_error);
g_dbus_method_invocation_take_error (context, ret_error);
} else if (result != NM_AUTH_CALL_RESULT_YES) {
ret_error = g_error_new_literal (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Not authorized to sleep/wake");
dbus_g_method_return_error (context, ret_error);
g_error_free (ret_error);
g_dbus_method_invocation_take_error (context, ret_error);
} else {
/* Auth success */
do_sleep = GPOINTER_TO_UINT (nm_auth_chain_get_data (chain, "sleep"));
_internal_sleep (self, do_sleep);
dbus_g_method_return (context);
g_dbus_method_invocation_return_value (context, NULL);
}
nm_auth_chain_unref (chain);
......@@ -3769,8 +3711,8 @@ sleep_auth_done_cb (NMAuthChain *chain,
static void
impl_manager_sleep (NMManager *self,
gboolean do_sleep,
DBusGMethodInvocation *context)
GDBusMethodInvocation *context,
gboolean do_sleep)
{
NMManagerPrivate *priv;
GError *error = NULL;
......@@ -3789,10 +3731,9 @@ impl_manager_sleep (NMManager *self,
error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE,
"Already %s", do_sleep ? "asleep" : "awake");
dbus_g_method_return_error (context, error);
nm_audit_log_control_op (NM_AUDIT_OP_SLEEP_CONTROL, do_sleep ? "on" : "off", FALSE, subject,
error->message);
g_error_free (error);
g_dbus_method_invocation_take_error (context, error);
return;
}
......@@ -3806,7 +3747,7 @@ impl_manager_sleep (NMManager *self,
*/
_internal_sleep (self, do_sleep);
nm_audit_log_control_op (NM_AUDIT_OP_SLEEP_CONTROL, do_sleep ? "on" : "off", TRUE, subject, NULL);
dbus_g_method_return (context);
g_dbus_method_invocation_return_value (context, NULL);
return;
#if 0
......@@ -3819,8 +3760,7 @@ impl_manager_sleep (NMManager *self,
error = g_error_new_literal (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
error_desc);
dbus_g_method_return_error (context, error);
g_error_free (error);
g_dbus_method_invocation_take_error (context, error);
}
#endif
}
......@@ -3874,7 +3814,7 @@ _internal_enable (NMManager *self, gboolean enable)
static void
enable_net_done_cb (NMAuthChain *chain,
GError *error,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
gpointer user_data)
{
NMManager *self = NM_MANAGER (user_data);
......@@ -3904,16 +3844,15 @@ enable_net_done_cb (NMAuthChain *chain,
} else {
/* Auth success */
_internal_enable (self, enable);
dbus_g_method_return (context);
g_dbus_method_invocation_return_value (context, NULL);
nm_audit_log_control_op (NM_AUDIT_OP_NET_CONTROL, enable ? "on" : "off", TRUE,
subject, NULL);
}
if (ret_error) {
dbus_g_method_return_error (context, ret_error);
nm_audit_log_control_op (NM_AUDIT_OP_NET_CONTROL, enable ? "on" : "off", FALSE,
subject, ret_error->message);
g_error_free (ret_error);
g_dbus_method_invocation_take_error (context, ret_error);
}
nm_auth_chain_unref (chain);
......@@ -3921,8 +3860,8 @@ enable_net_done_cb (NMAuthChain *chain,
static void
impl_manager_enable (NMManager *self,
gboolean enable,
DBusGMethodInvocation *context)
GDBusMethodInvocation *context,
gboolean enable)
{
NMManagerPrivate *priv;
NMAuthChain *chain;
......@@ -3953,24 +3892,23 @@ impl_manager_enable (NMManager *self,
done:
if (error)
dbus_g_method_return_error (context, error);
g_clear_error (&error);
g_dbus_method_invocation_take_error (context, error);
}
/* Permissions */
static void
get_perm_add_result (NMAuthChain *chain, GHashTable *results, const char *permission)
get_perm_add_result (NMAuthChain *chain, GVariantBuilder *results, const char *permission)
{
NMAuthCallResult result;
result = nm_auth_chain_get_result (chain, permission);
if (result == NM_AUTH_CALL_RESULT_YES)
g_hash_table_insert (results, (char *) permission, "yes");
g_variant_builder_add (results, "{ss}", permission, "yes");
else if (result == NM_AUTH_CALL_RESULT_NO)
g_hash_table_insert (results, (char *) permission, "no");
g_variant_builder_add (results, "{ss}", permission, "no");
else if (result == NM_AUTH_CALL_RESULT_AUTH)
g_hash_table_insert (results, (char *) permission, "auth");
g_variant_builder_add (results, "{ss}", permission, "auth");
else {
nm_log_dbg (LOGD_CORE, "unknown auth chain result %d", result);
}
......@@ -3979,13 +3917,13 @@ get_perm_add_result (NMAuthChain *chain, GHashTable *results, const char *permis
static void
get_permissions_done_cb (NMAuthChain *chain,
GError *error,
DBusGMethodInvocation *context,
GDBusMethodInvocation *context,
gpointer user_data)
{
NMManager *self = NM_MANAGER (user_data);
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
GError *ret_error;
GHashTable *results;
GVariantBuilder results;
g_assert (context);
......@@ -3996,25 +3934,24 @@ get_permissions_done_cb (NMAuthChain *chain,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Permissions request failed: %s",
error->message);
dbus_g_method_return_error (context, ret_error);
g_error_free (ret_error);
g_dbus_method_invocation_take_error (context, ret_error);
} else {
results = g_hash_table_new (g_str_hash, g_str_equal);
g_variant_builder_init (&results, G_VARIANT_TYPE ("a{ss}"));
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_SLEEP_WAKE);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_NETWORK_CONTROL);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_WIFI_SHARE_OPEN);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN);
get_perm_add_result (chain, results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SLEEP_WAKE);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_NETWORK_CONTROL);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_WIFI_SHARE_OPEN);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN);
get_perm_add_result (chain, &results, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME);
dbus_g_method_return (context, results);
g_hash_table_destroy (results);
g_dbus_method_invocation_return_value (context,
g_variant_new ("(a{ss})", &results));
}
nm_auth_chain_unref (chain);
......@@ -4022,7 +3959,7 @@ get_permissions_done_cb (NMAuthChain *chain,
static void
impl_manager_get_permissions (NMManager *self,
DBusGMethodInvocation *context)
GDBusMethodInvocation *context)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
NMAuthChain *chain;
......@@ -4033,8 +3970,7 @@ impl_manager_get_permissions (NMManager *self,
error = g_error_new_literal (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Unable to authenticate request.");
dbus_g_method_return_error (context, error);
g_clear_error (&error);
g_dbus_method_invocation_take_error (context, error);
return;
}
......@@ -4052,21 +3988,22 @@ impl_manager_get_permissions (NMManager *self,
nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME, FALSE);
}
static gboolean
impl_manager_get_state (NMManager *manager, guint32 *state, GError **error)
static void
impl_manager_get_state (NMManager *self,
GDBusMethodInvocation *context)
{
nm_manager_update_state (manager);
*state = NM_MANAGER_GET_PRIVATE (manager)->state;