[gdm/wip/systemd-activation] worker: hackity hack hack hack



commit ef0122010dd68e15da889b43fbd20b835ef1cfa9
Author: Ray Strode <rstrode redhat com>
Date:   Thu Apr 17 16:45:22 2014 -0400

    worker: hackity hack hack hack

 daemon/gdm-session-worker.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 8493fbd..4c12d98 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1996,6 +1996,7 @@ set_up_for_new_vt (GdmSessionWorker *worker)
         int fd;
         char vt_string[256], tty_string[256];
         struct vt_stat vt_state = { 0 };
+        char *display;
         int session_vt = 0;
 
         fd = open ("/dev/tty0", O_RDWR | O_NOCTTY);
@@ -2037,6 +2038,20 @@ set_up_for_new_vt (GdmSessionWorker *worker)
         worker->priv->session_tty_fd = open (tty_string, O_RDWR | O_NOCTTY);
         pam_set_item (worker->priv->pam_handle, PAM_TTY, tty_string);
 
+        /* HACK HACK HACK
+         * leave the FD open to prevent OPENQRY races, but make sure it's "unknown"
+         * so the login shell doesn't try to take a controlling interest in the tty
+         * change the ownership so the unprivileged Xorg can open it.
+         */
+        fchown (worker->priv->session_tty_fd, worker->priv->uid, worker->priv->gid);
+        worker->priv->session_tty_fd = -1;
+        display = g_strdup_printf ("/run/user/%u/X11-socket", 4153);
+        gdm_session_worker_set_environment_variable (worker,
+                                                     "DISPLAY",
+                                                     display);
+        pam_set_item (worker->priv->pam_handle, PAM_XDISPLAY, display);
+        g_free (display);
+
         return TRUE;
 
 fail:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]