diff options
author | max <max@FreeBSD.org> | 1997-02-01 21:30:50 +0000 |
---|---|---|
committer | max <max@FreeBSD.org> | 1997-02-01 21:30:50 +0000 |
commit | b0c88e4d210ce20c6d868495b891852c3939afa6 (patch) | |
tree | 8e4e8a1158219b1dbb92ab02bfabae6bf34c447f /games/backgammon/teachgammon/teach.c | |
parent | e254d33903055e0d44084504fe6ab5f5a6b86ffb (diff) | |
download | FreeBSD-src-b0c88e4d210ce20c6d868495b891852c3939afa6.zip FreeBSD-src-b0c88e4d210ce20c6d868495b891852c3939afa6.tar.gz |
Instead of swapping ruid and euid before and after touching user's file,
simply drop the privilege right after the program is started.
Thanks to bde for giving me good suggestion about this problem.
Diffstat (limited to 'games/backgammon/teachgammon/teach.c')
-rw-r--r-- | games/backgammon/teachgammon/teach.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/games/backgammon/teachgammon/teach.c b/games/backgammon/teachgammon/teach.c index 7761ee6..bae186c 100644 --- a/games/backgammon/teachgammon/teach.c +++ b/games/backgammon/teachgammon/teach.c @@ -42,6 +42,8 @@ static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; #endif /* not lint */ #include <string.h> +#include <sys/types.h> +#include <unistd.h> #include "back.h" char *hello[]; @@ -78,6 +80,11 @@ char **argv; { register int i; + uid_t uid; + + /*Drop the privilege.*/ + uid = getuid(); + setreuid (uid,uid); acnt = 1; signal (2,getout); |