summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2003-12-12 17:37:03 +0000
committerGeorge Lebl <jirka@src.gnome.org>2003-12-12 17:37:03 +0000
commite7ccf4619a12c732832161b50ed4ee7892e71328 (patch)
tree24d55606a1ad14b139508a3f8f758bf2f942aae3
parentfb3fd50f54649df05354bb7639c6975b6e1b0b2b (diff)
downloadgdm-e7ccf4619a12c732832161b50ed4ee7892e71328.tar.gz
check ownership of /tmp/.gdm_socket before using
Fri Dec 12 09:36:34 2003 George Lebl <jirka@5z.com> * gui/gdmcomm.c: check ownership of /tmp/.gdm_socket before using
-rw-r--r--ChangeLog4
-rw-r--r--gui/gdmcomm.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e19d380..64d8c032 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Dec 12 09:36:34 2003 George Lebl <jirka@5z.com>
+
+ * gui/gdmcomm.c: check ownership of /tmp/.gdm_socket before using
+
Wed Dec 10 15:33:09 2003 George Lebl <jirka@5z.com>
* daemon/display.c: Fix #126465 where xdmcp_sessions would not
diff --git a/gui/gdmcomm.c b/gui/gdmcomm.c
index c738582b..558460c4 100644
--- a/gui/gdmcomm.c
+++ b/gui/gdmcomm.c
@@ -1,6 +1,6 @@
/*
* GDMcommunication routines
- * (c)2001 Queen of England, (c)2002 George Lebl
+ * (c)2001 Queen of England, (c)2002,2003 George Lebl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -365,6 +365,8 @@ gdmcomm_check (gboolean gui_bitching)
FILE *fp = NULL;
long pid;
char *pidfile;
+ struct stat s;
+ int statret;
pidfile = ve_config_get_string (ve_config_get (GDM_CONFIG_FILE),
GDM_KEY_PIDFILE);
@@ -407,7 +409,10 @@ gdmcomm_check (gboolean gui_bitching)
return FALSE;
}
- if (access (GDM_SUP_SOCKET, R_OK|W_OK)) {
+ IGNORE_EINTR (statret = stat (GDM_SUP_SOCKET, &s));
+ if (statret < 0 ||
+ s.st_uid != 0 ||
+ access (GDM_SUP_SOCKET, R_OK|W_OK) != 0) {
if (gui_bitching) {
dialog = ve_hig_dialog_new
(NULL /* parent */,