[gdm] worker: setuid after taking control of tty
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] worker: setuid after taking control of tty
- Date: Fri, 27 Feb 2015 17:32:44 +0000 (UTC)
commit 12abebdee723a62e09b52f88c84d76bd6d3f6590
Author: Ray Strode <rstrode redhat com>
Date: Fri Feb 27 12:31:12 2015 -0500
worker: setuid after taking control of tty
This ensures we the session is always given
the tty.
daemon/gdm-session-worker.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 90c9245..671a95a 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1912,19 +1912,6 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
stderr_fd = dup (stdout_fd);
}
-#ifdef HAVE_LOGINCAP
- if (setusercontext (NULL, passwd_entry, passwd_entry->pw_uid, LOGIN_SETALL) < 0) {
- g_debug ("GdmSessionWorker: setusercontext() failed for user %s: %s",
- passwd_entry->pw_name, g_strerror (errno));
- _exit (1);
- }
-#else
- if (setuid (worker->priv->uid) < 0) {
- g_debug ("GdmSessionWorker: could not reset uid: %s", g_strerror (errno));
- _exit (1);
- }
-#endif
-
if (setsid () < 0) {
g_debug ("GdmSessionWorker: could not set pid '%u' as leader of new session and
process group: %s",
(guint) getpid (), g_strerror (errno));
@@ -1941,6 +1928,19 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
}
#endif
+#ifdef HAVE_LOGINCAP
+ if (setusercontext (NULL, passwd_entry, passwd_entry->pw_uid, LOGIN_SETALL) < 0) {
+ g_debug ("GdmSessionWorker: setusercontext() failed for user %s: %s",
+ passwd_entry->pw_name, g_strerror (errno));
+ _exit (1);
+ }
+#else
+ if (setuid (worker->priv->uid) < 0) {
+ g_debug ("GdmSessionWorker: could not reset uid: %s", g_strerror (errno));
+ _exit (1);
+ }
+#endif
+
environment = gdm_session_worker_get_environment (worker);
g_assert (geteuid () == getuid ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]