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