summaryrefslogtreecommitdiffstats
path: root/games/backgammon/teachgammon/teach.c
diff options
context:
space:
mode:
authormax <max@FreeBSD.org>1997-02-01 21:30:50 +0000
committermax <max@FreeBSD.org>1997-02-01 21:30:50 +0000
commitb0c88e4d210ce20c6d868495b891852c3939afa6 (patch)
tree8e4e8a1158219b1dbb92ab02bfabae6bf34c447f /games/backgammon/teachgammon/teach.c
parente254d33903055e0d44084504fe6ab5f5a6b86ffb (diff)
downloadFreeBSD-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.c7
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);
OpenPOWER on IntegriCloud