diff options
Diffstat (limited to 'src/nm-activation-request.c')
-rw-r--r-- | src/nm-activation-request.c | 698 |
1 files changed, 345 insertions, 353 deletions
diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c index 7d1314014..d3eb920d2 100644 --- a/src/nm-activation-request.c +++ b/src/nm-activation-request.c @@ -15,10 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2005 - 2010 Red Hat, Inc. + * Copyright (C) 2005 - 2011 Red Hat, Inc. * Copyright (C) 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <stdlib.h> #include <sys/wait.h> @@ -36,24 +38,19 @@ #include "nm-active-connection.h" #include "nm-dbus-glib-types.h" #include "nm-active-connection-glue.h" +#include "nm-settings-connection.h" -static void secrets_provider_interface_init (NMSecretsProviderInterface *sp_interface_class); - -G_DEFINE_TYPE_EXTENDED (NMActRequest, nm_act_request, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_SECRETS_PROVIDER_INTERFACE, - secrets_provider_interface_init)) +G_DEFINE_TYPE (NMActRequest, nm_act_request, G_TYPE_OBJECT) -#define NM_ACT_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACT_REQUEST, NMActRequestPrivate)) +#define NM_ACT_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ + NM_TYPE_ACT_REQUEST, \ + NMActRequestPrivate)) enum { - CONNECTION_SECRETS_UPDATED, - CONNECTION_SECRETS_FAILED, PROPERTIES_CHANGED, - LAST_SIGNAL }; - static guint signals[LAST_SIGNAL] = { 0 }; typedef struct { @@ -65,11 +62,13 @@ typedef struct { gboolean disposed; NMConnection *connection; - guint32 secrets_call_id; + + GSList *secrets_calls; char *specific_object; NMDevice *device; gboolean user_requested; + gulong user_uid; NMActiveConnectionState state; gboolean is_default; @@ -84,8 +83,8 @@ typedef struct { enum { PROP_0, - PROP_SERVICE_NAME, PROP_CONNECTION, + PROP_UUID, PROP_SPECIFIC_OBJECT, PROP_DEVICES, PROP_STATE, @@ -96,357 +95,101 @@ enum { LAST_PROP }; +/*******************************************************************/ -static void -device_state_changed (NMDevice *device, - NMDeviceState new_state, - NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) -{ - NMActRequest *self = NM_ACT_REQUEST (user_data); - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self); - NMActiveConnectionState new_ac_state; - gboolean new_default = FALSE, new_default6 = FALSE; - - /* Set NMActiveConnection state based on the device's state */ - switch (new_state) { - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING; - break; - case NM_DEVICE_STATE_ACTIVATED: - new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED; - new_default = priv->is_default; - new_default6 = priv->is_default6; - break; - default: - new_ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; - break; - } - - if (new_ac_state != priv->state) { - priv->state = new_ac_state; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE); - } - - if (new_default != priv->is_default) { - priv->is_default = new_default; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT); - } - - if (new_default6 != priv->is_default6) { - priv->is_default6 = new_default6; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT6); - } -} - -NMActRequest * -nm_act_request_new (NMConnection *connection, - const char *specific_object, - gboolean user_requested, - gboolean assumed, - gpointer *device) -{ - GObject *object; - NMActRequestPrivate *priv; - - g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); - g_return_val_if_fail (NM_DEVICE (device), NULL); - - object = g_object_new (NM_TYPE_ACT_REQUEST, NULL); - if (!object) - return NULL; - - priv = NM_ACT_REQUEST_GET_PRIVATE (object); - - priv->connection = g_object_ref (connection); - if (specific_object) - priv->specific_object = g_strdup (specific_object); - - priv->device = NM_DEVICE (device); - g_signal_connect (device, "state-changed", - G_CALLBACK (device_state_changed), - NM_ACT_REQUEST (object)); - - priv->user_requested = user_requested; - priv->assumed = assumed; - - return NM_ACT_REQUEST (object); -} +typedef struct { + NMActRequest *self; + guint32 call_id; + NMActRequestSecretsFunc callback; + gpointer callback_data; +} GetSecretsInfo; static void -nm_act_request_init (NMActRequest *req) +get_secrets_cb (NMSettingsConnection *connection, + guint32 call_id, + const char *agent_username, + const char *setting_name, + GError *error, + gpointer user_data) { - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); - NMDBusManager *dbus_mgr; + GetSecretsInfo *info = user_data; + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (info->self); - priv->ac_path = nm_active_connection_get_next_object_path (); - priv->state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; + g_return_if_fail (info->call_id == call_id); + priv->secrets_calls = g_slist_remove (priv->secrets_calls, info); - dbus_mgr = nm_dbus_manager_get (); - dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (dbus_mgr), - priv->ac_path, - G_OBJECT (req)); - g_object_unref (dbus_mgr); + info->callback (info->self, call_id, NM_CONNECTION (connection), error, info->callback_data); + g_free (info); } -static void -dispose (GObject *object) +guint32 +nm_act_request_get_secrets (NMActRequest *self, + const char *setting_name, + NMSettingsGetSecretsFlags flags, + const char *hint, + NMActRequestSecretsFunc callback, + gpointer callback_data) { - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); - - if (priv->disposed) { - G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object); - return; - } - priv->disposed = TRUE; - - g_assert (priv->connection); - - g_signal_handlers_disconnect_by_func (G_OBJECT (priv->device), - G_CALLBACK (device_state_changed), - NM_ACT_REQUEST (object)); - - /* Clear any share rules */ - nm_act_request_set_shared (NM_ACT_REQUEST (object), FALSE); - - g_object_unref (priv->connection); - - G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object); + NMActRequestPrivate *priv; + GetSecretsInfo *info; + guint32 call_id; + + g_return_val_if_fail (self, 0); + g_return_val_if_fail (NM_IS_ACT_REQUEST (self), 0); + + priv = NM_ACT_REQUEST_GET_PRIVATE (self); + + info = g_malloc0 (sizeof (GetSecretsInfo)); + info->self = self; + info->callback = callback; + info->callback_data = callback_data; + + call_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (priv->connection), + priv->user_requested, + priv->user_uid, + setting_name, + flags, + hint, + get_secrets_cb, + info, + NULL); + if (call_id > 0) { + info->call_id = call_id; + priv->secrets_calls = g_slist_append (priv->secrets_calls, info); + } else + g_free (info); + + return call_id; } -static void -clear_share_rules (NMActRequest *req) +void +nm_act_request_cancel_secrets (NMActRequest *self, guint32 call_id) { - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); + NMActRequestPrivate *priv; GSList *iter; - for (iter = priv->share_rules; iter; iter = g_slist_next (iter)) { - ShareRule *rule = (ShareRule *) iter->data; + g_return_if_fail (self); + g_return_if_fail (NM_IS_ACT_REQUEST (self)); + g_return_if_fail (call_id > 0); - g_free (rule->table); - g_free (rule->rule); - g_free (rule); - } + priv = NM_ACT_REQUEST_GET_PRIVATE (self); - g_slist_free (priv->share_rules); - priv->share_rules = NULL; -} + for (iter = priv->secrets_calls; iter; iter = g_slist_next (iter)) { + GetSecretsInfo *info = iter->data; -static void -finalize (GObject *object) -{ - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); + /* Remove the matching info */ + if (info->call_id == call_id) { + priv->secrets_calls = g_slist_remove_link (priv->secrets_calls, iter); + g_slist_free (iter); - g_free (priv->specific_object); - g_free (priv->ac_path); - - clear_share_rules (NM_ACT_REQUEST (object)); - - G_OBJECT_CLASS (nm_act_request_parent_class)->finalize (object); -} - -static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); - GPtrArray *devices; - - switch (prop_id) { - case PROP_SERVICE_NAME: - nm_active_connection_scope_to_value (priv->connection, value); - break; - case PROP_CONNECTION: - g_value_set_boxed (value, nm_connection_get_path (priv->connection)); - break; - case PROP_SPECIFIC_OBJECT: - if (priv->specific_object) - g_value_set_boxed (value, priv->specific_object); - else - g_value_set_boxed (value, "/"); - break; - case PROP_DEVICES: - devices = g_ptr_array_sized_new (1); - g_ptr_array_add (devices, g_strdup (nm_device_get_path (priv->device))); - g_value_take_boxed (value, devices); - break; - case PROP_STATE: - g_value_set_uint (value, priv->state); - break; - case PROP_DEFAULT: - g_value_set_boolean (value, priv->is_default); - break; - case PROP_DEFAULT6: - g_value_set_boolean (value, priv->is_default6); - break; - case PROP_VPN: - g_value_set_boolean (value, FALSE); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -nm_act_request_class_init (NMActRequestClass *req_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (req_class); - - g_type_class_add_private (req_class, sizeof (NMActRequestPrivate)); - - /* virtual methods */ - object_class->get_property = get_property; - object_class->dispose = dispose; - object_class->finalize = finalize; - - /* properties */ - nm_active_connection_install_properties (object_class, - PROP_SERVICE_NAME, - PROP_CONNECTION, - PROP_SPECIFIC_OBJECT, - PROP_DEVICES, - PROP_STATE, - PROP_DEFAULT, - PROP_DEFAULT6, - PROP_VPN); - - /* Signals */ - signals[CONNECTION_SECRETS_UPDATED] = - g_signal_new ("connection-secrets-updated", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMActRequestClass, secrets_updated), - NULL, NULL, - _nm_marshal_VOID__OBJECT_POINTER_UINT, - G_TYPE_NONE, 3, - G_TYPE_OBJECT, G_TYPE_POINTER, G_TYPE_UINT); - - signals[CONNECTION_SECRETS_FAILED] = - g_signal_new ("connection-secrets-failed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMActRequestClass, secrets_failed), - NULL, NULL, - _nm_marshal_VOID__OBJECT_STRING_UINT, - G_TYPE_NONE, 3, - G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_UINT); - - signals[PROPERTIES_CHANGED] = - nm_properties_changed_signal_new (object_class, - G_STRUCT_OFFSET (NMActRequestClass, properties_changed)); - - dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (req_class), - &dbus_glib_nm_active_connection_object_info); -} - -static gboolean -secrets_update_setting (NMSecretsProviderInterface *interface, - const char *setting_name, - GHashTable *new) -{ - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (interface); - NMSetting *setting = NULL; - GError *error = NULL; - GType type; - - g_return_val_if_fail (priv->connection != NULL, FALSE); - - /* Check whether a complete & valid NMSetting object was returned. If - * yes, replace the setting object in the connection. If not, just try - * updating the secrets. - */ - type = nm_connection_lookup_setting_type (setting_name); - if (type == 0) - return FALSE; - - setting = nm_setting_new_from_hash (type, new); - if (setting) { - NMSetting *s_8021x = NULL; - GSList *all_settings = NULL; - - /* The wireless-security setting might need the 802.1x setting in - * the all_settings argument of the verify function. Ugh. - */ - s_8021x = nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_802_1X); - if (s_8021x) - all_settings = g_slist_append (all_settings, s_8021x); - - if (!nm_setting_verify (setting, all_settings, NULL)) { - /* Just try updating secrets */ - g_object_unref (setting); - setting = NULL; - } - - g_slist_free (all_settings); - } - - if (setting) - nm_connection_add_setting (priv->connection, setting); - else { - if (!nm_connection_update_secrets (priv->connection, setting_name, new, &error)) { - nm_log_warn (LOGD_DEVICE, "Failed to update connection secrets: %d %s", - error ? error->code : -1, - error && error->message ? error->message : "(none)"); - g_clear_error (&error); + nm_settings_connection_cancel_secrets (NM_SETTINGS_CONNECTION (priv->connection), call_id); + g_free (info); + break; } } - - return TRUE; -} - -static void -secrets_result (NMSecretsProviderInterface *interface, - const char *setting_name, - RequestSecretsCaller caller, - const GSList *updated, - GError *error) -{ - NMActRequest *self = NM_ACT_REQUEST (interface); - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self); - - g_return_if_fail (priv->connection != NULL); - - if (error) { - g_signal_emit (self, signals[CONNECTION_SECRETS_FAILED], 0, - priv->connection, setting_name, caller); - } else { - g_signal_emit (self, signals[CONNECTION_SECRETS_UPDATED], 0, - priv->connection, updated, caller); - } } -static void -secrets_provider_interface_init (NMSecretsProviderInterface *sp_interface_class) -{ - /* interface implementation */ - sp_interface_class->update_setting = secrets_update_setting; - sp_interface_class->result = secrets_result; -} - -gboolean -nm_act_request_get_secrets (NMActRequest *self, - const char *setting_name, - gboolean request_new, - RequestSecretsCaller caller, - const char *hint1, - const char *hint2) -{ - g_return_val_if_fail (self, FALSE); - g_return_val_if_fail (NM_IS_ACT_REQUEST (self), FALSE); - - return nm_secrets_provider_interface_get_secrets (NM_SECRETS_PROVIDER_INTERFACE (self), - nm_act_request_get_connection (self), - setting_name, - request_new, - caller, - hint1, - hint2); -} +/*******************************************************************/ NMConnection * nm_act_request_get_connection (NMActRequest *req) @@ -475,8 +218,7 @@ nm_act_request_set_specific_object (NMActRequest *req, priv = NM_ACT_REQUEST_GET_PRIVATE (req); - if (priv->specific_object) - g_free (priv->specific_object); + g_free (priv->specific_object); priv->specific_object = g_strdup (specific_object); } @@ -542,6 +284,42 @@ nm_act_request_get_default6 (NMActRequest *req) return NM_ACT_REQUEST_GET_PRIVATE (req)->is_default6; } +GObject * +nm_act_request_get_device (NMActRequest *req) +{ + g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL); + + return G_OBJECT (NM_ACT_REQUEST_GET_PRIVATE (req)->device); +} + +gboolean +nm_act_request_get_assumed (NMActRequest *req) +{ + g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); + + return NM_ACT_REQUEST_GET_PRIVATE (req)->assumed; +} + +/********************************************************************/ + +static void +clear_share_rules (NMActRequest *req) +{ + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); + GSList *iter; + + for (iter = priv->share_rules; iter; iter = g_slist_next (iter)) { + ShareRule *rule = (ShareRule *) iter->data; + + g_free (rule->table); + g_free (rule->rule); + g_free (rule); + } + + g_slist_free (priv->share_rules); + priv->share_rules = NULL; +} + static void share_child_setup (gpointer user_data G_GNUC_UNUSED) { @@ -628,26 +406,240 @@ nm_act_request_add_share_rule (NMActRequest *req, g_return_if_fail (NM_IS_ACT_REQUEST (req)); g_return_if_fail (table != NULL); g_return_if_fail (table_rule != NULL); - + rule = g_malloc0 (sizeof (ShareRule)); rule->table = g_strdup (table); rule->rule = g_strdup (table_rule); priv->share_rules = g_slist_append (priv->share_rules, rule); } -GObject * -nm_act_request_get_device (NMActRequest *req) +/********************************************************************/ + +static void +device_state_changed (NMDevice *device, + NMDeviceState new_state, + NMDeviceState old_state, + NMDeviceStateReason reason, + gpointer user_data) { - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); + NMActRequest *self = NM_ACT_REQUEST (user_data); + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self); + NMActiveConnectionState new_ac_state; + gboolean new_default = FALSE, new_default6 = FALSE; - return G_OBJECT (NM_ACT_REQUEST_GET_PRIVATE (req)->device); + /* Set NMActiveConnection state based on the device's state */ + switch (new_state) { + case NM_DEVICE_STATE_PREPARE: + case NM_DEVICE_STATE_CONFIG: + case NM_DEVICE_STATE_NEED_AUTH: + case NM_DEVICE_STATE_IP_CONFIG: + case NM_DEVICE_STATE_IP_CHECK: + case NM_DEVICE_STATE_SECONDARIES: + new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING; + break; + case NM_DEVICE_STATE_ACTIVATED: + new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED; + new_default = priv->is_default; + new_default6 = priv->is_default6; + break; + case NM_DEVICE_STATE_DEACTIVATING: + new_ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING; + break; + default: + new_ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; + new_default = new_default6 = FALSE; + break; + } + + if (new_ac_state != priv->state) { + priv->state = new_ac_state; + g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE); + } + + if (new_default != priv->is_default) { + priv->is_default = new_default; + g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT); + } + + if (new_default6 != priv->is_default6) { + priv->is_default6 = new_default6; + g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT6); + } } -gboolean -nm_act_request_get_assumed (NMActRequest *req) +/********************************************************************/ + +NMActRequest * +nm_act_request_new (NMConnection *connection, + const char *specific_object, + gboolean user_requested, + gulong user_uid, + gboolean assumed, + gpointer *device) { - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); + GObject *object; + NMActRequestPrivate *priv; - return NM_ACT_REQUEST_GET_PRIVATE (req)->assumed; + g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); + g_return_val_if_fail (NM_DEVICE (device), NULL); + + object = g_object_new (NM_TYPE_ACT_REQUEST, NULL); + if (!object) + return NULL; + + priv = NM_ACT_REQUEST_GET_PRIVATE (object); + + priv->connection = g_object_ref (connection); + if (specific_object) + priv->specific_object = g_strdup (specific_object); + + priv->device = NM_DEVICE (device); + g_signal_connect (device, "state-changed", + G_CALLBACK (device_state_changed), + NM_ACT_REQUEST (object)); + + priv->user_uid = user_uid; + priv->user_requested = user_requested; + priv->assumed = assumed; + + return NM_ACT_REQUEST (object); +} + +static void +nm_act_request_init (NMActRequest *req) +{ + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); + NMDBusManager *dbus_mgr; + + priv->ac_path = nm_active_connection_get_next_object_path (); + priv->state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; + + dbus_mgr = nm_dbus_manager_get (); + dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (dbus_mgr), + priv->ac_path, + G_OBJECT (req)); + g_object_unref (dbus_mgr); +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); + GPtrArray *devices; + + switch (prop_id) { + case PROP_CONNECTION: + g_value_set_boxed (value, nm_connection_get_path (priv->connection)); + break; + case PROP_UUID: + g_value_set_string (value, nm_connection_get_uuid (priv->connection)); + break; + case PROP_SPECIFIC_OBJECT: + if (priv->specific_object) + g_value_set_boxed (value, priv->specific_object); + else + g_value_set_boxed (value, "/"); + break; + case PROP_DEVICES: + devices = g_ptr_array_sized_new (1); + g_ptr_array_add (devices, g_strdup (nm_device_get_path (priv->device))); + g_value_take_boxed (value, devices); + break; + case PROP_STATE: + g_value_set_uint (value, priv->state); + break; + case PROP_DEFAULT: + g_value_set_boolean (value, priv->is_default); + break; + case PROP_DEFAULT6: + g_value_set_boolean (value, priv->is_default6); + break; + case PROP_VPN: + g_value_set_boolean (value, FALSE); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +dispose (GObject *object) +{ + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); + GSList *iter; + + if (priv->disposed) { + G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object); + return; + } + priv->disposed = TRUE; + + g_signal_handlers_disconnect_by_func (G_OBJECT (priv->device), + G_CALLBACK (device_state_changed), + NM_ACT_REQUEST (object)); + + /* Clear any share rules */ + nm_act_request_set_shared (NM_ACT_REQUEST (object), FALSE); + + /* Kill any in-progress secrets requests */ + g_assert (priv->connection); + for (iter = priv->secrets_calls; iter; iter = g_slist_next (iter)) { + GetSecretsInfo *info = iter->data; + + nm_settings_connection_cancel_secrets (NM_SETTINGS_CONNECTION (priv->connection), info->call_id); + g_free (info); + } + g_slist_free (priv->secrets_calls); + + g_object_unref (priv->connection); + + G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object); +} + +static void +finalize (GObject *object) +{ + NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); + + g_free (priv->specific_object); + g_free (priv->ac_path); + + clear_share_rules (NM_ACT_REQUEST (object)); + + G_OBJECT_CLASS (nm_act_request_parent_class)->finalize (object); +} + +static void +nm_act_request_class_init (NMActRequestClass *req_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (req_class); + + g_type_class_add_private (req_class, sizeof (NMActRequestPrivate)); + + /* virtual methods */ + object_class->get_property = get_property; + object_class->dispose = dispose; + object_class->finalize = finalize; + + /* properties */ + nm_active_connection_install_properties (object_class, + PROP_CONNECTION, + PROP_UUID, + PROP_SPECIFIC_OBJECT, + PROP_DEVICES, + PROP_STATE, + PROP_DEFAULT, + PROP_DEFAULT6, + PROP_VPN); + + /* Signals */ + signals[PROPERTIES_CHANGED] = + nm_properties_changed_signal_new (object_class, + G_STRUCT_OFFSET (NMActRequestClass, properties_changed)); + + dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (req_class), + &dbus_glib_nm_active_connection_object_info); } |