diff options
author | Matthieu Herrb <matthieu.herrb@laas.fr> | 2006-06-20 19:11:16 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu.herrb@laas.fr> | 2006-06-20 19:11:16 +0000 |
commit | 8d37f63810fc12f113bfcf37065ac9da09702b46 (patch) | |
tree | 8f7211b75038b297df08e44a2ef61fd68e0a1773 | |
parent | f9a47b508a89c647829266aacb19a0fc2dbb6158 (diff) |
Check setuild() return value. Bugzilla #7116.xtrans-1_0_1
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Xtranslcl.c | 13 |
2 files changed, 16 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2006-06-20 Matthieu Herrb <matthieu.herrb@laas.fr> + + * Xtranslcl.c + Check setuid() return value. Bugzilla #7116. + 2006-05-25 Jeremy C. Reed <reed@reedmedia.net> * Xtranssock.c: diff --git a/Xtranslcl.c b/Xtranslcl.c index 8aa583f..6165d36 100644 --- a/Xtranslcl.c +++ b/Xtranslcl.c @@ -360,7 +360,10 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port) uid_t saved_euid; saved_euid = geteuid(); - setuid( getuid() ); /** sets the euid to the actual/real uid **/ + /** sets the euid to the actual/real uid **/ + if (setuid( getuid() ) == -1) { + exit(1); + } if( chown( slave, saved_euid, -1 ) < 0 ) { exit( 1 ); } @@ -369,7 +372,13 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port) } waitpid(saved_pid, &exitval, 0); - + if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) { + close(fd); + close(server); + PRMSG(1, "PTSOpenClient: cannot set the owner of %s\n", + slave, 0, 0); + return(-1); + } if (chmod(slave, 0666) < 0) { close(fd); close(server); |