Blob Blame History Raw
From db99c5181950f6f383b75e9956e170d3b2762d15 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 24 Jun 2019 16:21:59 -0400
Subject: [PATCH 3/7] session-worker: uninitialize pam if worker is killed

Right nowe don't uninitialize pam or switch back to the
starting VT if the worker is killed before the session.

This commit fixes that.
---
 daemon/gdm-session-worker.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index e526fa5db..f9bc82177 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -3534,60 +3534,64 @@ gdm_session_worker_init (GdmSessionWorker *worker)
 static void
 gdm_session_worker_unwatch_child (GdmSessionWorker *worker)
 {
         if (worker->priv->child_watch_id == 0)
                 return;
 
         g_source_remove (worker->priv->child_watch_id);
         worker->priv->child_watch_id = 0;
 }
 
 
 static void
 gdm_session_worker_finalize (GObject *object)
 {
         GdmSessionWorker *worker;
 
         g_return_if_fail (object != NULL);
         g_return_if_fail (GDM_IS_SESSION_WORKER (object));
 
         worker = GDM_SESSION_WORKER (object);
 
         g_return_if_fail (worker->priv != NULL);
 
         gdm_session_worker_unwatch_child (worker);
 
         if (worker->priv->child_pid > 0) {
                 gdm_signal_pid (worker->priv->child_pid, SIGTERM);
                 gdm_wait_on_pid (worker->priv->child_pid);
         }
 
+        if (worker->priv->pam_handle != NULL) {
+                gdm_session_worker_uninitialize_pam (worker, PAM_SUCCESS);
+        }
+
         g_object_unref (worker->priv->user_settings);
         g_free (worker->priv->service);
         g_free (worker->priv->x11_display_name);
         g_free (worker->priv->x11_authority_file);
         g_free (worker->priv->display_device);
         g_free (worker->priv->display_seat_id);
         g_free (worker->priv->hostname);
         g_free (worker->priv->username);
         g_free (worker->priv->server_address);
         g_strfreev (worker->priv->arguments);
         g_strfreev (worker->priv->extensions);
 
         g_hash_table_unref (worker->priv->reauthentication_requests);
 
         G_OBJECT_CLASS (gdm_session_worker_parent_class)->finalize (object);
 }
 
 GdmSessionWorker *
 gdm_session_worker_new (const char *address,
                         gboolean    is_reauth_session)
 {
         GObject *object;
 
         object = g_object_new (GDM_TYPE_SESSION_WORKER,
                                "server-address", address,
                                "is-reauth-session", is_reauth_session,
                                NULL);
 
         return GDM_SESSION_WORKER (object);
 }
-- 
2.21.0