diff options
-rw-r--r-- | clients/cli/connections.c | 8 | ||||
-rw-r--r-- | clients/cli/devices.c | 5 | ||||
-rw-r--r-- | clients/cli/general.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-wifi.c | 17 | ||||
-rw-r--r-- | libnm/nm-device.c | 26 | ||||
-rw-r--r-- | libnm/nm-manager.c | 60 | ||||
-rw-r--r-- | libnm/nm-object.c | 6 | ||||
-rw-r--r-- | libnm/nm-remote-connection.c | 55 | ||||
-rw-r--r-- | libnm/nm-remote-settings.c | 35 | ||||
-rw-r--r-- | libnm/nm-secret-agent.c | 9 | ||||
-rw-r--r-- | libnm/nm-vpn-plugin.c | 5 |
11 files changed, 160 insertions, 68 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 782ed9af96..5c239563bf 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -1856,7 +1856,6 @@ activate_connection_cb (GObject *client, GAsyncResult *result, gpointer user_dat active = nm_client_activate_connection_finish (NM_CLIENT (client), result, &error); if (error) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: Connection activation failed: %s"), error->message); g_error_free (error); @@ -4958,7 +4957,6 @@ add_connection_cb (GObject *client, connection = nm_client_add_connection_finish (NM_CLIENT (client), result, &error); if (error) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: Failed to add '%s' connection: %s"), info->con_name, error->message); @@ -7461,7 +7459,6 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t g_cond_wait (&nmc_editor_cond, &nmc_editor_mutex); if (nmc_editor_error) { - g_dbus_error_strip_remote_error (nmc_editor_error); g_print (_("Error: Failed to save '%s' (%s) connection: %s\n"), nm_connection_get_id (connection), nm_connection_get_uuid (connection), @@ -7549,7 +7546,6 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t g_cond_wait (&nmc_editor_cond, &nmc_editor_mutex); if (nmc_editor_error) { - g_dbus_error_strip_remote_error (nmc_editor_error); g_print (_("Error: Failed to activate '%s' (%s) connection: %s\n"), nm_connection_get_id (connection), nm_connection_get_uuid (connection), @@ -8003,7 +7999,6 @@ modify_connection_cb (GObject *connection, if (!nm_remote_connection_commit_changes_finish (NM_REMOTE_CONNECTION (connection), result, &error)) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: Failed to modify connection '%s': %s"), nm_connection_get_id (NM_CONNECTION (connection)), @@ -8216,7 +8211,6 @@ delete_cb (GObject *con, GAsyncResult *result, gpointer user_data) GError *error = NULL; if (!nm_remote_connection_delete_finish (NM_REMOTE_CONNECTION (con), result, &error)) { - g_dbus_error_strip_remote_error (error); g_string_printf (info->nmc->return_text, _("Error: Connection deletion failed: %s"), error->message); g_error_free (error); @@ -8341,7 +8335,6 @@ do_connection_reload (NmCli *nmc, int argc, char **argv) } if (!nm_client_reload_connections (nmc->client, NULL, &error)) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: failed to reload connections: %s."), error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; @@ -8381,7 +8374,6 @@ do_connection_load (NmCli *nmc, int argc, char **argv) nm_client_load_connections (nmc->client, filenames, &failures, NULL, &error); g_free (filenames); if (error) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: failed to load connection: %s."), error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 6d5f3a397e..d9b46d9457 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -1396,7 +1396,6 @@ add_and_activate_cb (GObject *client, active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error); if (error) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: Failed to add/activate new connection: %s"), error->message); g_error_free (error); @@ -1478,7 +1477,6 @@ connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data) return; } - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: Device activation failed: %s"), error->message); g_error_free (error); @@ -1621,7 +1619,6 @@ disconnect_device_cb (GObject *object, GAsyncResult *result, gpointer user_data) GError *error = NULL; if (!nm_device_disconnect_finish (device, result, &error)) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: Device '%s' (%s) disconnecting failed: %s"), nm_device_get_iface (device), nm_object_get_path (NM_OBJECT (device)), @@ -1727,7 +1724,6 @@ delete_device_cb (GObject *object, GAsyncResult *result, gpointer user_data) GError *error = NULL; if (!nm_device_delete_finish (device, result, &error)) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: Device '%s' (%s) deletion failed: %s"), nm_device_get_iface (device), nm_object_get_path (NM_OBJECT (device)), @@ -2411,7 +2407,6 @@ request_rescan_cb (GObject *object, GAsyncResult *result, gpointer user_data) nm_device_wifi_request_scan_finish (NM_DEVICE_WIFI (object), result, &error); if (error) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: %s."), error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; g_error_free (error); diff --git a/clients/cli/general.c b/clients/cli/general.c index a4face54cc..531d4f7acd 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -542,7 +542,6 @@ save_hostname_cb (GObject *object, GAsyncResult *result, gpointer user_data) nm_client_save_hostname_finish (NM_CLIENT (object), result, &error); if (error) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: failed to set hostname: %s"), error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; @@ -653,7 +652,6 @@ do_general (NmCli *nmc, int argc, char **argv) nmc->get_client (nmc); /* create NMClient */ nm_client_set_logging (nmc->client, level, domains, &error); if (error) { - g_dbus_error_strip_remote_error (error); g_string_printf (nmc->return_text, _("Error: failed to set logging: %s"), error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c index 219f558f54..c57c19c3f9 100644 --- a/libnm/nm-device-wifi.c +++ b/libnm/nm-device-wifi.c @@ -288,12 +288,17 @@ nm_device_wifi_request_scan (NMDeviceWifi *device, GCancellable *cancellable, GError **error) { + gboolean ret; + g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), FALSE); - return nmdbus_device_wifi_call_request_scan_sync (NM_DEVICE_WIFI_GET_PRIVATE (device)->proxy, - g_variant_new_array (G_VARIANT_TYPE ("{sv}"), - NULL, 0), - cancellable, error); + ret = nmdbus_device_wifi_call_request_scan_sync (NM_DEVICE_WIFI_GET_PRIVATE (device)->proxy, + g_variant_new_array (G_VARIANT_TYPE ("{sv}"), + NULL, 0), + cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -310,8 +315,10 @@ request_scan_cb (GObject *source, if (nmdbus_device_wifi_call_request_scan_finish (NMDBUS_DEVICE_WIFI (source), result, &error)) g_simple_async_result_set_op_res_gboolean (info->simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (info->simple, error); + } g_simple_async_result_complete (info->simple); g_object_unref (info->simple); diff --git a/libnm/nm-device.c b/libnm/nm-device.c index 89d8e7d26d..bf7cbe9357 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -1900,10 +1900,15 @@ nm_device_disconnect (NMDevice *device, GCancellable *cancellable, GError **error) { + gboolean ret; + g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); - return nmdbus_device_call_disconnect_sync (NM_DEVICE_GET_PRIVATE (device)->proxy, - cancellable, error); + ret = nmdbus_device_call_disconnect_sync (NM_DEVICE_GET_PRIVATE (device)->proxy, + cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -1916,8 +1921,10 @@ device_disconnect_cb (GObject *proxy, if (nmdbus_device_call_disconnect_finish (NMDBUS_DEVICE (proxy), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); @@ -1995,10 +2002,15 @@ nm_device_delete (NMDevice *device, GCancellable *cancellable, GError **error) { + gboolean ret; + g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); - return nmdbus_device_call_delete_sync (NM_DEVICE_GET_PRIVATE (device)->proxy, - cancellable, error); + ret = nmdbus_device_call_delete_sync (NM_DEVICE_GET_PRIVATE (device)->proxy, + cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -2011,8 +2023,10 @@ device_delete_cb (GObject *proxy, if (nmdbus_device_call_delete_finish (NMDBUS_DEVICE (proxy), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index 4088548344..7e8d1bbf2b 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -312,6 +312,8 @@ get_permissions_sync (NMManager *self, GError **error) g_variant_unref (permissions); return TRUE; } else { + if (error && *error) + g_dbus_error_strip_remote_error (*error); update_permissions (self, NULL); return FALSE; } @@ -409,11 +411,16 @@ nm_manager_networking_get_enabled (NMManager *manager) gboolean nm_manager_networking_set_enabled (NMManager *manager, gboolean enable, GError **error) { + gboolean ret; + g_return_val_if_fail (NM_IS_MANAGER (manager), FALSE); - return nmdbus_manager_call_enable_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, - enable, - NULL, error); + ret = nmdbus_manager_call_enable_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + enable, + NULL, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } gboolean @@ -500,6 +507,8 @@ nm_manager_wimax_hardware_get_enabled (NMManager *manager) gboolean nm_manager_get_logging (NMManager *manager, char **level, char **domains, GError **error) { + gboolean ret; + g_return_val_if_fail (NM_IS_MANAGER (manager), FALSE); g_return_val_if_fail (level == NULL || *level == NULL, FALSE); g_return_val_if_fail (domains == NULL || *domains == NULL, FALSE); @@ -508,14 +517,19 @@ nm_manager_get_logging (NMManager *manager, char **level, char **domains, GError if (!level && !domains) return TRUE; - return nmdbus_manager_call_get_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, - level, domains, - NULL, error); + ret = nmdbus_manager_call_get_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + level, domains, + NULL, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } gboolean nm_manager_set_logging (NMManager *manager, const char *level, const char *domains, GError **error) { + gboolean ret; + g_return_val_if_fail (NM_IS_MANAGER (manager), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -527,9 +541,12 @@ nm_manager_set_logging (NMManager *manager, const char *level, const char *domai if (!domains) domains = ""; - return nmdbus_manager_call_set_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, - level, domains, - NULL, error); + ret = nmdbus_manager_call_set_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + level, domains, + NULL, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } NMClientPermissionResult @@ -567,8 +584,11 @@ nm_manager_check_connectivity (NMManager *manager, &connectivity, cancellable, error)) return connectivity; - else + else { + if (error && *error) + g_dbus_error_strip_remote_error (*error); return NM_CONNECTIVITY_UNKNOWN; + } } static void @@ -584,8 +604,10 @@ check_connectivity_cb (GObject *object, &connectivity, result, &error)) g_simple_async_result_set_op_res_gssize (simple, connectivity); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); @@ -830,6 +852,7 @@ activate_cb (GObject *object, recheck_pending_activations (info->manager); } else { + g_dbus_error_strip_remote_error (error); activate_info_complete (info, NULL, error); g_clear_error (&error); } @@ -905,6 +928,7 @@ add_activate_cb (GObject *object, recheck_pending_activations (info->manager); } else { + g_dbus_error_strip_remote_error (error); activate_info_complete (info, NULL, error); g_clear_error (&error); } @@ -1041,14 +1065,18 @@ nm_manager_deactivate_connection (NMManager *manager, GError **error) { const char *path; + gboolean ret; g_return_val_if_fail (NM_IS_MANAGER (manager), FALSE); g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (active), FALSE); path = nm_object_get_path (NM_OBJECT (active)); - return nmdbus_manager_call_deactivate_connection_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, - path, - cancellable, error); + ret = nmdbus_manager_call_deactivate_connection_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + path, + cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -1062,8 +1090,10 @@ deactivated_cb (GObject *object, if (nmdbus_manager_call_deactivate_connection_finish (NMDBUS_MANAGER (object), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); } diff --git a/libnm/nm-object.c b/libnm/nm-object.c index 65186577eb..3bb62336b5 100644 --- a/libnm/nm-object.c +++ b/libnm/nm-object.c @@ -1445,8 +1445,11 @@ _nm_object_reload_properties (NMObject *object, GError **error) g_variant_new ("(s)", interface), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); - if (!ret) + if (!ret) { + if (error && *error) + g_dbus_error_strip_remote_error (*error); return FALSE; + } g_variant_get (ret, "(@a{sv})", &props); process_properties_changed (object, props, TRUE); @@ -1581,6 +1584,7 @@ reload_got_properties (GObject *proxy, g_variant_unref (props); g_variant_unref (ret); } else { + g_dbus_error_strip_remote_error (error); if (priv->reload_error) g_error_free (error); else diff --git a/libnm/nm-remote-connection.c b/libnm/nm-remote-connection.c index a1f4dc9f5f..a8592231cd 100644 --- a/libnm/nm-remote-connection.c +++ b/libnm/nm-remote-connection.c @@ -87,6 +87,7 @@ nm_remote_connection_commit_changes (NMRemoteConnection *connection, { NMRemoteConnectionPrivate *priv; GVariant *settings; + gboolean ret; g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE); @@ -94,14 +95,17 @@ nm_remote_connection_commit_changes (NMRemoteConnection *connection, settings = nm_connection_to_dbus (NM_CONNECTION (connection), NM_CONNECTION_SERIALIZE_ALL); if (save_to_disk) { - return nmdbus_settings_connection_call_update_sync (priv->proxy, - settings, - cancellable, error); + ret = nmdbus_settings_connection_call_update_sync (priv->proxy, + settings, + cancellable, error); } else { - return nmdbus_settings_connection_call_update_unsaved_sync (priv->proxy, - settings, - cancellable, error); + ret = nmdbus_settings_connection_call_update_unsaved_sync (priv->proxy, + settings, + cancellable, error); } + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -114,8 +118,10 @@ update_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) finish_func = g_object_get_data (G_OBJECT (simple), "finish_func"); if (finish_func (NMDBUS_SETTINGS_CONNECTION (proxy), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); } @@ -212,12 +218,16 @@ nm_remote_connection_save (NMRemoteConnection *connection, GError **error) { NMRemoteConnectionPrivate *priv; + gboolean ret; g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE); priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection); - return nmdbus_settings_connection_call_save_sync (priv->proxy, cancellable, error); + ret = nmdbus_settings_connection_call_save_sync (priv->proxy, cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -229,8 +239,10 @@ save_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) if (nmdbus_settings_connection_call_save_finish (NMDBUS_SETTINGS_CONNECTION (proxy), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); } @@ -305,12 +317,16 @@ nm_remote_connection_delete (NMRemoteConnection *connection, GError **error) { NMRemoteConnectionPrivate *priv; + gboolean ret; g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE); priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection); - return nmdbus_settings_connection_call_delete_sync (priv->proxy, cancellable, error); + ret = nmdbus_settings_connection_call_delete_sync (priv->proxy, cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -322,8 +338,10 @@ delete_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) if (nmdbus_settings_connection_call_delete_finish (NMDBUS_SETTINGS_CONNECTION (proxy), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); } @@ -412,8 +430,11 @@ nm_remote_connection_get_secrets (NMRemoteConnection *connection, &secrets, cancellable, error)) return secrets; - else + else { + if (error && *error) + g_dbus_error_strip_remote_error (*error); return NULL; + } } static void @@ -426,8 +447,10 @@ get_secrets_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) if (nmdbus_settings_connection_call_get_secrets_finish (NMDBUS_SETTINGS_CONNECTION (proxy), &secrets, result, &error)) g_simple_async_result_set_op_res_gpointer (simple, secrets, (GDestroyNotify) g_variant_unref); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); @@ -627,8 +650,11 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) if (!nmdbus_settings_connection_call_get_settings_sync (priv->proxy, &settings, - cancellable, error)) + cancellable, error)) { + if (error && *error) + g_dbus_error_strip_remote_error (*error); return FALSE; + } priv->visible = TRUE; replace_settings (self, settings); @@ -669,6 +695,7 @@ init_get_settings_cb (GObject *proxy, if (!nmdbus_settings_connection_call_get_settings_finish (priv->proxy, &settings, result, &error)) { + g_dbus_error_strip_remote_error (error); init_async_complete (init_data, error); return; } diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c index e072e9ac1c..1119e8a7d8 100644 --- a/libnm/nm-remote-settings.c +++ b/libnm/nm-remote-settings.c @@ -297,6 +297,7 @@ add_connection_done (GObject *proxy, GAsyncResult *result, gpointer user_data) } if (error) { + g_dbus_error_strip_remote_error (error); add_connection_info_complete (info->self, info, NULL, error); g_clear_error (&error); } @@ -381,9 +382,11 @@ nm_remote_settings_load_connections (NMRemoteSettings *settings, (const char * const *) filenames, &success, failures, - cancellable, error)) + cancellable, error)) { + if (error && *error) + g_dbus_error_strip_remote_error (*error); success = FALSE; - + } return success; } @@ -399,8 +402,10 @@ load_connections_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) &success, &failures, result, &error)) g_simple_async_result_set_op_res_gpointer (simple, failures, (GDestroyNotify) g_strfreev); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); @@ -461,8 +466,11 @@ nm_remote_settings_reload_connections (NMRemoteSettings *settings, priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings); if (!nmdbus_settings_call_reload_connections_sync (priv->proxy, &success, - cancellable, error)) + cancellable, error)) { + if (error && *error) + g_dbus_error_strip_remote_error (*error); success = FALSE; + } return success; } @@ -478,8 +486,10 @@ reload_connections_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) &success, result, &error)) g_simple_async_result_set_op_res_gboolean (simple, success); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); @@ -528,14 +538,19 @@ nm_remote_settings_save_hostname (NMRemoteSettings *settings, GError **error) { NMRemoteSettingsPrivate *priv; + gboolean ret; + g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE); priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings); - return nmdbus_settings_call_save_hostname_sync (priv->proxy, - hostname ? hostname : "", - cancellable, error); + ret = nmdbus_settings_call_save_hostname_sync (priv->proxy, + hostname ? hostname : "", + cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return ret; } static void @@ -548,8 +563,10 @@ save_hostname_cb (GObject *proxy, if (nmdbus_settings_call_save_hostname_finish (NMDBUS_SETTINGS (proxy), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); } diff --git a/libnm/nm-secret-agent.c b/libnm/nm-secret-agent.c index 1cba0b77a4..93555c4151 100644 --- a/libnm/nm-secret-agent.c +++ b/libnm/nm-secret-agent.c @@ -598,7 +598,8 @@ reg_request_cb (GObject *proxy, g_object_unref (self); /* drop extra ref added by get_source_object() */ priv = NM_SECRET_AGENT_GET_PRIVATE (self); - nmdbus_agent_manager_call_register_finish (NMDBUS_AGENT_MANAGER (proxy), result, &error); + if (!nmdbus_agent_manager_call_register_finish (NMDBUS_AGENT_MANAGER (proxy), result, &error)) + g_dbus_error_strip_remote_error (error); reg_result (self, simple, error); g_clear_error (&error); } @@ -757,6 +758,8 @@ nm_secret_agent_unregister (NMSecretAgent *self, priv->suppress_auto = TRUE; success = nmdbus_agent_manager_call_unregister_sync (priv->manager_proxy, cancellable, error); + if (error && *error) + g_dbus_error_strip_remote_error (*error); _internal_unregister (self); return success; @@ -777,8 +780,10 @@ unregister_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) if (nmdbus_agent_manager_call_unregister_finish (NMDBUS_AGENT_MANAGER (proxy), result, &error)) g_simple_async_result_set_op_res_gboolean (simple, TRUE); - else + else { + g_dbus_error_strip_remote_error (error); g_simple_async_result_take_error (simple, error); + } g_simple_async_result_complete (simple); g_object_unref (simple); diff --git a/libnm/nm-vpn-plugin.c b/libnm/nm-vpn-plugin.c index ed61052ad8..f6e00dbb24 100644 --- a/libnm/nm-vpn-plugin.c +++ b/libnm/nm-vpn-plugin.c @@ -735,8 +735,11 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) G_DBUS_CALL_FLAGS_NONE, 0, cancellable, error); g_object_unref (proxy); - if (!ret) + if (!ret) { + if (error && *error) + g_dbus_error_strip_remote_error (*error); goto out; + } g_variant_unref (ret); priv->dbus_vpn_plugin = nmdbus_vpn_plugin_skeleton_new (); |