From bebd0e38b8f29b3c19465e191be6382e225491b3 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 16 Oct 2007 18:59:36 +0000 Subject: [PATCH] 2007-10-16 Dan Williams * libnm-util/nm-client.c - (nm_client_activate_device): convert NULL specific_object to "/", which is used in place of NULL * src/nm-manager.c - (impl_manager_activate_device): convert "/" specific_object back into NULL git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2979 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 10 ++++++++++ libnm-glib/nm-client.c | 7 +++++++ src/nm-manager.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 435f2201e6..0924c519f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-10-16 Dan Williams + + * libnm-util/nm-client.c + - (nm_client_activate_device): convert NULL specific_object to "/", + which is used in place of NULL + + * src/nm-manager.c + - (impl_manager_activate_device): convert "/" specific_object back into + NULL + 2007-10-16 Tambet Ingo Implement a generic NMSetting creator from setting name. diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index da9989aad5..e48a2bdb9d 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -518,12 +518,19 @@ nm_client_activate_device (NMClient *client, gpointer user_data) { ActivateDeviceInfo *info; + char *internal_so = (char *) specific_object; g_return_if_fail (NM_IS_CLIENT (client)); g_return_if_fail (NM_IS_DEVICE (device)); g_return_if_fail (service_name != NULL); g_return_if_fail (connection_path != NULL); + /* NULL specific object must be translated into "/" because D-Bus does + * not have any idea of NULL object paths. + */ + if (internal_so == NULL) + internal_so = "/"; + info = g_slice_new (ActivateDeviceInfo); info->fn = callback; info->user_data = user_data; diff --git a/src/nm-manager.c b/src/nm-manager.c index 95c0d1ef52..5152d63054 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1229,6 +1229,7 @@ impl_manager_activate_device (NMManager *manager, NMConnectionType connection_type; NMConnection *connection; GError *err = NULL; + char *real_sop = NULL; device = nm_manager_get_device_by_path (manager, device_path); if (!device) { @@ -1247,12 +1248,16 @@ impl_manager_activate_device (NMManager *manager, goto err; } + /* "/" is special-cased to NULL to get through D-Bus */ + if (specific_object_path && strcmp (specific_object_path, "/")) + real_sop = g_strdup (specific_object_path); + connection = nm_manager_get_connection_by_object_path (manager, connection_type, connection_path); if (connection) { // FIXME: remove old_dev deactivation when multiple device support lands deactivate_old_device (manager); - if (nm_manager_activate_device (manager, device, connection, specific_object_path, TRUE)) { + if (nm_manager_activate_device (manager, device, connection, real_sop, TRUE)) { dbus_g_method_return (context, TRUE); } else { err = nm_manager_error_new ("Error in device activation"); @@ -1276,7 +1281,7 @@ impl_manager_activate_device (NMManager *manager, info->device = g_object_ref (device); info->connection_type = connection_type; info->connection_path = g_strdup (connection_path); - info->specific_object_path = g_strdup (specific_object_path); + info->specific_object_path = g_strdup (real_sop); info->timeout_id = g_timeout_add (5000, wait_for_connection_expired, manager); // FIXME: should probably be per-device, not global to the manager @@ -1288,6 +1293,8 @@ impl_manager_activate_device (NMManager *manager, dbus_g_method_return_error (context, err); g_error_free (err); } + + g_free (real_sop); } static GValueArray *