diff options
author | ache <ache@FreeBSD.org> | 1997-09-24 06:47:15 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-09-24 06:47:15 +0000 |
commit | 8acbd05f99be0b83f71366e26584715af13f0872 (patch) | |
tree | 067daea07bb390f0eb7dc28108369294ff0de274 /games/adventure | |
parent | c9faba1300c1044f1fabe35c283fcb50bcb65da8 (diff) | |
download | FreeBSD-src-8acbd05f99be0b83f71366e26584715af13f0872.zip FreeBSD-src-8acbd05f99be0b83f71366e26584715af13f0872.tar.gz |
Revoke sgid privs early and not svap uids on saved game at all
Diffstat (limited to 'games/adventure')
-rw-r--r-- | games/adventure/main.c | 4 | ||||
-rw-r--r-- | games/adventure/save.c | 6 |
2 files changed, 2 insertions, 8 deletions
diff --git a/games/adventure/main.c b/games/adventure/main.c index 3d7fb9a..6f7277d 100644 --- a/games/adventure/main.c +++ b/games/adventure/main.c @@ -64,8 +64,8 @@ char **argv; struct text *kk; extern trapdel(); - egid = getegid(); - setegid(getgid()); + /* revoke */ + setgid(getgid()); init(); /* Initialize everything */ signal(2,trapdel); diff --git a/games/adventure/save.c b/games/adventure/save.c index 763e56b..5277380 100644 --- a/games/adventure/save.c +++ b/games/adventure/save.c @@ -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); |