[gdm] worker: create program session log file as root
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] worker: create program session log file as root
- Date: Mon, 1 Oct 2012 21:58:37 +0000 (UTC)
commit 01c334ed94b64a3b2e9119e95e968db24dac5a31
Author: Ray Strode <rstrode redhat com>
Date: Mon Oct 1 17:51:47 2012 -0400
worker: create program session log file as root
The log file goes to a root owned directory so should
be opened by root.
daemon/gdm-session-worker.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 3f250f9..1dfeee3 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1780,6 +1780,14 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
char *home_dir;
int fd;
+ fd = open ("/dev/null", O_RDWR);
+ dup2 (fd, STDIN_FILENO);
+ close (fd);
+
+ if (worker->priv->is_program_session) {
+ fd = _open_program_session_log (worker->priv->log_file);
+ }
+
if (setuid (worker->priv->uid) < 0) {
g_debug ("GdmSessionWorker: could not reset uid: %s", g_strerror (errno));
_exit (1);
@@ -1791,7 +1799,6 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
_exit (2);
}
-
kerberos_cache = gdm_session_worker_get_environment_variable (worker, "KRB5CCNAME");
if (kerberos_cache == NULL) {
@@ -1823,13 +1830,7 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
g_chdir ("/");
}
- fd = open ("/dev/null", O_RDWR);
- dup2 (fd, STDIN_FILENO);
- close (fd);
-
- if (worker->priv->is_program_session) {
- fd = _open_program_session_log (worker->priv->log_file);
- } else {
+ if (!worker->priv->is_program_session) {
if (home_dir != NULL && home_dir[0] != '\0') {
char *cache_dir;
char *log_dir;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]