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

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