accountsservice/as-fate318433-prevent-same-account-multi-logins.patch

76 lines
3.3 KiB
Diff

diff -Nur accountsservice-22.08.8/src/libaccountsservice/act-user.c new/src/libaccountsservice/act-user.c
--- accountsservice-22.08.8/src/libaccountsservice/act-user.c 2022-02-23 16:27:48.000000000 +0100
+++ new/src/libaccountsservice/act-user.c 2022-04-30 22:34:42.160346848 +0200
@@ -878,6 +878,8 @@
* (Currently, this function is only implemented for systemd-logind.
* For ConsoleKit, it is equivalent to act_user_is_logged_in.)
*
+ * (SLE-12 SP2: 'other_sessions' have been modified to contain only X sessions)
+ *
* Returns: %TRUE or %FALSE
*/
gboolean
@@ -906,6 +908,24 @@
}
/**
+ * act_user_is_x_logged_in_remotely:
+ * @user: a #ActUser
+ *
+ * Returns whether or not #ActUser is currently graphically logged in on a
+ * different seat or no seat.
+ *
+ * (For SLE12-SP2: fate#318433)
+ *
+ * Returns: %TRUE or %FALSE
+ */
+gboolean
+act_user_is_x_logged_in_remotely (ActUser *user)
+{
+ /* return user->remote_x_sessions; */
+ return (user->other_sessions != NULL);
+}
+
+/**
* act_user_get_locked:
* @user: a #ActUser
*
diff -Nur accountsservice-22.08.8/src/libaccountsservice/act-user.h new/src/libaccountsservice/act-user.h
--- accountsservice-22.08.8/src/libaccountsservice/act-user.h 2022-02-23 16:27:48.000000000 +0100
+++ new/src/libaccountsservice/act-user.h 2022-04-30 22:34:42.164346848 +0200
@@ -61,6 +61,7 @@
guint act_user_get_num_sessions_anywhere (ActUser *user);
gboolean act_user_is_logged_in (ActUser *user);
gboolean act_user_is_logged_in_anywhere (ActUser *user);
+gboolean act_user_is_x_logged_in_remotely (ActUser *user);
int act_user_get_login_frequency (ActUser *user);
gint64 act_user_get_login_time (ActUser *user);
const GVariant*act_user_get_login_history (ActUser *user);
diff -Nur accountsservice-22.08.8/src/libaccountsservice/act-user-manager.c new/src/libaccountsservice/act-user-manager.c
--- accountsservice-22.08.8/src/libaccountsservice/act-user-manager.c 2022-02-23 16:27:48.000000000 +0100
+++ new/src/libaccountsservice/act-user-manager.c 2022-04-30 22:34:42.160346848 +0200
@@ -1366,12 +1366,22 @@
if (new_session->x11_display == NULL) {
g_debug ("AcUserManager: (mostly) ignoring session '%s' since it's not graphical",
new_session->id);
- is_ours = FALSE;
+ /* SLE: ignore non-graphical session completely */
+ /* see `act_user_is_logged_in_anywhere` */
+ unload_new_session (new_session);
+ return;
} else if (session_is_login_window (manager, new_session->id)) {
new_session->state = ACT_USER_MANAGER_NEW_SESSION_STATE_LOADED;
unload_new_session (new_session);
return;
} else if (!session_is_on_our_seat (manager, new_session->id)) {
+ /**
+ * NOTE: if `manager->priv->seat.id` or `new_session->id` is
+ * either NULL, it's not on our seat: this is reasonable, as
+ * non-seat session is not switchable and thus no need to be
+ * ours. However, this nondiscrimination for all non-seated
+ * sessions is possibly a source for bugs.
+ */
is_ours = FALSE;
}