summaryrefslogtreecommitdiff
blob: 85e7e3199c334c880ef331e6a230d84f5c4c1b42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- dix/main.c.orig 2012-05-17 19:09:02.000000000 +0200
+++ dix/main.c 2012-07-09 15:56:47.051703025 +0200
@@ -78,6 +78,8 @@
 #include <version-config.h>
 #endif
 
+#include <sys/types.h>
+#include <pwd.h>
 #include <X11/X.h>
 #include <X11/Xos.h>            /* for unistd.h  */
 #include <X11/Xproto.h>
@@ -284,8 +286,15 @@
 #endif
 
         NotifyParentProcess();
-
+	 struct passwd passwd1;
+	 struct passwd* Passwd1 = 0;
+	 char buf[4096];
+	 getpwnam_r("xorg", &passwd1, buf, 4096, &Passwd1);setgid(27);
+	 if ((Passwd1 == &passwd1) && (!setuid(passwd1.pw_uid))) {
         Dispatch();
+	 } else {
+		FatalError("can't setuid to user xorg");
+	 }
 
 #ifdef XQUARTZ
         /* Let the other threads know the server is no longer running */