summaryrefslogtreecommitdiff
path: root/games/adventure/save.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-19 22:22:18 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-19 22:22:18 +0000
commite666495d5bec1a6aebe384303efe5f31db6aed2b (patch)
tree80acd2a5798eea45c4eaacfe133fe15feed672c1 /games/adventure/save.c
parent0333603e546677747279b0dc4cd7292bad1abb7c (diff)
setgid games, not setuid games. closes a neat set of holes
Diffstat (limited to 'games/adventure/save.c')
-rw-r--r--games/adventure/save.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/games/adventure/save.c b/games/adventure/save.c
index 9ee1eac3c0d..77f36f09c3d 100644
--- a/games/adventure/save.c
+++ b/games/adventure/save.c
@@ -114,7 +114,7 @@ struct savestruct save_array[] =
dseen, sizeof(dseen),
fixed, sizeof(fixed),
hinted, sizeof(hinted),
- link, sizeof(link),
+ linkx, sizeof(linkx),
odloc, sizeof(odloc),
place, sizeof(place),
prop, sizeof(prop),
@@ -131,25 +131,22 @@ char *outfile; /* to output the data using checksum to start random #s */
char *s;
long sum;
int i;
- uid_t euid_save;
crc_start();
for (p = save_array; p->address != NULL; p++)
sum = crc(p->address, p->width);
srandom((int) sum);
- euid_save = geteuid();
- seteuid(getuid());
-
+ setegid(egid);
if ((out = fopen(outfile, "wb")) == NULL)
{
fprintf(stderr,
"Hmm. The name \"%s\" appears to be magically blocked.\n",
outfile);
- seteuid(euid_save);
+ setegid(getgid());
return 1;
}
- seteuid(euid_save);
+ setegid(getgid());
fwrite(&sum, sizeof(sum), 1, out); /* Here's the random() key */
for (p = save_array; p->address != NULL; p++)
@@ -170,20 +167,17 @@ char *infile;
char *s;
long sum, cksum;
int i;
- uid_t euid_save;
-
- euid_save = geteuid();
- seteuid(euid_save);
+ setegid(egid);
if ((in = fopen(infile, "rb")) == NULL)
{
fprintf(stderr,
"Hmm. The file \"%s\" appears to be magically blocked.\n",
infile);
- seteuid(euid_save);
+ setegid(getgid());
return 1;
}
- seteuid(euid_save);
+ setegid(getgid());
fread(&sum, sizeof(sum), 1, in); /* Get the seed */
srandom((int) sum);