Blame SOURCES/0017-lib-don-t-try-to-update-login-frequency-manually.patch

6f965c
From 94e16cbaba4e727af4fe40a039110c5d0f0eb467 Mon Sep 17 00:00:00 2001
6f965c
From: Ray Strode <rstrode@redhat.com>
6f965c
Date: Wed, 14 Feb 2018 10:00:19 -0500
6f965c
Subject: [PATCH 17/17] lib: don't try to update login frequency manually
6f965c
6f965c
The library will try to update the login frequency to 1 if the
6f965c
requested user isn't finished asynchronously loading yet, but we
6f965c
know they have an open session.
6f965c
6f965c
That no longer works, since we no longer track login-frequency
6f965c
separately from the dbus proxy object.
6f965c
6f965c
This commit drops the code, since it's unnecessary anyway.
6f965c
6f965c
To be "on the safe side" we change the value returned for unloaded
6f965c
users from 0 to 1.  This is okay because the value is undefined
6f965c
before the user is loaded anyway.
6f965c
---
6f965c
 src/libaccountsservice/act-user-manager.c | 6 ------
6f965c
 src/libaccountsservice/act-user.c         | 2 +-
6f965c
 2 files changed, 1 insertion(+), 7 deletions(-)
6f965c
6f965c
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
6f965c
index 6c6628b..6efb772 100644
6f965c
--- a/src/libaccountsservice/act-user-manager.c
6f965c
+++ b/src/libaccountsservice/act-user-manager.c
6f965c
@@ -1663,66 +1663,60 @@ get_x11_display_for_new_session (ActUserManagerNewSession *new_session)
6f965c
 static void
6f965c
 maybe_add_new_session (ActUserManagerNewSession *new_session)
6f965c
 {
6f965c
         ActUserManager *manager;
6f965c
         ActUser        *user;
6f965c
         gboolean        is_ours;
6f965c
 
6f965c
         manager = ACT_USER_MANAGER (new_session->manager);
6f965c
 
6f965c
         is_ours = TRUE;
6f965c
 
6f965c
         if (new_session->x11_display == NULL) {
6f965c
                 g_debug ("AcUserManager: (mostly) ignoring session '%s' since it's not graphical",
6f965c
                          new_session->id);
6f965c
                 is_ours = FALSE;
6f965c
         } else if (session_is_login_window (manager, new_session->id)) {
6f965c
                 new_session->state = ACT_USER_MANAGER_NEW_SESSION_STATE_LOADED;
6f965c
                 unload_new_session (new_session);
6f965c
                 return;
6f965c
         } else if (!session_is_on_our_seat (manager, new_session->id)) {
6f965c
                 is_ours = FALSE;
6f965c
         }
6f965c
 
6f965c
         user = act_user_manager_get_user_by_id (manager, new_session->uid);
6f965c
         if (user == NULL) {
6f965c
                 unload_new_session (new_session);
6f965c
                 return;
6f965c
         }
6f965c
 
6f965c
         add_session_for_user (manager, user, new_session->id, is_ours);
6f965c
-
6f965c
-        /* if we haven't yet gotten the login frequency
6f965c
-           then at least add one because the session exists */
6f965c
-        if (act_user_get_login_frequency (user) == 0) {
6f965c
-                _act_user_update_login_frequency (user, 1);
6f965c
-        }
6f965c
 }
6f965c
 
6f965c
 static void
6f965c
 load_new_session (ActUserManager *manager,
6f965c
                   const char     *session_id)
6f965c
 {
6f965c
         ActUserManagerNewSession *new_session;
6f965c
 
6f965c
         new_session = g_slice_new0 (ActUserManagerNewSession);
6f965c
 
6f965c
         new_session->manager = g_object_ref (manager);
6f965c
         new_session->id = g_strdup (session_id);
6f965c
         new_session->state = ACT_USER_MANAGER_NEW_SESSION_STATE_UNLOADED + 1;
6f965c
         new_session->cancellable = g_cancellable_new ();
6f965c
 
6f965c
         manager->priv->new_sessions = g_slist_prepend (manager->priv->new_sessions,
6f965c
                                                        new_session);
6f965c
         load_new_session_incrementally (new_session);
6f965c
 }
6f965c
 
6f965c
 static void
6f965c
 seat_session_added (GDBusProxy     *seat_proxy,
6f965c
                     const char     *session_id,
6f965c
                     ActUserManager *manager)
6f965c
 {
6f965c
         g_debug ("ActUserManager: Session added: %s", session_id);
6f965c
 
6f965c
         load_new_session (manager, session_id);
6f965c
 }
6f965c
 
6f965c
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
6f965c
index e21c9db..bc8b7f8 100644
6f965c
--- a/src/libaccountsservice/act-user.c
6f965c
+++ b/src/libaccountsservice/act-user.c
6f965c
@@ -705,61 +705,61 @@ act_user_get_location (ActUser *user)
6f965c
  *
6f965c
  * Returns: (transfer none): a pointer to an array of characters which must not be modified or
6f965c
  *  freed, or %NULL.
6f965c
  **/
6f965c
 
6f965c
 const char *
6f965c
 act_user_get_user_name (ActUser *user)
6f965c
 {
6f965c
         g_return_val_if_fail (ACT_IS_USER (user), NULL);
6f965c
 
6f965c
         if (user->accounts_proxy == NULL)
6f965c
                 return NULL;
6f965c
 
6f965c
         return accounts_user_get_user_name (user->accounts_proxy);
6f965c
 }
6f965c
 
6f965c
 /**
6f965c
  * act_user_get_login_frequency:
6f965c
  * @user: a #ActUser
6f965c
  *
6f965c
  * Returns the number of times @user has logged in.
6f965c
  *
6f965c
  * Returns: the login frequency
6f965c
  */
6f965c
 int
6f965c
 act_user_get_login_frequency (ActUser *user)
6f965c
 {
6f965c
         g_return_val_if_fail (ACT_IS_USER (user), 0);
6f965c
 
6f965c
         if (user->accounts_proxy == NULL)
6f965c
-                return 0;
6f965c
+                return 1;
6f965c
 
6f965c
         return accounts_user_get_login_frequency (user->accounts_proxy);
6f965c
 }
6f965c
 
6f965c
 /**
6f965c
  * act_user_get_login_time:
6f965c
  * @user: a #ActUser
6f965c
  *
6f965c
  * Returns the last login time for @user.
6f965c
  *
6f965c
  * Returns: (transfer none): the login time
6f965c
  */
6f965c
 gint64
6f965c
 act_user_get_login_time (ActUser *user)
6f965c
 {
6f965c
         g_return_val_if_fail (ACT_IS_USER (user), 0);
6f965c
 
6f965c
         if (user->accounts_proxy == NULL)
6f965c
                 return 0;
6f965c
 
6f965c
         return accounts_user_get_login_time (user->accounts_proxy);
6f965c
 }
6f965c
 
6f965c
 /**
6f965c
  * act_user_get_login_history:
6f965c
  * @user: a #ActUser
6f965c
  *
6f965c
  * Returns the login history for @user.
6f965c
  *
6f965c
  * Returns: (transfer none): a pointer to GVariant of type "a(xxa{sv})"
6f965c
-- 
6f965c
2.14.3
6f965c