diff options
author | ache <ache@FreeBSD.org> | 1996-06-09 20:40:58 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-06-09 20:40:58 +0000 |
commit | 24909cdf1b7fcfb249c10a5726247140946b5bcb (patch) | |
tree | d2486f710089c9ea8296dee5b819a39458c5332d /usr.sbin/ppp/command.c | |
parent | f7458dfe5bdb551307603c2e36e959aa4d328798 (diff) | |
download | FreeBSD-src-24909cdf1b7fcfb249c10a5726247140946b5bcb.zip FreeBSD-src-24909cdf1b7fcfb249c10a5726247140946b5bcb.tar.gz |
Prepare for exec properly and check return values
Submitted by: Arjan de Vet <devet@IAEhv.nl>
Diffstat (limited to 'usr.sbin/ppp/command.c')
-rw-r--r-- | usr.sbin/ppp/command.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index d73dfa8..c22eff2 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.16 1996/03/08 13:22:23 ache Exp $ + * $Id: command.c,v 1.17 1996/05/11 20:48:22 phk Exp $ * */ #include <sys/types.h> @@ -190,9 +190,14 @@ char **argv; * We are running setuid, we should change to * real user for avoiding security problems. */ - setgid( getgid() ); - setuid( getuid() ); - + if (setgid(getgid()) < 0) { + perror("setgid"); + exit(1); + } + if (setuid(getuid()) < 0) { + perror("setuid"); + exit(1); + } TtyOldMode(); if(argc > 0) execvp(argv[0], argv); |