Magellan Linux

Contents of /trunk/xdm/patches/xdm-1.0.1-setuid.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years ago) by niro
File size: 1364 byte(s)
-import

1 Index: session.c
2 ===================================================================
3 RCS file: /cvs/xorg/app/xdm/session.c,v
4 retrieving revision 1.7
5 diff -u -r1.7 session.c
6 --- session.c 3 Jun 2006 00:05:24 -0000 1.7
7 +++ session.c 19 Jun 2006 21:30:50 -0000
8 @@ -492,8 +492,14 @@
9 else
10 ResetServer (d);
11 if (removeAuth) {
12 - setgid (verify.gid);
13 - setuid (verify.uid);
14 + if (setgid (verify.gid) == -1) {
15 + LogError( "SessionExit: setgid: %s\n", strerror(errno));
16 + exit(status);
17 + }
18 + if (setuid (verify.uid) == -1) {
19 + LogError( "SessionExit: setuid: %s\n", strerror(errno));
20 + exit(status);
21 + }
22 RemoveUserAuthorization (d, &verify);
23 #if defined(K5AUTH) && !defined(USE_PAM) /* PAM modules should handle this */
24 /* do like "kdestroy" program */
25 Index: xdmshell.c
26 ===================================================================
27 RCS file: /cvs/xorg/app/xdm/xdmshell.c,v
28 retrieving revision 1.3
29 diff -u -r1.3 xdmshell.c
30 --- xdmshell.c 14 Jul 2005 22:58:25 -0000 1.3
31 +++ xdmshell.c 19 Jun 2006 21:30:50 -0000
32 @@ -183,7 +183,11 @@
33 #endif
34
35 /* make xdm run in a non-setuid environment */
36 - setuid (geteuid());
37 + if (setuid (geteuid()) == -1) {
38 + fprintf(stderr, "%s: cannot setuid (error %d, %s)\r\n",
39 + ProgramName, errno, strerror(errno));
40 + exit(1);
41 + }
42
43 /*
44 * exec /usr/bin/X11/xdm -nodaemon -udpPort 0