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

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