Make hack suid "games" (additionly to sgid "games" as run),
it is needed for savegames and bones, they intendent to not be altered by user and can't be pre-created as scorefile. Clear savegames on install: target too, not only bones Install rumors not readable by all. Cleanup includes a little.
This commit is contained in:
parent
d268e22df8
commit
95b6000adc
@ -20,6 +20,13 @@ HIDEGAME=hidegame
|
||||
DPSRCS+= hack.onames.h
|
||||
CLEANFILES+= hack.onames.h makedefs
|
||||
|
||||
#
|
||||
# Need to be suid for created savefiles and bones, they must not be
|
||||
# altered by user
|
||||
#
|
||||
BINOWN= games
|
||||
BINMODE= 4550
|
||||
|
||||
.depend: hack.onames.h
|
||||
|
||||
hack.onames.h: makedefs def.objects.h
|
||||
@ -33,11 +40,12 @@ beforeinstall:
|
||||
${DESTDIR}/var/games/hackdir/perm
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
|
||||
${DESTDIR}/var/games/hackdir/record
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${.CURDIR}/rumors \
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 660 ${.CURDIR}/rumors \
|
||||
${DESTDIR}/var/games/hackdir/rumors
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
|
||||
${.CURDIR}/help ${.CURDIR}/hh ${.CURDIR}/data \
|
||||
${DESTDIR}/var/games/hackdir
|
||||
rm -f ${DESTDIR}/var/games/hackdir/bones*
|
||||
rm -f ${DESTDIR}/var/games/hackdir/bones* \
|
||||
${DESTDIR}/var/games/hackdir/save/*
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "hack.h"
|
||||
|
||||
#ifdef QUEST
|
||||
@ -11,7 +13,6 @@
|
||||
#define gamename "hack"
|
||||
#endif
|
||||
|
||||
extern char *getlogin(), *getenv();
|
||||
extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
|
||||
extern struct permonst mons[CMNUM+2];
|
||||
extern char genocided[], fut_geno[];
|
||||
@ -461,6 +462,7 @@ boolean wr;
|
||||
) {
|
||||
/* revoke */
|
||||
setgid(getgid());
|
||||
setuid(getuid());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -8,11 +8,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "hack.h"
|
||||
extern int CO, LI; /* usually COLNO and ROWNO+2 */
|
||||
extern char *CD;
|
||||
extern char quitchars[];
|
||||
extern char *getenv(), *getlogin();
|
||||
void done1();
|
||||
|
||||
dowhatis()
|
||||
@ -380,6 +381,7 @@ child(wt) {
|
||||
settty((char *) 0); /* also calls end_screen() */
|
||||
/* revoke */
|
||||
setgid(getgid());
|
||||
setuid(getuid());
|
||||
#ifdef CHDIR
|
||||
(void) chdir(getenv("HOME"));
|
||||
#endif CHDIR
|
||||
|
Loading…
Reference in New Issue
Block a user