From cd005dd0cd8afcab7319a19fa11685a9650066ae Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 24 Sep 1997 20:48:39 +0000 Subject: Revoke privs before shell exit Includes cleanup Use getlogin() Fix names in FILES section Convert to random() --- games/rogue/machdep.c | 13 +++++++------ games/rogue/random.c | 5 ++++- games/rogue/rogue.6 | 4 ++-- games/rogue/rogue.h | 8 +++----- 4 files changed, 16 insertions(+), 14 deletions(-) (limited to 'games/rogue') diff --git a/games/rogue/machdep.c b/games/rogue/machdep.c index 87266b11976a..a6b1dfa6cc00 100644 --- a/games/rogue/machdep.c +++ b/games/rogue/machdep.c @@ -108,6 +108,8 @@ static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93"; #endif #include +#include +#include #include "rogue.h" #include "pathnames.h" @@ -381,7 +383,10 @@ char * md_gln() { struct passwd *p; + char *s; + if ((s = getlogin())) + return s; if (!(p = getpwuid(getuid()))) return((char *)NULL); return(p->pw_name); @@ -444,7 +449,6 @@ md_getenv(name) char *name; { char *value; - char *getenv(); value = getenv(name); @@ -463,7 +467,6 @@ char * md_malloc(n) int n; { - char *malloc(); char *t; t = malloc(n); @@ -552,10 +555,8 @@ char *shell; long w[2]; if (!fork()) { - int uid; - - uid = getuid(); - setuid(uid); + /* revoke */ + setgid(getgid()); execl(shell, shell, 0); } wait(w); diff --git a/games/rogue/random.c b/games/rogue/random.c index a721b1669798..ddf55fda97c7 100644 --- a/games/rogue/random.c +++ b/games/rogue/random.c @@ -38,6 +38,9 @@ static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93"; #endif /* not lint */ +#include "rogue.h" + +#if 0 /* * random.c * @@ -72,7 +75,6 @@ srrandom(x) int x; { register int i; - long rrandom(); state[0] = (long) x; if (rand_type != 0) { @@ -108,6 +110,7 @@ rrandom() } return(i); } +#endif get_rand(x, y) register int x, y; diff --git a/games/rogue/rogue.6 b/games/rogue/rogue.6 index 4c4670761c49..01e6eaa1564f 100644 --- a/games/rogue/rogue.6 +++ b/games/rogue/rogue.6 @@ -95,9 +95,9 @@ Glenn Wichman .SH FILES .DT .ta \w'/usr/games/lib/rogue_roll\ \ \ 'u -/usr/games/lib/rogue_roll Score file +/var/games/rogue.scores Score file .br -\fB~\fP/rogue.save Default save file +rogue.save Default save file .SH SEE ALSO Michael C. Toy and diff --git a/games/rogue/rogue.h b/games/rogue/rogue.h index 2c694ec69961..b3009be1648f 100644 --- a/games/rogue/rogue.h +++ b/games/rogue/rogue.h @@ -36,6 +36,7 @@ * @(#)rogue.h 8.1 (Berkeley) 5/31/93 */ +#include /* * rogue.h * @@ -426,10 +427,6 @@ extern object level_monsters; /* external routine declarations. */ -char *strcpy(); -char *strncpy(); -char *strcat(); - char *mon_name(); char *get_ench_color(); char *name_of(); @@ -457,7 +454,8 @@ object *object_at(); object *pick_up(); struct id *get_id_table(); unsigned short gr_what_is(); -long rrandom(); +#define rrandom random +#define srrandom(x) srandomdev() long lget_number(); long xxx(); void byebye(), onintr(), error_save(); -- cgit v1.3