|
|
1e691d |
From b1d87d540c2229dc9954efe73feebcaf5aad41eb Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Wed, 27 May 2015 15:15:09 +0200
|
|
|
1e691d |
Subject: [PATCH 01/12] daemon: Style fixes
|
|
|
1e691d |
|
|
|
1e691d |
Use the name 'self' to refer to the instance.
|
|
|
1e691d |
---
|
|
|
1e691d |
src/daemon/goadaemon.c | 138 ++++++++++++++++++++++++-------------------------
|
|
|
1e691d |
1 file changed, 69 insertions(+), 69 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
|
|
|
1e691d |
index 89cbed8..55a576d 100644
|
|
|
1e691d |
--- a/src/daemon/goadaemon.c
|
|
|
1e691d |
+++ b/src/daemon/goadaemon.c
|
|
|
1e691d |
@@ -1,6 +1,6 @@
|
|
|
1e691d |
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
1e691d |
/*
|
|
|
1e691d |
- * Copyright (C) 2011, 2012 Red Hat, Inc.
|
|
|
1e691d |
+ * Copyright (C) 2011, 2012, 2015 Red Hat, Inc.
|
|
|
1e691d |
*
|
|
|
1e691d |
* This library is free software; you can redistribute it and/or
|
|
|
1e691d |
* modify it under the terms of the GNU Lesser General Public
|
|
|
1e691d |
@@ -71,39 +71,39 @@ static gboolean on_account_handle_ensure_credentials (GoaAccount *acc
|
|
|
1e691d |
GDBusMethodInvocation *invocation,
|
|
|
1e691d |
gpointer user_data);
|
|
|
1e691d |
|
|
|
1e691d |
-static void goa_daemon_reload_configuration (GoaDaemon *daemon);
|
|
|
1e691d |
+static void goa_daemon_reload_configuration (GoaDaemon *self);
|
|
|
1e691d |
|
|
|
1e691d |
G_DEFINE_TYPE (GoaDaemon, goa_daemon, G_TYPE_OBJECT);
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
goa_daemon_finalize (GObject *object)
|
|
|
1e691d |
{
|
|
|
1e691d |
- GoaDaemon *daemon = GOA_DAEMON (object);
|
|
|
1e691d |
+ GoaDaemon *self = GOA_DAEMON (object);
|
|
|
1e691d |
|
|
|
1e691d |
- if (daemon->config_timeout_id != 0)
|
|
|
1e691d |
+ if (self->config_timeout_id != 0)
|
|
|
1e691d |
{
|
|
|
1e691d |
- g_source_remove (daemon->config_timeout_id);
|
|
|
1e691d |
+ g_source_remove (self->config_timeout_id);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
- if (daemon->system_conf_dir_monitor != NULL)
|
|
|
1e691d |
+ if (self->system_conf_dir_monitor != NULL)
|
|
|
1e691d |
{
|
|
|
1e691d |
- g_signal_handlers_disconnect_by_func (daemon->system_conf_dir_monitor, on_file_monitor_changed, daemon);
|
|
|
1e691d |
- g_object_unref (daemon->system_conf_dir_monitor);
|
|
|
1e691d |
+ g_signal_handlers_disconnect_by_func (self->system_conf_dir_monitor, on_file_monitor_changed, self);
|
|
|
1e691d |
+ g_object_unref (self->system_conf_dir_monitor);
|
|
|
1e691d |
}
|
|
|
1e691d |
- if (daemon->home_conf_dir_monitor != NULL)
|
|
|
1e691d |
+ if (self->home_conf_dir_monitor != NULL)
|
|
|
1e691d |
{
|
|
|
1e691d |
- g_signal_handlers_disconnect_by_func (daemon->home_conf_dir_monitor, on_file_monitor_changed, daemon);
|
|
|
1e691d |
- g_object_unref (daemon->home_conf_dir_monitor);
|
|
|
1e691d |
+ g_signal_handlers_disconnect_by_func (self->home_conf_dir_monitor, on_file_monitor_changed, self);
|
|
|
1e691d |
+ g_object_unref (self->home_conf_dir_monitor);
|
|
|
1e691d |
}
|
|
|
1e691d |
- if (daemon->home_conf_file_monitor != NULL)
|
|
|
1e691d |
+ if (self->home_conf_file_monitor != NULL)
|
|
|
1e691d |
{
|
|
|
1e691d |
- g_signal_handlers_disconnect_by_func (daemon->home_conf_file_monitor, on_file_monitor_changed, daemon);
|
|
|
1e691d |
- g_object_unref (daemon->home_conf_file_monitor);
|
|
|
1e691d |
+ g_signal_handlers_disconnect_by_func (self->home_conf_file_monitor, on_file_monitor_changed, self);
|
|
|
1e691d |
+ g_object_unref (self->home_conf_file_monitor);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
- g_object_unref (daemon->manager);
|
|
|
1e691d |
- g_object_unref (daemon->object_manager);
|
|
|
1e691d |
- g_object_unref (daemon->connection);
|
|
|
1e691d |
+ g_object_unref (self->manager);
|
|
|
1e691d |
+ g_object_unref (self->object_manager);
|
|
|
1e691d |
+ g_object_unref (self->connection);
|
|
|
1e691d |
|
|
|
1e691d |
G_OBJECT_CLASS (goa_daemon_parent_class)->finalize (object);
|
|
|
1e691d |
}
|
|
|
1e691d |
@@ -138,11 +138,11 @@ create_monitor (const gchar *path, gboolean is_dir)
|
|
|
1e691d |
static gboolean
|
|
|
1e691d |
on_config_file_monitor_timeout (gpointer user_data)
|
|
|
1e691d |
{
|
|
|
1e691d |
- GoaDaemon *daemon = GOA_DAEMON (user_data);
|
|
|
1e691d |
+ GoaDaemon *self = GOA_DAEMON (user_data);
|
|
|
1e691d |
|
|
|
1e691d |
- daemon->config_timeout_id = 0;
|
|
|
1e691d |
+ self->config_timeout_id = 0;
|
|
|
1e691d |
g_info ("Reloading configuration files\n");
|
|
|
1e691d |
- goa_daemon_reload_configuration (daemon);
|
|
|
1e691d |
+ goa_daemon_reload_configuration (self);
|
|
|
1e691d |
|
|
|
1e691d |
return FALSE;
|
|
|
1e691d |
}
|
|
|
1e691d |
@@ -154,17 +154,17 @@ on_file_monitor_changed (GFileMonitor *monitor,
|
|
|
1e691d |
GFileMonitorEvent event_type,
|
|
|
1e691d |
gpointer user_data)
|
|
|
1e691d |
{
|
|
|
1e691d |
- GoaDaemon *daemon = GOA_DAEMON (user_data);
|
|
|
1e691d |
+ GoaDaemon *self = GOA_DAEMON (user_data);
|
|
|
1e691d |
|
|
|
1e691d |
- if (daemon->config_timeout_id == 0)
|
|
|
1e691d |
+ if (self->config_timeout_id == 0)
|
|
|
1e691d |
{
|
|
|
1e691d |
- daemon->config_timeout_id = g_timeout_add (200, on_config_file_monitor_timeout, daemon);
|
|
|
1e691d |
+ self->config_timeout_id = g_timeout_add (200, on_config_file_monitor_timeout, self);
|
|
|
1e691d |
}
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
#ifdef GOA_KERBEROS_ENABLED
|
|
|
1e691d |
static void
|
|
|
1e691d |
-activate_identity_service (GoaDaemon *daemon)
|
|
|
1e691d |
+activate_identity_service (GoaDaemon *self)
|
|
|
1e691d |
{
|
|
|
1e691d |
GoaProvider *provider;
|
|
|
1e691d |
|
|
|
1e691d |
@@ -183,7 +183,7 @@ activate_identity_service (GoaDaemon *daemon)
|
|
|
1e691d |
#endif
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
-goa_daemon_init (GoaDaemon *daemon)
|
|
|
1e691d |
+goa_daemon_init (GoaDaemon *self)
|
|
|
1e691d |
{
|
|
|
1e691d |
static volatile GQuark goa_error_domain = 0;
|
|
|
1e691d |
GoaObjectSkeleton *object;
|
|
|
1e691d |
@@ -196,20 +196,20 @@ goa_daemon_init (GoaDaemon *daemon)
|
|
|
1e691d |
goa_error_domain; /* shut up -Wunused-but-set-variable */
|
|
|
1e691d |
|
|
|
1e691d |
/* TODO: maybe nicer to pass in a GDBusConnection* construct property */
|
|
|
1e691d |
- daemon->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
|
|
1e691d |
+ self->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
|
|
1e691d |
|
|
|
1e691d |
/* Create object manager */
|
|
|
1e691d |
- daemon->object_manager = g_dbus_object_manager_server_new ("/org/gnome/OnlineAccounts");
|
|
|
1e691d |
+ self->object_manager = g_dbus_object_manager_server_new ("/org/gnome/OnlineAccounts");
|
|
|
1e691d |
|
|
|
1e691d |
/* Create and export Manager */
|
|
|
1e691d |
- daemon->manager = goa_manager_skeleton_new ();
|
|
|
1e691d |
- g_signal_connect (daemon->manager,
|
|
|
1e691d |
+ self->manager = goa_manager_skeleton_new ();
|
|
|
1e691d |
+ g_signal_connect (self->manager,
|
|
|
1e691d |
"handle-add-account",
|
|
|
1e691d |
G_CALLBACK (on_manager_handle_add_account),
|
|
|
1e691d |
- daemon);
|
|
|
1e691d |
+ self);
|
|
|
1e691d |
object = goa_object_skeleton_new ("/org/gnome/OnlineAccounts/Manager");
|
|
|
1e691d |
- goa_object_skeleton_set_manager (object, daemon->manager);
|
|
|
1e691d |
- g_dbus_object_manager_server_export (daemon->object_manager, G_DBUS_OBJECT_SKELETON (object));
|
|
|
1e691d |
+ goa_object_skeleton_set_manager (object, self->manager);
|
|
|
1e691d |
+ g_dbus_object_manager_server_export (self->object_manager, G_DBUS_OBJECT_SKELETON (object));
|
|
|
1e691d |
g_object_unref (object);
|
|
|
1e691d |
|
|
|
1e691d |
/* create ~/.config/goa-1.0 directory */
|
|
|
1e691d |
@@ -222,19 +222,19 @@ goa_daemon_init (GoaDaemon *daemon)
|
|
|
1e691d |
|
|
|
1e691d |
/* set up file monitoring */
|
|
|
1e691d |
path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
|
|
|
1e691d |
- daemon->home_conf_file_monitor = create_monitor (path, FALSE);
|
|
|
1e691d |
- if (daemon->home_conf_file_monitor != NULL)
|
|
|
1e691d |
- g_signal_connect (daemon->home_conf_file_monitor, "changed", G_CALLBACK (on_file_monitor_changed), daemon);
|
|
|
1e691d |
+ self->home_conf_file_monitor = create_monitor (path, FALSE);
|
|
|
1e691d |
+ if (self->home_conf_file_monitor != NULL)
|
|
|
1e691d |
+ g_signal_connect (self->home_conf_file_monitor, "changed", G_CALLBACK (on_file_monitor_changed), self);
|
|
|
1e691d |
g_free (path);
|
|
|
1e691d |
|
|
|
1e691d |
/* prime the list of accounts */
|
|
|
1e691d |
- goa_daemon_reload_configuration (daemon);
|
|
|
1e691d |
+ goa_daemon_reload_configuration (self);
|
|
|
1e691d |
|
|
|
1e691d |
/* Export objects */
|
|
|
1e691d |
- g_dbus_object_manager_server_set_connection (daemon->object_manager, daemon->connection);
|
|
|
1e691d |
+ g_dbus_object_manager_server_set_connection (self->object_manager, self->connection);
|
|
|
1e691d |
|
|
|
1e691d |
#ifdef GOA_KERBEROS_ENABLED
|
|
|
1e691d |
- activate_identity_service (daemon);
|
|
|
1e691d |
+ activate_identity_service (self);
|
|
|
1e691d |
#endif
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
@@ -331,7 +331,7 @@ key_file_data_new (GKeyFile *key_file,
|
|
|
1e691d |
/* ---------------------------------------------------------------------------------------------------- */
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
-add_config_file (GoaDaemon *daemon,
|
|
|
1e691d |
+add_config_file (GoaDaemon *self,
|
|
|
1e691d |
const gchar *path,
|
|
|
1e691d |
GHashTable *group_name_to_key_file_data,
|
|
|
1e691d |
GList **key_files_to_free)
|
|
|
1e691d |
@@ -363,7 +363,7 @@ add_config_file (GoaDaemon *daemon,
|
|
|
1e691d |
gsize num_groups;
|
|
|
1e691d |
guint n;
|
|
|
1e691d |
|
|
|
1e691d |
- guid = g_dbus_connection_get_guid (daemon->connection);
|
|
|
1e691d |
+ guid = g_dbus_connection_get_guid (self->connection);
|
|
|
1e691d |
groups = g_key_file_get_groups (key_file, &num_groups);
|
|
|
1e691d |
for (n = 0; n < num_groups; n++)
|
|
|
1e691d |
{
|
|
|
1e691d |
@@ -421,7 +421,7 @@ add_config_file (GoaDaemon *daemon,
|
|
|
1e691d |
|
|
|
1e691d |
/* returns FALSE if object is not (or no longer) valid */
|
|
|
1e691d |
static gboolean
|
|
|
1e691d |
-update_account_object (GoaDaemon *daemon,
|
|
|
1e691d |
+update_account_object (GoaDaemon *self,
|
|
|
1e691d |
GoaObjectSkeleton *object,
|
|
|
1e691d |
const gchar *path,
|
|
|
1e691d |
const gchar *group,
|
|
|
1e691d |
@@ -439,7 +439,7 @@ update_account_object (GoaDaemon *daemon,
|
|
|
1e691d |
gchar *serialized_icon;
|
|
|
1e691d |
GError *error;
|
|
|
1e691d |
|
|
|
1e691d |
- g_return_val_if_fail (GOA_IS_DAEMON (daemon), FALSE);
|
|
|
1e691d |
+ g_return_val_if_fail (GOA_IS_DAEMON (self), FALSE);
|
|
|
1e691d |
g_return_val_if_fail (G_IS_DBUS_OBJECT_SKELETON (object), FALSE);
|
|
|
1e691d |
g_return_val_if_fail (group != NULL, FALSE);
|
|
|
1e691d |
g_return_val_if_fail (key_file != NULL, FALSE);
|
|
|
1e691d |
@@ -480,7 +480,7 @@ update_account_object (GoaDaemon *daemon,
|
|
|
1e691d |
goa_account_set_presentation_identity (account, presentation_identity);
|
|
|
1e691d |
|
|
|
1e691d |
error = NULL;
|
|
|
1e691d |
- if (!goa_provider_build_object (provider, object, key_file, group, daemon->connection, just_added, &error))
|
|
|
1e691d |
+ if (!goa_provider_build_object (provider, object, key_file, group, self->connection, just_added, &error))
|
|
|
1e691d |
{
|
|
|
1e691d |
g_warning ("Error parsing account: %s (%s, %d)",
|
|
|
1e691d |
error->message, g_quark_to_string (error->domain), error->code);
|
|
|
1e691d |
@@ -519,7 +519,7 @@ object_path_to_group (const gchar *object_path)
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
-process_config_entries (GoaDaemon *daemon,
|
|
|
1e691d |
+process_config_entries (GoaDaemon *self,
|
|
|
1e691d |
GHashTable *group_name_to_key_file_data)
|
|
|
1e691d |
{
|
|
|
1e691d |
GHashTableIter iter;
|
|
|
1e691d |
@@ -535,7 +535,7 @@ process_config_entries (GoaDaemon *daemon,
|
|
|
1e691d |
existing_object_paths = NULL;
|
|
|
1e691d |
{
|
|
|
1e691d |
GList *existing_objects;
|
|
|
1e691d |
- existing_objects = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (daemon->object_manager));
|
|
|
1e691d |
+ existing_objects = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (self->object_manager));
|
|
|
1e691d |
for (l = existing_objects; l != NULL; l = l->next)
|
|
|
1e691d |
{
|
|
|
1e691d |
GoaObject *object = GOA_OBJECT (l->data);
|
|
|
1e691d |
@@ -579,13 +579,13 @@ process_config_entries (GoaDaemon *daemon,
|
|
|
1e691d |
{
|
|
|
1e691d |
const gchar *object_path = l->data;
|
|
|
1e691d |
GoaObject *object;
|
|
|
1e691d |
- object = GOA_OBJECT (g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (daemon->object_manager), object_path));
|
|
|
1e691d |
+ object = GOA_OBJECT (g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (self->object_manager), object_path));
|
|
|
1e691d |
g_warn_if_fail (object != NULL);
|
|
|
1e691d |
g_signal_handlers_disconnect_by_func (goa_object_peek_account (object),
|
|
|
1e691d |
G_CALLBACK (on_account_handle_remove),
|
|
|
1e691d |
daemon);
|
|
|
1e691d |
g_debug ("removing %s", object_path);
|
|
|
1e691d |
- g_warn_if_fail (g_dbus_object_manager_server_unexport (daemon->object_manager, object_path));
|
|
|
1e691d |
+ g_warn_if_fail (g_dbus_object_manager_server_unexport (self->object_manager, object_path));
|
|
|
1e691d |
}
|
|
|
1e691d |
for (l = added; l != NULL; l = l->next)
|
|
|
1e691d |
{
|
|
|
1e691d |
@@ -600,22 +600,22 @@ process_config_entries (GoaDaemon *daemon,
|
|
|
1e691d |
g_warn_if_fail (key_file_data != NULL);
|
|
|
1e691d |
|
|
|
1e691d |
object = goa_object_skeleton_new (object_path);
|
|
|
1e691d |
- if (update_account_object (daemon,
|
|
|
1e691d |
+ if (update_account_object (self,
|
|
|
1e691d |
object,
|
|
|
1e691d |
key_file_data->path,
|
|
|
1e691d |
group,
|
|
|
1e691d |
key_file_data->key_file,
|
|
|
1e691d |
TRUE))
|
|
|
1e691d |
{
|
|
|
1e691d |
- g_dbus_object_manager_server_export (daemon->object_manager, G_DBUS_OBJECT_SKELETON (object));
|
|
|
1e691d |
+ g_dbus_object_manager_server_export (self->object_manager, G_DBUS_OBJECT_SKELETON (object));
|
|
|
1e691d |
g_signal_connect (goa_object_peek_account (GOA_OBJECT (object)),
|
|
|
1e691d |
"handle-remove",
|
|
|
1e691d |
G_CALLBACK (on_account_handle_remove),
|
|
|
1e691d |
- daemon);
|
|
|
1e691d |
+ self);
|
|
|
1e691d |
g_signal_connect (goa_object_peek_account (GOA_OBJECT (object)),
|
|
|
1e691d |
"handle-ensure-credentials",
|
|
|
1e691d |
G_CALLBACK (on_account_handle_ensure_credentials),
|
|
|
1e691d |
- daemon);
|
|
|
1e691d |
+ self);
|
|
|
1e691d |
}
|
|
|
1e691d |
g_object_unref (object);
|
|
|
1e691d |
g_free (group);
|
|
|
1e691d |
@@ -632,9 +632,9 @@ process_config_entries (GoaDaemon *daemon,
|
|
|
1e691d |
key_file_data = g_hash_table_lookup (group_name_to_key_file_data, group);
|
|
|
1e691d |
g_warn_if_fail (key_file_data != NULL);
|
|
|
1e691d |
|
|
|
1e691d |
- object = GOA_OBJECT (g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (daemon->object_manager), object_path));
|
|
|
1e691d |
+ object = GOA_OBJECT (g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (self->object_manager), object_path));
|
|
|
1e691d |
g_warn_if_fail (object != NULL);
|
|
|
1e691d |
- if (!update_account_object (daemon,
|
|
|
1e691d |
+ if (!update_account_object (self,
|
|
|
1e691d |
GOA_OBJECT_SKELETON (object),
|
|
|
1e691d |
key_file_data->path,
|
|
|
1e691d |
group,
|
|
|
1e691d |
@@ -643,11 +643,11 @@ process_config_entries (GoaDaemon *daemon,
|
|
|
1e691d |
{
|
|
|
1e691d |
g_signal_handlers_disconnect_by_func (goa_object_peek_account (object),
|
|
|
1e691d |
G_CALLBACK (on_account_handle_remove),
|
|
|
1e691d |
- daemon);
|
|
|
1e691d |
+ self);
|
|
|
1e691d |
g_signal_handlers_disconnect_by_func (goa_object_peek_account (object),
|
|
|
1e691d |
G_CALLBACK (on_account_handle_ensure_credentials),
|
|
|
1e691d |
- daemon);
|
|
|
1e691d |
- g_warn_if_fail (g_dbus_object_manager_server_unexport (daemon->object_manager, object_path));
|
|
|
1e691d |
+ self);
|
|
|
1e691d |
+ g_warn_if_fail (g_dbus_object_manager_server_unexport (self->object_manager, object_path));
|
|
|
1e691d |
}
|
|
|
1e691d |
g_object_unref (object);
|
|
|
1e691d |
g_free (group);
|
|
|
1e691d |
@@ -664,14 +664,14 @@ process_config_entries (GoaDaemon *daemon,
|
|
|
1e691d |
|
|
|
1e691d |
/* <internal>
|
|
|
1e691d |
* goa_daemon_reload_configuration:
|
|
|
1e691d |
- * @daemon: A #GoaDaemon
|
|
|
1e691d |
+ * @self: A #GoaDaemon
|
|
|
1e691d |
*
|
|
|
1e691d |
* Updates the accounts_objects member from stored configuration -
|
|
|
1e691d |
* typically called at startup or when a change on the configuration
|
|
|
1e691d |
* files has been detected.
|
|
|
1e691d |
*/
|
|
|
1e691d |
static void
|
|
|
1e691d |
-goa_daemon_reload_configuration (GoaDaemon *daemon)
|
|
|
1e691d |
+goa_daemon_reload_configuration (GoaDaemon *self)
|
|
|
1e691d |
{
|
|
|
1e691d |
GList *key_files_to_free;
|
|
|
1e691d |
GHashTable *group_name_to_key_file_data;
|
|
|
1e691d |
@@ -685,11 +685,11 @@ goa_daemon_reload_configuration (GoaDaemon *daemon)
|
|
|
1e691d |
|
|
|
1e691d |
/* Read the main user config file at $HOME/.config/goa-1.0/accounts.conf */
|
|
|
1e691d |
path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
|
|
|
1e691d |
- add_config_file (daemon, path, group_name_to_key_file_data, &key_files_to_free);
|
|
|
1e691d |
+ add_config_file (self, path, group_name_to_key_file_data, &key_files_to_free);
|
|
|
1e691d |
g_free (path);
|
|
|
1e691d |
|
|
|
1e691d |
/* now process the group_name_to_key_file_data hash table */
|
|
|
1e691d |
- process_config_entries (daemon, group_name_to_key_file_data);
|
|
|
1e691d |
+ process_config_entries (self, group_name_to_key_file_data);
|
|
|
1e691d |
|
|
|
1e691d |
g_hash_table_unref (group_name_to_key_file_data);
|
|
|
1e691d |
g_list_foreach (key_files_to_free, (GFunc) g_key_file_free, NULL);
|
|
|
1e691d |
@@ -697,7 +697,7 @@ goa_daemon_reload_configuration (GoaDaemon *daemon)
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static gchar *
|
|
|
1e691d |
-generate_new_id (GoaDaemon *daemon)
|
|
|
1e691d |
+generate_new_id (GoaDaemon *self)
|
|
|
1e691d |
{
|
|
|
1e691d |
static guint counter = 0;
|
|
|
1e691d |
GDateTime *dt;
|
|
|
1e691d |
@@ -915,11 +915,11 @@ on_manager_handle_add_account (GoaManager *manager,
|
|
|
1e691d |
GVariant *details,
|
|
|
1e691d |
gpointer user_data)
|
|
|
1e691d |
{
|
|
|
1e691d |
- GoaDaemon *daemon = GOA_DAEMON (user_data);
|
|
|
1e691d |
+ GoaDaemon *self = GOA_DAEMON (user_data);
|
|
|
1e691d |
AddAccountData *data;
|
|
|
1e691d |
|
|
|
1e691d |
data = g_slice_new0 (AddAccountData);
|
|
|
1e691d |
- data->daemon = g_object_ref (daemon);
|
|
|
1e691d |
+ data->daemon = g_object_ref (self);
|
|
|
1e691d |
data->manager = g_object_ref (manager);
|
|
|
1e691d |
data->invocation = g_object_ref (invocation);
|
|
|
1e691d |
data->provider_type = g_strdup (provider_type);
|
|
|
1e691d |
@@ -940,7 +940,7 @@ on_account_handle_remove (GoaAccount *account,
|
|
|
1e691d |
GDBusMethodInvocation *invocation,
|
|
|
1e691d |
gpointer user_data)
|
|
|
1e691d |
{
|
|
|
1e691d |
- GoaDaemon *daemon = GOA_DAEMON (user_data);
|
|
|
1e691d |
+ GoaDaemon *self = GOA_DAEMON (user_data);
|
|
|
1e691d |
GoaProvider *provider;
|
|
|
1e691d |
GKeyFile *key_file;
|
|
|
1e691d |
const gchar *provider_type;
|
|
|
1e691d |
@@ -1037,7 +1037,7 @@ on_account_handle_remove (GoaAccount *account,
|
|
|
1e691d |
goto out;
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
- goa_daemon_reload_configuration (daemon);
|
|
|
1e691d |
+ goa_daemon_reload_configuration (self);
|
|
|
1e691d |
|
|
|
1e691d |
goa_account_complete_remove (account, invocation);
|
|
|
1e691d |
|
|
|
1e691d |
@@ -1062,13 +1062,13 @@ typedef struct
|
|
|
1e691d |
} EnsureData;
|
|
|
1e691d |
|
|
|
1e691d |
static EnsureData *
|
|
|
1e691d |
-ensure_data_new (GoaDaemon *daemon,
|
|
|
1e691d |
+ensure_data_new (GoaDaemon *self,
|
|
|
1e691d |
GoaObject *object,
|
|
|
1e691d |
GDBusMethodInvocation *invocation)
|
|
|
1e691d |
{
|
|
|
1e691d |
EnsureData *data;
|
|
|
1e691d |
data = g_slice_new0 (EnsureData);
|
|
|
1e691d |
- data->daemon = g_object_ref (daemon);
|
|
|
1e691d |
+ data->daemon = g_object_ref (self);
|
|
|
1e691d |
data->object = g_object_ref (object);
|
|
|
1e691d |
data->invocation = invocation;
|
|
|
1e691d |
return data;
|
|
|
1e691d |
@@ -1156,7 +1156,7 @@ on_account_handle_ensure_credentials (GoaAccount *account,
|
|
|
1e691d |
GDBusMethodInvocation *invocation,
|
|
|
1e691d |
gpointer user_data)
|
|
|
1e691d |
{
|
|
|
1e691d |
- GoaDaemon *daemon = GOA_DAEMON (user_data);
|
|
|
1e691d |
+ GoaDaemon *self = GOA_DAEMON (user_data);
|
|
|
1e691d |
GoaProvider *provider = NULL;
|
|
|
1e691d |
GoaObject *object;
|
|
|
1e691d |
|
|
|
1e691d |
@@ -1177,7 +1177,7 @@ on_account_handle_ensure_credentials (GoaAccount *account,
|
|
|
1e691d |
object,
|
|
|
1e691d |
NULL, /* GCancellable */
|
|
|
1e691d |
(GAsyncReadyCallback) ensure_credentials_cb,
|
|
|
1e691d |
- ensure_data_new (daemon, object, invocation));
|
|
|
1e691d |
+ ensure_data_new (self, object, invocation));
|
|
|
1e691d |
|
|
|
1e691d |
out:
|
|
|
1e691d |
g_clear_object (&provider);
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From dec43aa3281420cc8bbb51e70b0db27886d0080a Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Wed, 27 May 2015 17:17:42 +0200
|
|
|
1e691d |
Subject: [PATCH 02/12] daemon: Use G_SOURCE_REMOVE instead of FALSE
|
|
|
1e691d |
|
|
|
1e691d |
---
|
|
|
1e691d |
src/daemon/goadaemon.c | 2 +-
|
|
|
1e691d |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
|
|
|
1e691d |
index 55a576d..a7b2967 100644
|
|
|
1e691d |
--- a/src/daemon/goadaemon.c
|
|
|
1e691d |
+++ b/src/daemon/goadaemon.c
|
|
|
1e691d |
@@ -144,7 +144,7 @@ on_config_file_monitor_timeout (gpointer user_data)
|
|
|
1e691d |
g_info ("Reloading configuration files\n");
|
|
|
1e691d |
goa_daemon_reload_configuration (self);
|
|
|
1e691d |
|
|
|
1e691d |
- return FALSE;
|
|
|
1e691d |
+ return G_SOURCE_REMOVE;
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From 1e6a783a779efab7524b981c0c164bfa393577ae Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Wed, 27 May 2015 19:07:39 +0200
|
|
|
1e691d |
Subject: [PATCH 03/12] daemon: Use g_clear_object wherever applicable
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/daemon/goadaemon.c | 13 ++++++-------
|
|
|
1e691d |
1 file changed, 6 insertions(+), 7 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
|
|
|
1e691d |
index a7b2967..e6a559d 100644
|
|
|
1e691d |
--- a/src/daemon/goadaemon.c
|
|
|
1e691d |
+++ b/src/daemon/goadaemon.c
|
|
|
1e691d |
@@ -445,6 +445,8 @@ update_account_object (GoaDaemon *self,
|
|
|
1e691d |
g_return_val_if_fail (key_file != NULL, FALSE);
|
|
|
1e691d |
|
|
|
1e691d |
ret = FALSE;
|
|
|
1e691d |
+ account = NULL;
|
|
|
1e691d |
+ provider = NULL;
|
|
|
1e691d |
identity = NULL;
|
|
|
1e691d |
type = NULL;
|
|
|
1e691d |
account = NULL;
|
|
|
1e691d |
@@ -499,12 +501,10 @@ update_account_object (GoaDaemon *self,
|
|
|
1e691d |
|
|
|
1e691d |
out:
|
|
|
1e691d |
g_free (serialized_icon);
|
|
|
1e691d |
- if (icon != NULL)
|
|
|
1e691d |
- g_object_unref (icon);
|
|
|
1e691d |
+ g_clear_object (&icon);
|
|
|
1e691d |
g_free (name);
|
|
|
1e691d |
- if (provider != NULL)
|
|
|
1e691d |
- g_object_unref (provider);
|
|
|
1e691d |
- g_object_unref (account);
|
|
|
1e691d |
+ g_clear_object (&provider);
|
|
|
1e691d |
+ g_clear_object (&account);
|
|
|
1e691d |
g_free (type);
|
|
|
1e691d |
g_free (identity);
|
|
|
1e691d |
g_free (presentation_identity);
|
|
|
1e691d |
@@ -1042,8 +1042,7 @@ on_account_handle_remove (GoaAccount *account,
|
|
|
1e691d |
goa_account_complete_remove (account, invocation);
|
|
|
1e691d |
|
|
|
1e691d |
out:
|
|
|
1e691d |
- if (provider != NULL)
|
|
|
1e691d |
- g_object_unref (provider);
|
|
|
1e691d |
+ g_clear_object (&provider);
|
|
|
1e691d |
g_free (data);
|
|
|
1e691d |
if (key_file != NULL)
|
|
|
1e691d |
g_key_file_free (key_file);
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From 6f91a7a8c3106d4c3e7c11e819e07316cd3aa4c8 Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Wed, 27 May 2015 19:11:54 +0200
|
|
|
1e691d |
Subject: [PATCH 04/12] daemon: Use g_list_free_full wherever applicable
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/daemon/goadaemon.c | 12 ++++--------
|
|
|
1e691d |
1 file changed, 4 insertions(+), 8 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
|
|
|
1e691d |
index e6a559d..79d6f26 100644
|
|
|
1e691d |
--- a/src/daemon/goadaemon.c
|
|
|
1e691d |
+++ b/src/daemon/goadaemon.c
|
|
|
1e691d |
@@ -544,8 +544,7 @@ process_config_entries (GoaDaemon *self,
|
|
|
1e691d |
if (g_str_has_prefix (object_path, "/org/gnome/OnlineAccounts/Accounts/"))
|
|
|
1e691d |
existing_object_paths = g_list_prepend (existing_object_paths, g_strdup (object_path));
|
|
|
1e691d |
}
|
|
|
1e691d |
- g_list_foreach (existing_objects, (GFunc) g_object_unref, NULL);
|
|
|
1e691d |
- g_list_free (existing_objects);
|
|
|
1e691d |
+ g_list_free_full (existing_objects, g_object_unref);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
config_object_paths = NULL;
|
|
|
1e691d |
@@ -656,10 +655,8 @@ process_config_entries (GoaDaemon *self,
|
|
|
1e691d |
g_list_free (removed);
|
|
|
1e691d |
g_list_free (added);
|
|
|
1e691d |
g_list_free (unchanged);
|
|
|
1e691d |
- g_list_foreach (existing_object_paths, (GFunc) g_free, NULL);
|
|
|
1e691d |
- g_list_free (existing_object_paths);
|
|
|
1e691d |
- g_list_foreach (config_object_paths, (GFunc) g_free, NULL);
|
|
|
1e691d |
- g_list_free (config_object_paths);
|
|
|
1e691d |
+ g_list_free_full (existing_object_paths, g_free);
|
|
|
1e691d |
+ g_list_free_full (config_object_paths, g_free);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
/* <internal>
|
|
|
1e691d |
@@ -692,8 +689,7 @@ goa_daemon_reload_configuration (GoaDaemon *self)
|
|
|
1e691d |
process_config_entries (self, group_name_to_key_file_data);
|
|
|
1e691d |
|
|
|
1e691d |
g_hash_table_unref (group_name_to_key_file_data);
|
|
|
1e691d |
- g_list_foreach (key_files_to_free, (GFunc) g_key_file_free, NULL);
|
|
|
1e691d |
- g_list_free (key_files_to_free);
|
|
|
1e691d |
+ g_list_free_full (key_files_to_free, (GDestroyNotify) g_key_file_free);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static gchar *
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From df7b534a62e49be6b32360e01ea19f542b5ea548 Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Wed, 27 May 2015 19:13:18 +0200
|
|
|
1e691d |
Subject: [PATCH 05/12] daemon: Remove redundant NULL check
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/daemon/goadaemon.c | 3 +--
|
|
|
1e691d |
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
|
|
|
1e691d |
index 79d6f26..eeb49e6 100644
|
|
|
1e691d |
--- a/src/daemon/goadaemon.c
|
|
|
1e691d |
+++ b/src/daemon/goadaemon.c
|
|
|
1e691d |
@@ -881,8 +881,7 @@ get_all_providers_cb (GObject *source,
|
|
|
1e691d |
|
|
|
1e691d |
out:
|
|
|
1e691d |
g_free (object_path);
|
|
|
1e691d |
- if (providers != NULL)
|
|
|
1e691d |
- g_list_free_full (providers, g_object_unref);
|
|
|
1e691d |
+ g_list_free_full (providers, g_object_unref);
|
|
|
1e691d |
g_free (key_file_data);
|
|
|
1e691d |
g_free (group);
|
|
|
1e691d |
g_free (id);
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From e1568184f6e6a18b0a10ff94f18729fd29892edb Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Thu, 28 May 2015 13:26:06 +0200
|
|
|
1e691d |
Subject: [PATCH 06/12] daemon: Remove redundant function call
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/daemon/goadaemon.c | 4 +---
|
|
|
1e691d |
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
|
|
|
1e691d |
index eeb49e6..f933e69 100644
|
|
|
1e691d |
--- a/src/daemon/goadaemon.c
|
|
|
1e691d |
+++ b/src/daemon/goadaemon.c
|
|
|
1e691d |
@@ -1138,9 +1138,7 @@ ensure_credentials_cb (GoaProvider *provider,
|
|
|
1e691d |
g_message ("%s: Setting AttentionNeeded to FALSE because EnsureCredentials() succeded\n",
|
|
|
1e691d |
g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)));
|
|
|
1e691d |
}
|
|
|
1e691d |
- goa_account_complete_ensure_credentials (goa_object_peek_account (data->object),
|
|
|
1e691d |
- data->invocation,
|
|
|
1e691d |
- expires_in);
|
|
|
1e691d |
+ goa_account_complete_ensure_credentials (account, data->invocation, expires_in);
|
|
|
1e691d |
}
|
|
|
1e691d |
ensure_data_unref (data);
|
|
|
1e691d |
}
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From b8d56056ecb1ddb62c21a9eae90daf97d275b8bf Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Thu, 28 May 2015 15:51:23 +0200
|
|
|
1e691d |
Subject: [PATCH 07/12] daemon: Check & refresh credentials during startup and
|
|
|
1e691d |
network changes
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/daemon/goadaemon.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
1e691d |
1 file changed, 101 insertions(+), 2 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
|
|
|
1e691d |
index f933e69..efa7ba7 100644
|
|
|
1e691d |
--- a/src/daemon/goadaemon.c
|
|
|
1e691d |
+++ b/src/daemon/goadaemon.c
|
|
|
1e691d |
@@ -36,11 +36,14 @@ struct _GoaDaemon
|
|
|
1e691d |
GFileMonitor *home_conf_file_monitor;
|
|
|
1e691d |
GFileMonitor *home_conf_dir_monitor;
|
|
|
1e691d |
|
|
|
1e691d |
+ GNetworkMonitor *network_monitor;
|
|
|
1e691d |
+
|
|
|
1e691d |
GDBusObjectManagerServer *object_manager;
|
|
|
1e691d |
|
|
|
1e691d |
GoaManager *manager;
|
|
|
1e691d |
|
|
|
1e691d |
guint config_timeout_id;
|
|
|
1e691d |
+ guint credentials_timeout_id;
|
|
|
1e691d |
};
|
|
|
1e691d |
|
|
|
1e691d |
typedef struct
|
|
|
1e691d |
@@ -71,6 +74,7 @@ static gboolean on_account_handle_ensure_credentials (GoaAccount *acc
|
|
|
1e691d |
GDBusMethodInvocation *invocation,
|
|
|
1e691d |
gpointer user_data);
|
|
|
1e691d |
|
|
|
1e691d |
+static void goa_daemon_check_credentials (GoaDaemon *self);
|
|
|
1e691d |
static void goa_daemon_reload_configuration (GoaDaemon *self);
|
|
|
1e691d |
|
|
|
1e691d |
G_DEFINE_TYPE (GoaDaemon, goa_daemon, G_TYPE_OBJECT);
|
|
|
1e691d |
@@ -85,6 +89,11 @@ goa_daemon_finalize (GObject *object)
|
|
|
1e691d |
g_source_remove (self->config_timeout_id);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
+ if (self->credentials_timeout_id != 0)
|
|
|
1e691d |
+ {
|
|
|
1e691d |
+ g_source_remove (self->credentials_timeout_id);
|
|
|
1e691d |
+ }
|
|
|
1e691d |
+
|
|
|
1e691d |
if (self->system_conf_dir_monitor != NULL)
|
|
|
1e691d |
{
|
|
|
1e691d |
g_signal_handlers_disconnect_by_func (self->system_conf_dir_monitor, on_file_monitor_changed, self);
|
|
|
1e691d |
@@ -162,6 +171,35 @@ on_file_monitor_changed (GFileMonitor *monitor,
|
|
|
1e691d |
}
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
+static gboolean
|
|
|
1e691d |
+on_check_credentials_timeout (gpointer user_data)
|
|
|
1e691d |
+{
|
|
|
1e691d |
+ GoaDaemon *self = GOA_DAEMON (user_data);
|
|
|
1e691d |
+
|
|
|
1e691d |
+ self->credentials_timeout_id = 0;
|
|
|
1e691d |
+ g_info ("Checking credentials\n");
|
|
|
1e691d |
+ goa_daemon_check_credentials (self);
|
|
|
1e691d |
+
|
|
|
1e691d |
+ return G_SOURCE_REMOVE;
|
|
|
1e691d |
+}
|
|
|
1e691d |
+
|
|
|
1e691d |
+static void
|
|
|
1e691d |
+queue_check_credentials (GoaDaemon *self)
|
|
|
1e691d |
+{
|
|
|
1e691d |
+ if (self->credentials_timeout_id != 0)
|
|
|
1e691d |
+ {
|
|
|
1e691d |
+ g_source_remove (self->credentials_timeout_id);
|
|
|
1e691d |
+ }
|
|
|
1e691d |
+
|
|
|
1e691d |
+ self->credentials_timeout_id = g_timeout_add_seconds (1, on_check_credentials_timeout, self);
|
|
|
1e691d |
+}
|
|
|
1e691d |
+
|
|
|
1e691d |
+static void
|
|
|
1e691d |
+on_network_monitor_network_changed (GoaDaemon *self, gboolean available)
|
|
|
1e691d |
+{
|
|
|
1e691d |
+ queue_check_credentials (self);
|
|
|
1e691d |
+}
|
|
|
1e691d |
+
|
|
|
1e691d |
#ifdef GOA_KERBEROS_ENABLED
|
|
|
1e691d |
static void
|
|
|
1e691d |
activate_identity_service (GoaDaemon *self)
|
|
|
1e691d |
@@ -230,9 +268,18 @@ goa_daemon_init (GoaDaemon *self)
|
|
|
1e691d |
/* prime the list of accounts */
|
|
|
1e691d |
goa_daemon_reload_configuration (self);
|
|
|
1e691d |
|
|
|
1e691d |
+ self->network_monitor = g_network_monitor_get_default ();
|
|
|
1e691d |
+ g_signal_connect_object (self->network_monitor,
|
|
|
1e691d |
+ "network-changed",
|
|
|
1e691d |
+ G_CALLBACK (on_network_monitor_network_changed),
|
|
|
1e691d |
+ self,
|
|
|
1e691d |
+ G_CONNECT_SWAPPED);
|
|
|
1e691d |
+
|
|
|
1e691d |
/* Export objects */
|
|
|
1e691d |
g_dbus_object_manager_server_set_connection (self->object_manager, self->connection);
|
|
|
1e691d |
|
|
|
1e691d |
+ queue_check_credentials (self);
|
|
|
1e691d |
+
|
|
|
1e691d |
#ifdef GOA_KERBEROS_ENABLED
|
|
|
1e691d |
activate_identity_service (self);
|
|
|
1e691d |
#endif
|
|
|
1e691d |
@@ -1123,7 +1170,14 @@ ensure_credentials_cb (GoaProvider *provider,
|
|
|
1e691d |
error->message, g_quark_to_string (error->domain), error->code);
|
|
|
1e691d |
}
|
|
|
1e691d |
}
|
|
|
1e691d |
- g_dbus_method_invocation_take_error (data->invocation, error);
|
|
|
1e691d |
+
|
|
|
1e691d |
+ if (data->invocation != NULL)
|
|
|
1e691d |
+ {
|
|
|
1e691d |
+ g_dbus_method_invocation_take_error (data->invocation, error);
|
|
|
1e691d |
+ error = NULL;
|
|
|
1e691d |
+ }
|
|
|
1e691d |
+
|
|
|
1e691d |
+ g_clear_error (&error);
|
|
|
1e691d |
}
|
|
|
1e691d |
else
|
|
|
1e691d |
{
|
|
|
1e691d |
@@ -1138,7 +1192,9 @@ ensure_credentials_cb (GoaProvider *provider,
|
|
|
1e691d |
g_message ("%s: Setting AttentionNeeded to FALSE because EnsureCredentials() succeded\n",
|
|
|
1e691d |
g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)));
|
|
|
1e691d |
}
|
|
|
1e691d |
- goa_account_complete_ensure_credentials (account, data->invocation, expires_in);
|
|
|
1e691d |
+
|
|
|
1e691d |
+ if (data->invocation != NULL)
|
|
|
1e691d |
+ goa_account_complete_ensure_credentials (account, data->invocation, expires_in);
|
|
|
1e691d |
}
|
|
|
1e691d |
ensure_data_unref (data);
|
|
|
1e691d |
}
|
|
|
1e691d |
@@ -1175,3 +1231,46 @@ on_account_handle_ensure_credentials (GoaAccount *account,
|
|
|
1e691d |
g_clear_object (&provider);
|
|
|
1e691d |
return TRUE; /* invocation was handled */
|
|
|
1e691d |
}
|
|
|
1e691d |
+
|
|
|
1e691d |
+/* <internal>
|
|
|
1e691d |
+ * goa_daemon_check_credentials:
|
|
|
1e691d |
+ * @self: A #GoaDaemon
|
|
|
1e691d |
+ *
|
|
|
1e691d |
+ * Checks whether credentials are valid and tries to refresh them if
|
|
|
1e691d |
+ * not. It also reports whether accounts are usable with the current
|
|
|
1e691d |
+ * network.
|
|
|
1e691d |
+ */
|
|
|
1e691d |
+static void
|
|
|
1e691d |
+goa_daemon_check_credentials (GoaDaemon *self)
|
|
|
1e691d |
+{
|
|
|
1e691d |
+ GList *l;
|
|
|
1e691d |
+ GList *objects;
|
|
|
1e691d |
+
|
|
|
1e691d |
+ objects = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (self->object_manager));
|
|
|
1e691d |
+ for (l = objects; l != NULL; l = l->next)
|
|
|
1e691d |
+ {
|
|
|
1e691d |
+ GoaAccount *account;
|
|
|
1e691d |
+ GoaObject *object = GOA_OBJECT (l->data);
|
|
|
1e691d |
+ GoaProvider *provider = NULL;
|
|
|
1e691d |
+ const gchar *provider_type;
|
|
|
1e691d |
+
|
|
|
1e691d |
+ account = goa_object_peek_account (object);
|
|
|
1e691d |
+ if (account == NULL)
|
|
|
1e691d |
+ continue;
|
|
|
1e691d |
+
|
|
|
1e691d |
+ provider_type = goa_account_get_provider_type (account);
|
|
|
1e691d |
+ provider = goa_provider_get_for_provider_type (provider_type);
|
|
|
1e691d |
+ if (provider == NULL)
|
|
|
1e691d |
+ continue;
|
|
|
1e691d |
+
|
|
|
1e691d |
+ goa_provider_ensure_credentials (provider,
|
|
|
1e691d |
+ object,
|
|
|
1e691d |
+ NULL, /* GCancellable */
|
|
|
1e691d |
+ (GAsyncReadyCallback) ensure_credentials_cb,
|
|
|
1e691d |
+ ensure_data_new (self, object, NULL));
|
|
|
1e691d |
+
|
|
|
1e691d |
+ g_clear_object (&provider);
|
|
|
1e691d |
+ }
|
|
|
1e691d |
+
|
|
|
1e691d |
+ g_list_free_full (objects, g_object_unref);
|
|
|
1e691d |
+}
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From f261c93bfddfc96f261a7388d1c46524d408d4e6 Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Thu, 28 May 2015 16:20:57 +0200
|
|
|
1e691d |
Subject: [PATCH 08/12] kerberos: Mark EnsureCredentials failures as
|
|
|
1e691d |
authorization errors
|
|
|
1e691d |
|
|
|
1e691d |
Otherwise GoaAccount:attention-needed won't be set and the UI won't
|
|
|
1e691d |
reflect reality.
|
|
|
1e691d |
|
|
|
1e691d |
Fall out from 7ba73645e6068935f331969e14d56a39544ebca5
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/goabackend/goakerberosprovider.c | 15 +++++++++++++--
|
|
|
1e691d |
1 file changed, 13 insertions(+), 2 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
|
|
|
1e691d |
index 2eb6b67..33dc1ad 100644
|
|
|
1e691d |
--- a/src/goabackend/goakerberosprovider.c
|
|
|
1e691d |
+++ b/src/goabackend/goakerberosprovider.c
|
|
|
1e691d |
@@ -1406,18 +1406,29 @@ ensure_credentials_sync (GoaProvider *provider,
|
|
|
1e691d |
|
|
|
1e691d |
if (identity == NULL || !goa_identity_service_identity_get_is_signed_in (identity))
|
|
|
1e691d |
{
|
|
|
1e691d |
+ GError *lookup_error;
|
|
|
1e691d |
gboolean ticket_synced;
|
|
|
1e691d |
|
|
|
1e691d |
+ lookup_error = NULL;
|
|
|
1e691d |
+
|
|
|
1e691d |
g_mutex_unlock (&identity_manager_mutex);
|
|
|
1e691d |
ticket_synced = get_ticket_sync (GOA_KERBEROS_PROVIDER (provider),
|
|
|
1e691d |
object,
|
|
|
1e691d |
FALSE /* Don't allow interaction */,
|
|
|
1e691d |
cancellable,
|
|
|
1e691d |
- error);
|
|
|
1e691d |
+ &lookup_error);
|
|
|
1e691d |
g_mutex_lock (&identity_manager_mutex);
|
|
|
1e691d |
|
|
|
1e691d |
if (!ticket_synced)
|
|
|
1e691d |
- goto out;
|
|
|
1e691d |
+ {
|
|
|
1e691d |
+ translate_error (&lookup_error);
|
|
|
1e691d |
+ g_set_error_literal (error,
|
|
|
1e691d |
+ GOA_ERROR,
|
|
|
1e691d |
+ GOA_ERROR_NOT_AUTHORIZED,
|
|
|
1e691d |
+ lookup_error->message);
|
|
|
1e691d |
+ g_error_free (lookup_error);
|
|
|
1e691d |
+ goto out;
|
|
|
1e691d |
+ }
|
|
|
1e691d |
|
|
|
1e691d |
if (identity == NULL)
|
|
|
1e691d |
identity = get_identity_from_object_manager (GOA_KERBEROS_PROVIDER (provider),
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From 77f5b03632b779499e29b2e91c55a562c362cfc9 Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Fri, 29 May 2015 15:40:32 +0200
|
|
|
1e691d |
Subject: [PATCH 09/12] client, identity: Use g_list_free_full wherever
|
|
|
1e691d |
applicable
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/goa/goaclient.c | 3 +--
|
|
|
1e691d |
src/goaidentity/goakerberosidentitymanager.c | 3 +--
|
|
|
1e691d |
2 files changed, 2 insertions(+), 4 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/goa/goaclient.c b/src/goa/goaclient.c
|
|
|
1e691d |
index 89d52c8..20d6e88 100644
|
|
|
1e691d |
--- a/src/goa/goaclient.c
|
|
|
1e691d |
+++ b/src/goa/goaclient.c
|
|
|
1e691d |
@@ -471,8 +471,7 @@ goa_client_get_accounts (GoaClient *client)
|
|
|
1e691d |
if (goa_object_peek_account (object) != NULL)
|
|
|
1e691d |
ret = g_list_prepend (ret, g_object_ref (object));
|
|
|
1e691d |
}
|
|
|
1e691d |
- g_list_foreach (objects, (GFunc) g_object_unref, NULL);
|
|
|
1e691d |
- g_list_free (objects);
|
|
|
1e691d |
+ g_list_free_full (objects, g_object_unref);
|
|
|
1e691d |
|
|
|
1e691d |
return ret;
|
|
|
1e691d |
}
|
|
|
1e691d |
diff --git a/src/goaidentity/goakerberosidentitymanager.c b/src/goaidentity/goakerberosidentitymanager.c
|
|
|
1e691d |
index a1898c9..162cf3f 100644
|
|
|
1e691d |
--- a/src/goaidentity/goakerberosidentitymanager.c
|
|
|
1e691d |
+++ b/src/goaidentity/goakerberosidentitymanager.c
|
|
|
1e691d |
@@ -594,8 +594,7 @@ identity_sort_func (GoaIdentity *a,
|
|
|
1e691d |
static void
|
|
|
1e691d |
free_identity_list (GList *list)
|
|
|
1e691d |
{
|
|
|
1e691d |
- g_list_foreach (list, (GFunc) g_object_unref, NULL);
|
|
|
1e691d |
- g_list_free (list);
|
|
|
1e691d |
+ g_list_free_full (list, g_object_unref);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From 3939e2be726b532dba0debfc3d4b933ae8d54e1a Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Fri, 29 May 2015 15:45:10 +0200
|
|
|
1e691d |
Subject: [PATCH 10/12] identity: Simplify the destruction
|
|
|
1e691d |
|
|
|
1e691d |
GoaKerberosIdentityQuery doesn't hold any references so there is no
|
|
|
1e691d |
need to free the list in dispose. We can use the dummy finalize that we
|
|
|
1e691d |
already have and avoid the complexity.
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/goaidentity/goakerberosidentityinquiry.c | 8 ++++----
|
|
|
1e691d |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/goaidentity/goakerberosidentityinquiry.c b/src/goaidentity/goakerberosidentityinquiry.c
|
|
|
1e691d |
index 7c9a84a..4560b35 100644
|
|
|
1e691d |
--- a/src/goaidentity/goakerberosidentityinquiry.c
|
|
|
1e691d |
+++ b/src/goaidentity/goakerberosidentityinquiry.c
|
|
|
1e691d |
@@ -102,15 +102,15 @@ goa_kerberos_identity_inquiry_dispose (GObject *object)
|
|
|
1e691d |
g_clear_object (&self->priv->identity);
|
|
|
1e691d |
g_clear_pointer (&self->priv->name, (GDestroyNotify) g_free);
|
|
|
1e691d |
g_clear_pointer (&self->priv->banner, (GDestroyNotify) g_free);
|
|
|
1e691d |
-
|
|
|
1e691d |
- g_list_foreach (self->priv->queries,
|
|
|
1e691d |
- (GFunc) goa_kerberos_identity_query_free, NULL);
|
|
|
1e691d |
- g_clear_pointer (&self->priv->queries, (GDestroyNotify) g_list_free);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
goa_kerberos_identity_inquiry_finalize (GObject *object)
|
|
|
1e691d |
{
|
|
|
1e691d |
+ GoaKerberosIdentityInquiry *self = GOA_KERBEROS_IDENTITY_INQUIRY (object);
|
|
|
1e691d |
+
|
|
|
1e691d |
+ g_list_free_full (self->priv->queries, (GDestroyNotify) goa_kerberos_identity_query_free);
|
|
|
1e691d |
+
|
|
|
1e691d |
G_OBJECT_CLASS (goa_kerberos_identity_inquiry_parent_class)->finalize (object);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From b7340b085604b291f4f894fe747ab109c19edc03 Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Fri, 29 May 2015 15:46:09 +0200
|
|
|
1e691d |
Subject: [PATCH 11/12] identity: Chain up during dispose
|
|
|
1e691d |
|
|
|
1e691d |
https://bugzilla.gnome.org/show_bug.cgi?id=693578
|
|
|
1e691d |
---
|
|
|
1e691d |
src/goaidentity/goakerberosidentityinquiry.c | 2 ++
|
|
|
1e691d |
1 file changed, 2 insertions(+)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/goaidentity/goakerberosidentityinquiry.c b/src/goaidentity/goakerberosidentityinquiry.c
|
|
|
1e691d |
index 4560b35..67a8a60 100644
|
|
|
1e691d |
--- a/src/goaidentity/goakerberosidentityinquiry.c
|
|
|
1e691d |
+++ b/src/goaidentity/goakerberosidentityinquiry.c
|
|
|
1e691d |
@@ -102,6 +102,8 @@ goa_kerberos_identity_inquiry_dispose (GObject *object)
|
|
|
1e691d |
g_clear_object (&self->priv->identity);
|
|
|
1e691d |
g_clear_pointer (&self->priv->name, (GDestroyNotify) g_free);
|
|
|
1e691d |
g_clear_pointer (&self->priv->banner, (GDestroyNotify) g_free);
|
|
|
1e691d |
+
|
|
|
1e691d |
+ G_OBJECT_CLASS (goa_kerberos_identity_inquiry_parent_class)->dispose (object);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static void
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|
|
|
1e691d |
|
|
|
1e691d |
From 59061d81175411c2b38c4d87dfd94b0f3893b765 Mon Sep 17 00:00:00 2001
|
|
|
1e691d |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
1e691d |
Date: Fri, 29 May 2015 17:51:33 +0200
|
|
|
1e691d |
Subject: [PATCH 12/12] kerberos: Don't leak the GCancellable
|
|
|
1e691d |
|
|
|
1e691d |
---
|
|
|
1e691d |
src/goabackend/goakerberosprovider.c | 9 ++++++---
|
|
|
1e691d |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
1e691d |
|
|
|
1e691d |
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
|
|
|
1e691d |
index 33dc1ad..69a1c91 100644
|
|
|
1e691d |
--- a/src/goabackend/goakerberosprovider.c
|
|
|
1e691d |
+++ b/src/goabackend/goakerberosprovider.c
|
|
|
1e691d |
@@ -990,9 +990,10 @@ perform_initial_sign_in (GoaKerberosProvider *self,
|
|
|
1e691d |
object);
|
|
|
1e691d |
g_simple_async_result_set_check_cancellable (operation_result, cancellable);
|
|
|
1e691d |
|
|
|
1e691d |
- g_object_set_data (G_OBJECT (operation_result),
|
|
|
1e691d |
- "cancellable",
|
|
|
1e691d |
- cancellable);
|
|
|
1e691d |
+ g_object_set_data_full (G_OBJECT (operation_result),
|
|
|
1e691d |
+ "cancellable",
|
|
|
1e691d |
+ g_object_ref (cancellable),
|
|
|
1e691d |
+ g_object_unref);
|
|
|
1e691d |
g_object_set_data (G_OBJECT (operation_result),
|
|
|
1e691d |
"principal",
|
|
|
1e691d |
(gpointer)
|
|
|
1e691d |
@@ -1003,6 +1004,8 @@ perform_initial_sign_in (GoaKerberosProvider *self,
|
|
|
1e691d |
(GAsyncReadyCallback)
|
|
|
1e691d |
on_system_prompt_open_for_initial_sign_in,
|
|
|
1e691d |
operation_result);
|
|
|
1e691d |
+
|
|
|
1e691d |
+ g_object_unref (cancellable);
|
|
|
1e691d |
}
|
|
|
1e691d |
|
|
|
1e691d |
static char *
|
|
|
1e691d |
--
|
|
|
1e691d |
2.1.0
|
|
|
1e691d |
|