Annotation of /trunk/xtrans/patches/xtrans-1.0.0-setuid.patch
Parent Directory | Revision Log
Revision 153 -
(hide annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 900 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 900 byte(s)
-import
1 | niro | 153 | Index: Xtranslcl.c |
2 | =================================================================== | ||
3 | RCS file: /cvs/xorg/lib/xtrans/Xtranslcl.c,v | ||
4 | retrieving revision 1.4 | ||
5 | diff -u -r1.4 Xtranslcl.c | ||
6 | --- Xtranslcl.c 8 Nov 2005 06:33:26 -0000 1.4 | ||
7 | +++ Xtranslcl.c 19 Jun 2006 21:22:07 -0000 | ||
8 | @@ -360,7 +360,10 @@ | ||
9 | uid_t saved_euid; | ||
10 | |||
11 | saved_euid = geteuid(); | ||
12 | - setuid( getuid() ); /** sets the euid to the actual/real uid **/ | ||
13 | + /** sets the euid to the actual/real uid **/ | ||
14 | + if (setuid( getuid() ) == -1) { | ||
15 | + exit(1); | ||
16 | + } | ||
17 | if( chown( slave, saved_euid, -1 ) < 0 ) { | ||
18 | exit( 1 ); | ||
19 | } | ||
20 | @@ -369,7 +372,13 @@ | ||
21 | } | ||
22 | |||
23 | waitpid(saved_pid, &exitval, 0); | ||
24 | - | ||
25 | + if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) { | ||
26 | + close(fd); | ||
27 | + close(server); | ||
28 | + PRMSG(1, "PTSOpenClient: cannot set the owner of %s\n", | ||
29 | + slave, 0, 0); | ||
30 | + return(-1); | ||
31 | + } | ||
32 | if (chmod(slave, 0666) < 0) { | ||
33 | close(fd); | ||
34 | close(server); |