Blame SOURCES/0002-power-Never-register-sleep-timeout-for-logout-in-GDM.patch

95b2ff
From f2cd5fb30892e3868732fca1d38fc15fdb73ec18 Mon Sep 17 00:00:00 2001
95b2ff
From: Benjamin Berg <bberg@redhat.com>
95b2ff
Date: Tue, 27 Oct 2020 10:20:34 +0100
95b2ff
Subject: [PATCH 2/2] power: Never register sleep timeout for logout in GDM
95b2ff
95b2ff
We already suppress logout actions in GDM (10aa1714b05b, power: Avoid
95b2ff
automatic logout in GDM/greeter). However, while this prevents the
95b2ff
action, we may still warn.
95b2ff
95b2ff
Change it so that the corresponding timeouts will never be registered.
95b2ff
Leave the guard in gnome_session_logout but add a warning as we should
95b2ff
never be hitting that code path.
95b2ff
---
95b2ff
 plugins/power/gsd-power-manager.c | 11 ++++++++++-
95b2ff
 1 file changed, 10 insertions(+), 1 deletion(-)
95b2ff
95b2ff
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
95b2ff
index 9f2e858e..ed855b6b 100644
95b2ff
--- a/plugins/power/gsd-power-manager.c
95b2ff
+++ b/plugins/power/gsd-power-manager.c
95b2ff
@@ -872,8 +872,10 @@ static void
95b2ff
 gnome_session_logout (GsdPowerManager *manager,
95b2ff
                       guint            logout_mode)
95b2ff
 {
95b2ff
-        if (g_getenv("RUNNING_UNDER_GDM"))
95b2ff
+        if (g_getenv ("RUNNING_UNDER_GDM")) {
95b2ff
+                g_warning ("Prevented logout from GDM session! This indicates an issue in gsd-power.");
95b2ff
                 return;
95b2ff
+        }
95b2ff
 
95b2ff
         g_dbus_proxy_call (G_DBUS_PROXY (manager->priv->session),
95b2ff
                            "Logout",
95b2ff
@@ -1773,6 +1775,13 @@ idle_configure (GsdPowerManager *manager)
95b2ff
                 timeout_sleep = 0;
95b2ff
         }
95b2ff
 
95b2ff
+        /* don't do any automatic logout if we are in GDM */
95b2ff
+        if (g_getenv ("RUNNING_UNDER_GDM") &&
95b2ff
+            (action_type == GSD_POWER_ACTION_LOGOUT)) {
95b2ff
+                g_debug ("Ignoring sleep timeout with logout action inside GDM");
95b2ff
+                timeout_sleep = 0;
95b2ff
+        }
95b2ff
+
95b2ff
         if (timeout_sleep != 0) {
95b2ff
                 g_debug ("setting up sleep callback %is", timeout_sleep);
95b2ff
 
95b2ff
-- 
95b2ff
2.26.2
95b2ff