summaryrefslogtreecommitdiffstats
path: root/games/rogue
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-09-24 20:48:39 +0000
committerache <ache@FreeBSD.org>1997-09-24 20:48:39 +0000
commit2fcd0934d396f58f77f7c2dec14f771aa62700e7 (patch)
tree93689f39d833d41ca57d9e2040f2f8c9aa4eb5ce /games/rogue
parent60b0e6fbbf1a5776748be4767011d3e485732adc (diff)
downloadFreeBSD-src-2fcd0934d396f58f77f7c2dec14f771aa62700e7.zip
FreeBSD-src-2fcd0934d396f58f77f7c2dec14f771aa62700e7.tar.gz
Revoke privs before shell exit
Includes cleanup Use getlogin() Fix names in FILES section Convert to random()
Diffstat (limited to 'games/rogue')
-rw-r--r--games/rogue/machdep.c13
-rw-r--r--games/rogue/random.c5
-rw-r--r--games/rogue/rogue.64
-rw-r--r--games/rogue/rogue.h8
4 files changed, 16 insertions, 14 deletions
diff --git a/games/rogue/machdep.c b/games/rogue/machdep.c
index 87266b1..a6b1dfa 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 <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
#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 a721b16..ddf55fd 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 4c46707..01e6eaa 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 2c694ec..b3009be 100644
--- a/games/rogue/rogue.h
+++ b/games/rogue/rogue.h
@@ -36,6 +36,7 @@
* @(#)rogue.h 8.1 (Berkeley) 5/31/93
*/
+#include <string.h>
/*
* 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();
OpenPOWER on IntegriCloud