|
Ray Strode |
530f77 |
From 21bf283256cb111996f606aec11e6521cc89ce3f Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
530f77 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
530f77 |
Date: Tue, 10 May 2011 14:19:57 -0400
|
|
Ray Strode |
530f77 |
Subject: [PATCH 1/4] daemon: stall ListCachedUsers until ck-history finishes
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
This way we don't normally return an empty list in early
|
|
Ray Strode |
530f77 |
calls for systems that have network login enabled.
|
|
Ray Strode |
530f77 |
---
|
|
Ray Strode |
530f77 |
src/daemon.c | 33 +++++++++++++++++++++++++++++++--
|
|
Ray Strode |
530f77 |
1 files changed, 31 insertions(+), 2 deletions(-)
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
diff --git a/src/daemon.c b/src/daemon.c
|
|
Ray Strode |
530f77 |
index a463c46..2a18924 100644
|
|
Ray Strode |
530f77 |
--- a/src/daemon.c
|
|
Ray Strode |
530f77 |
+++ b/src/daemon.c
|
|
Ray Strode |
530f77 |
@@ -88,6 +88,7 @@ enum {
|
|
Ray Strode |
530f77 |
enum {
|
|
Ray Strode |
530f77 |
USER_ADDED,
|
|
Ray Strode |
530f77 |
USER_REMOVED,
|
|
Ray Strode |
530f77 |
+ CK_HISTORY_LOADED,
|
|
Ray Strode |
530f77 |
LAST_SIGNAL
|
|
Ray Strode |
530f77 |
};
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
@@ -204,6 +205,16 @@ daemon_class_init (DaemonClass *klass)
|
|
Ray Strode |
530f77 |
1,
|
|
Ray Strode |
530f77 |
DBUS_TYPE_G_OBJECT_PATH);
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
+ signals[CK_HISTORY_LOADED] = g_signal_new ("ck-history-loaded",
|
|
Ray Strode |
530f77 |
+ G_OBJECT_CLASS_TYPE (klass),
|
|
Ray Strode |
530f77 |
+ G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
|
|
Ray Strode |
530f77 |
+ 0,
|
|
Ray Strode |
530f77 |
+ NULL,
|
|
Ray Strode |
530f77 |
+ NULL,
|
|
Ray Strode |
530f77 |
+ g_cclosure_marshal_VOID__VOID,
|
|
Ray Strode |
530f77 |
+ G_TYPE_NONE,
|
|
Ray Strode |
530f77 |
+ 0);
|
|
Ray Strode |
530f77 |
+
|
|
Ray Strode |
530f77 |
dbus_g_object_type_install_info (TYPE_DAEMON,
|
|
Ray Strode |
530f77 |
&dbus_glib_daemon_object_info);
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
@@ -393,6 +404,7 @@ ck_history_watch (GIOChannel *source,
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
if (done) {
|
|
Ray Strode |
530f77 |
daemon->priv->ck_history_id = 0;
|
|
Ray Strode |
530f77 |
+ g_signal_emit (daemon, signals[CK_HISTORY_LOADED], 0);
|
|
Ray Strode |
530f77 |
return FALSE;
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
@@ -1045,6 +1057,18 @@ finish_list_cached_users (gpointer user_data)
|
|
Ray Strode |
530f77 |
return FALSE;
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
+static void
|
|
Ray Strode |
530f77 |
+on_ck_history_loaded (Daemon *daemon,
|
|
Ray Strode |
530f77 |
+ ListUserData *data)
|
|
Ray Strode |
530f77 |
+{
|
|
Ray Strode |
530f77 |
+ /* ck-history loaded, so finish pending ListCachedUsers call */
|
|
Ray Strode |
530f77 |
+ g_idle_add (finish_list_cached_users, data);
|
|
Ray Strode |
530f77 |
+
|
|
Ray Strode |
530f77 |
+ g_signal_handlers_disconnect_by_func (daemon,
|
|
Ray Strode |
530f77 |
+ on_ck_history_loaded,
|
|
Ray Strode |
530f77 |
+ data);
|
|
Ray Strode |
530f77 |
+}
|
|
Ray Strode |
530f77 |
+
|
|
Ray Strode |
530f77 |
gboolean
|
|
Ray Strode |
530f77 |
daemon_list_cached_users (Daemon *daemon,
|
|
Ray Strode |
530f77 |
DBusGMethodInvocation *context)
|
|
Ray Strode |
530f77 |
@@ -1053,8 +1077,13 @@ daemon_list_cached_users (Daemon *daemon,
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
data = list_user_data_new (daemon, context);
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
- if (daemon->priv->reload_id > 0) {
|
|
Ray Strode |
530f77 |
- /* reload in progress, wait */
|
|
Ray Strode |
530f77 |
+ if (daemon->priv->ck_history_id > 0) {
|
|
Ray Strode |
530f77 |
+ /* loading ck-history, wait for it */
|
|
Ray Strode |
530f77 |
+ g_signal_connect (daemon, "ck-history-loaded",
|
|
Ray Strode |
530f77 |
+ G_CALLBACK (on_ck_history_loaded),
|
|
Ray Strode |
530f77 |
+ data);
|
|
Ray Strode |
530f77 |
+ } else if (daemon->priv->reload_id > 0) {
|
|
Ray Strode |
530f77 |
+ /* reload in progress, wait a bit */
|
|
Ray Strode |
530f77 |
g_idle_add (finish_list_cached_users, data);
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
else {
|
|
Ray Strode |
530f77 |
--
|
|
Ray Strode |
530f77 |
1.7.5
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
From 47a5d95908a1005e2d44728a0d7e2459965190ef Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
530f77 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
530f77 |
Date: Tue, 10 May 2011 14:21:16 -0400
|
|
Ray Strode |
530f77 |
Subject: [PATCH 2/4] lib: ignore user-removed signals for untracked users
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
If we don't know about a user, we don't care if it goes away,
|
|
Ray Strode |
530f77 |
and we shouldn't try to remove it from the book keeping.
|
|
Ray Strode |
530f77 |
---
|
|
Ray Strode |
530f77 |
src/libaccountsservice/act-user-manager.c | 9 +++++++--
|
|
Ray Strode |
530f77 |
1 files changed, 7 insertions(+), 2 deletions(-)
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
index 379c972..cbf7fc8 100644
|
|
Ray Strode |
530f77 |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
@@ -878,10 +878,15 @@ on_user_removed_in_accounts_service (DBusGProxy *proxy,
|
|
Ray Strode |
530f77 |
ActUserManager *manager = ACT_USER_MANAGER (user_data);
|
|
Ray Strode |
530f77 |
ActUser *user;
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
- g_debug ("ActUserManager: user removed from accounts service with object path %s", object_path);
|
|
Ray Strode |
530f77 |
-
|
|
Ray Strode |
530f77 |
user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
+ if (user == NULL) {
|
|
Ray Strode |
530f77 |
+ g_debug ("ActUserManager: ignoring untracked user %s", object_path);
|
|
Ray Strode |
530f77 |
+ return;
|
|
Ray Strode |
530f77 |
+ } else {
|
|
Ray Strode |
530f77 |
+ g_debug ("ActUserManager: tracked user %s removed from accounts service", object_path);
|
|
Ray Strode |
530f77 |
+ }
|
|
Ray Strode |
530f77 |
+
|
|
Ray Strode |
530f77 |
manager->priv->new_users = g_slist_remove (manager->priv->new_users, user);
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
remove_user (manager, user);
|
|
Ray Strode |
530f77 |
--
|
|
Ray Strode |
530f77 |
1.7.5
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
From 53948a60b012b0bf5aa4d72eb973aee9964d2ca4 Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
530f77 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
530f77 |
Date: Tue, 10 May 2011 14:36:02 -0400
|
|
Ray Strode |
530f77 |
Subject: [PATCH 3/4] lib: set is-loaded in failure path
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
We want to make sure that we always set is-loaded when
|
|
Ray Strode |
530f77 |
things fail, so that we don't block indefinitely.
|
|
Ray Strode |
530f77 |
---
|
|
Ray Strode |
530f77 |
src/libaccountsservice/act-user-manager.c | 10 +++++-----
|
|
Ray Strode |
530f77 |
1 files changed, 5 insertions(+), 5 deletions(-)
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
index cbf7fc8..3764ab9 100644
|
|
Ray Strode |
530f77 |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
@@ -572,10 +572,9 @@ on_get_seat_id_finished (DBusGProxy *proxy,
|
|
Ray Strode |
530f77 |
g_debug ("Failed to identify the seat of the "
|
|
Ray Strode |
530f77 |
"current session");
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
- unload_seat (manager);
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
- g_debug ("ActUserManager: GetSeatId call failed, so trying to set loaded property");
|
|
Ray Strode |
530f77 |
- maybe_set_is_loaded (manager);
|
|
Ray Strode |
530f77 |
+ g_debug ("ActUserManager: GetSeatId call failed, so unloading seat");
|
|
Ray Strode |
530f77 |
+ unload_seat (manager);
|
|
Ray Strode |
530f77 |
return;
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
@@ -924,8 +923,6 @@ on_get_current_session_finished (DBusGProxy *proxy,
|
|
Ray Strode |
530f77 |
g_debug ("Failed to identify the current session");
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
unload_seat (manager);
|
|
Ray Strode |
530f77 |
- g_debug ("ActUserManager: no current session, so trying to set loaded property");
|
|
Ray Strode |
530f77 |
- maybe_set_is_loaded (manager);
|
|
Ray Strode |
530f77 |
return;
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
@@ -1549,6 +1546,9 @@ unload_seat (ActUserManager *manager)
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
g_free (manager->priv->seat.session_id);
|
|
Ray Strode |
530f77 |
manager->priv->seat.session_id = NULL;
|
|
Ray Strode |
530f77 |
+
|
|
Ray Strode |
530f77 |
+ g_debug ("ActUserManager: seat unloaded, so trying to set loaded property");
|
|
Ray Strode |
530f77 |
+ maybe_set_is_loaded (manager);
|
|
Ray Strode |
530f77 |
}
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
static void
|
|
Ray Strode |
530f77 |
--
|
|
Ray Strode |
530f77 |
1.7.5
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
From 1932d53d3717bb8aa97307b903fba10371baa9b6 Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
530f77 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
530f77 |
Date: Tue, 10 May 2011 14:36:40 -0400
|
|
Ray Strode |
530f77 |
Subject: [PATCH 4/4] lib: if ListCachedUsers returns zero users continue
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
We currently block for ListCachedUsers to finish.
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
If after it finishes, we find out it returns 0 zero users
|
|
Ray Strode |
530f77 |
we end up hanging indefinitely.
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
This commit fixes that.
|
|
Ray Strode |
530f77 |
---
|
|
Ray Strode |
530f77 |
src/libaccountsservice/act-user-manager.c | 9 +++++++--
|
|
Ray Strode |
530f77 |
1 files changed, 7 insertions(+), 2 deletions(-)
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
index 3764ab9..6b4c77e 100644
|
|
Ray Strode |
530f77 |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
530f77 |
@@ -1216,8 +1216,13 @@ on_list_cached_users_finished (DBusGProxy *proxy,
|
|
Ray Strode |
530f77 |
*
|
|
Ray Strode |
530f77 |
* (see on_new_user_loaded)
|
|
Ray Strode |
530f77 |
*/
|
|
Ray Strode |
530f77 |
- g_debug ("ActUserManager: ListCachedUsers finished, will set loaded property after list is fully loaded");
|
|
Ray Strode |
530f77 |
- g_ptr_array_foreach (paths, (GFunc)add_new_inhibiting_user_for_object_path, manager);
|
|
Ray Strode |
530f77 |
+ if (paths->len > 0) {
|
|
Ray Strode |
530f77 |
+ g_debug ("ActUserManager: ListCachedUsers finished, will set loaded property after list is fully loaded");
|
|
Ray Strode |
530f77 |
+ g_ptr_array_foreach (paths, (GFunc)add_new_inhibiting_user_for_object_path, manager);
|
|
Ray Strode |
530f77 |
+ } else {
|
|
Ray Strode |
530f77 |
+ g_debug ("ActUserManager: ListCachedUsers finished with empty list, maybe setting loaded property now");
|
|
Ray Strode |
530f77 |
+ maybe_set_is_loaded (manager);
|
|
Ray Strode |
530f77 |
+ }
|
|
Ray Strode |
530f77 |
|
|
Ray Strode |
530f77 |
g_ptr_array_foreach (paths, (GFunc)g_free, NULL);
|
|
Ray Strode |
530f77 |
g_ptr_array_free (paths, TRUE);
|
|
Ray Strode |
530f77 |
--
|
|
Ray Strode |
530f77 |
1.7.5
|
|
Ray Strode |
530f77 |
|