Blame SOURCES/0001-daemon-ensure-cache-files-for-system-users-are-proce.patch

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