|
|
320391 |
From e17df355b90243278cc08d1709caab79afc5ed99 Mon Sep 17 00:00:00 2001
|
|
|
320391 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
320391 |
Date: Mon, 29 Apr 2019 10:14:12 -0400
|
|
|
320391 |
Subject: [PATCH] daemon: ensure cache files for system users are processed
|
|
|
320391 |
|
|
|
320391 |
At the moment we skip cache files for system users. That
|
|
|
320391 |
doesn't make much sense; if there's a cache file we should
|
|
|
320391 |
be using it.
|
|
|
320391 |
|
|
|
320391 |
This commit changes the code to read cache files, even for
|
|
|
320391 |
system users, and so lets root have a non-default session.
|
|
|
320391 |
|
|
|
320391 |
Closes: https://gitlab.freedesktop.org/accountsservice/accountsservice/issues/65
|
|
|
320391 |
---
|
|
|
320391 |
src/daemon.c | 2 +-
|
|
|
320391 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
320391 |
|
|
|
320391 |
diff --git a/src/daemon.c b/src/daemon.c
|
|
|
320391 |
index 2851ed6..b81c802 100644
|
|
|
320391 |
--- a/src/daemon.c
|
|
|
320391 |
+++ b/src/daemon.c
|
|
|
320391 |
@@ -446,61 +446,61 @@ reload_users (Daemon *daemon)
|
|
|
320391 |
AccountsAccounts *accounts = ACCOUNTS_ACCOUNTS (daemon);
|
|
|
320391 |
gboolean had_no_users, has_no_users, had_multiple_users, has_multiple_users;
|
|
|
320391 |
GHashTable *users;
|
|
|
320391 |
GHashTable *old_users;
|
|
|
320391 |
GHashTable *local;
|
|
|
320391 |
GHashTableIter iter;
|
|
|
320391 |
gsize number_of_normal_users = 0;
|
|
|
320391 |
gpointer name;
|
|
|
320391 |
User *user;
|
|
|
320391 |
|
|
|
320391 |
/* Track the users that we saw during our (re)load */
|
|
|
320391 |
users = create_users_hash_table ();
|
|
|
320391 |
|
|
|
320391 |
/*
|
|
|
320391 |
* NOTE: As we load data from all the sources, notifies are
|
|
|
320391 |
* frozen in load_entries() and then thawed as we process
|
|
|
320391 |
* them below.
|
|
|
320391 |
*/
|
|
|
320391 |
|
|
|
320391 |
/* Load the local users into our hash table */
|
|
|
320391 |
load_entries (daemon, users, FALSE, entry_generator_fgetpwent);
|
|
|
320391 |
local = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
320391 |
g_hash_table_iter_init (&iter, users);
|
|
|
320391 |
while (g_hash_table_iter_next (&iter, &name, NULL))
|
|
|
320391 |
g_hash_table_add (local, name);
|
|
|
320391 |
|
|
|
320391 |
/* and add users to hash table that were explicitly requested */
|
|
|
320391 |
load_entries (daemon, users, TRUE, entry_generator_requested_users);
|
|
|
320391 |
|
|
|
320391 |
/* Now add/update users from other sources, possibly non-local */
|
|
|
320391 |
- load_entries (daemon, users, FALSE, entry_generator_cachedir);
|
|
|
320391 |
+ load_entries (daemon, users, TRUE, entry_generator_cachedir);
|
|
|
320391 |
|
|
|
320391 |
wtmp_helper_update_login_frequencies (users);
|
|
|
320391 |
|
|
|
320391 |
/* Count the non-system users. Mark which users are local, which are not. */
|
|
|
320391 |
g_hash_table_iter_init (&iter, users);
|
|
|
320391 |
while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) {
|
|
|
320391 |
if (!user_get_system_account (user))
|
|
|
320391 |
number_of_normal_users++;
|
|
|
320391 |
user_update_local_account_property (user, g_hash_table_lookup (local, name) != NULL);
|
|
|
320391 |
}
|
|
|
320391 |
g_hash_table_destroy (local);
|
|
|
320391 |
|
|
|
320391 |
had_no_users = accounts_accounts_get_has_no_users (accounts);
|
|
|
320391 |
has_no_users = number_of_normal_users == 0;
|
|
|
320391 |
|
|
|
320391 |
if (had_no_users != has_no_users)
|
|
|
320391 |
accounts_accounts_set_has_no_users (accounts, has_no_users);
|
|
|
320391 |
|
|
|
320391 |
had_multiple_users = accounts_accounts_get_has_multiple_users (accounts);
|
|
|
320391 |
has_multiple_users = number_of_normal_users > 1;
|
|
|
320391 |
|
|
|
320391 |
if (had_multiple_users != has_multiple_users)
|
|
|
320391 |
accounts_accounts_set_has_multiple_users (accounts, has_multiple_users);
|
|
|
320391 |
|
|
|
320391 |
/* Swap out the users */
|
|
|
320391 |
old_users = daemon->priv->users;
|
|
|
320391 |
daemon->priv->users = users;
|
|
|
320391 |
|
|
|
320391 |
/* Remove all the old users */
|
|
|
320391 |
g_hash_table_iter_init (&iter, old_users);
|
|
|
320391 |
--
|
|
|
320391 |
2.21.0
|
|
|
320391 |
|