diff --git a/SOURCES/0001-daemon-ensure-cache-files-for-system-users-are-proce.patch b/SOURCES/0001-daemon-ensure-cache-files-for-system-users-are-proce.patch new file mode 100644 index 0000000..fe5f8eb --- /dev/null +++ b/SOURCES/0001-daemon-ensure-cache-files-for-system-users-are-proce.patch @@ -0,0 +1,87 @@ +From e17df355b90243278cc08d1709caab79afc5ed99 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Mon, 29 Apr 2019 10:14:12 -0400 +Subject: [PATCH] daemon: ensure cache files for system users are processed + +At the moment we skip cache files for system users. That +doesn't make much sense; if there's a cache file we should +be using it. + +This commit changes the code to read cache files, even for +system users, and so lets root have a non-default session. + +Closes: https://gitlab.freedesktop.org/accountsservice/accountsservice/issues/65 +--- + src/daemon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/daemon.c b/src/daemon.c +index 2851ed6..b81c802 100644 +--- a/src/daemon.c ++++ b/src/daemon.c +@@ -446,61 +446,61 @@ reload_users (Daemon *daemon) + AccountsAccounts *accounts = ACCOUNTS_ACCOUNTS (daemon); + gboolean had_no_users, has_no_users, had_multiple_users, has_multiple_users; + GHashTable *users; + GHashTable *old_users; + GHashTable *local; + GHashTableIter iter; + gsize number_of_normal_users = 0; + gpointer name; + User *user; + + /* Track the users that we saw during our (re)load */ + users = create_users_hash_table (); + + /* + * NOTE: As we load data from all the sources, notifies are + * frozen in load_entries() and then thawed as we process + * them below. + */ + + /* Load the local users into our hash table */ + load_entries (daemon, users, FALSE, entry_generator_fgetpwent); + local = g_hash_table_new (g_str_hash, g_str_equal); + g_hash_table_iter_init (&iter, users); + while (g_hash_table_iter_next (&iter, &name, NULL)) + g_hash_table_add (local, name); + + /* and add users to hash table that were explicitly requested */ + load_entries (daemon, users, TRUE, entry_generator_requested_users); + + /* Now add/update users from other sources, possibly non-local */ +- load_entries (daemon, users, FALSE, entry_generator_cachedir); ++ load_entries (daemon, users, TRUE, entry_generator_cachedir); + + wtmp_helper_update_login_frequencies (users); + + /* Count the non-system users. Mark which users are local, which are not. */ + g_hash_table_iter_init (&iter, users); + while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) { + if (!user_get_system_account (user)) + number_of_normal_users++; + user_update_local_account_property (user, g_hash_table_lookup (local, name) != NULL); + } + g_hash_table_destroy (local); + + had_no_users = accounts_accounts_get_has_no_users (accounts); + has_no_users = number_of_normal_users == 0; + + if (had_no_users != has_no_users) + accounts_accounts_set_has_no_users (accounts, has_no_users); + + had_multiple_users = accounts_accounts_get_has_multiple_users (accounts); + has_multiple_users = number_of_normal_users > 1; + + if (had_multiple_users != has_multiple_users) + accounts_accounts_set_has_multiple_users (accounts, has_multiple_users); + + /* Swap out the users */ + old_users = daemon->priv->users; + daemon->priv->users = users; + + /* Remove all the old users */ + g_hash_table_iter_init (&iter, old_users); +-- +2.21.0 + diff --git a/SPECS/accountsservice.spec b/SPECS/accountsservice.spec index 164acd8..22058e7 100644 --- a/SPECS/accountsservice.spec +++ b/SPECS/accountsservice.spec @@ -2,7 +2,7 @@ Name: accountsservice Version: 0.6.50 -Release: 5%{?dist} +Release: 6%{?dist} Summary: D-Bus interfaces for querying and manipulating user account information License: GPLv3+ URL: https://www.freedesktop.org/wiki/Software/AccountsService/ @@ -26,6 +26,8 @@ Patch0: 0001-lib-don-t-set-loaded-state-until-seat-is-fetched.patch Patch10001: 0001-data-don-t-send-change-updates-for-login-history.patch +Patch20001: 0001-daemon-ensure-cache-files-for-system-users-are-proce.patch + %description The accountsservice project provides a set of D-Bus interfaces for querying and manipulating user account information and an implementation @@ -103,6 +105,10 @@ rm $RPM_BUILD_ROOT%{_libdir}/*.a %{_datadir}/gtk-doc/html/libaccountsservice/* %changelog +* Mon Jun 17 2019 Ray Strode - 0.6.50-6 +- Make sure cache file is read for root user + Resolves: #1741098 + * Fri May 10 2019 Ray Strode - 0.6.50-5 - Don't send change updates for login-history Resolves: #1708741