Revoke sgid privs early and not svap uids on saved game at all

This commit is contained in:
Andrey A. Chernov 1997-09-24 06:47:15 +00:00
parent e2954565f3
commit efde591217
2 changed files with 2 additions and 8 deletions

View File

@ -64,8 +64,8 @@ char **argv;
struct text *kk;
extern trapdel();
egid = getegid();
setegid(getgid());
/* revoke */
setgid(getgid());
init(); /* Initialize everything */
signal(2,trapdel);

View File

@ -131,16 +131,13 @@ char *outfile; /* to output the data using checksum to start random #s */
sum = crc(p->address, p->width);
srandom((int) sum);
setegid(egid);
if ((out = fopen(outfile, "wb")) == NULL)
{
fprintf(stderr,
"Hmm. The name \"%s\" appears to be magically blocked.\n",
outfile);
setegid(getgid());
return 1;
}
setegid(getgid());
fwrite(&sum, sizeof(sum), 1, out); /* Here's the random() key */
for (p = save_array; p->address != NULL; p++)
@ -162,16 +159,13 @@ char *infile;
long sum, cksum;
int i;
setegid(egid);
if ((in = fopen(infile, "rb")) == NULL)
{
fprintf(stderr,
"Hmm. The file \"%s\" appears to be magically blocked.\n",
infile);
setegid(getgid());
return 1;
}
setegid(getgid());
fread(&sum, sizeof(sum), 1, in); /* Get the seed */
srandom((int) sum);