operator:*:2:20::0:0:System &:/usr/guest/operator:/sbin/nologin
bin:*:3:7::0:0:Binaries Commands and Source,,,:/:/sbin/nologin
uucp:*:66:1::0:0:UNIX-to-UNIX Copy:/var/spool/uucppublic:/usr/libexec/uucp/uucico
-games:*:7:13::0:0:Games pseudo-user:/usr/games:/sbin/nologin
nobody:*:32767:32767::0:0:Unprivileged user:/nonexistent:/sbin/nologin
ingres:*:267:74::0:0:& Group:/usr/ingres:/sbin/nologin
-# $OpenBSD: 4.4BSD.dist,v 1.27 1996/12/19 02:31:17 millert Exp $
+# $OpenBSD: 4.4BSD.dist,v 1.28 1996/12/19 22:19:50 deraadt Exp $
/set type=dir uname=root gname=wheel mode=0755
# .
games
# ./usr/games/hide
-hide gname=games uname=games mode=0700
+hide gname=games uname=root mode=0550
# ./usr/games/hide
..
..
# ./var/games
-games uname=games gname=games mode=0775
+games uname=root gname=games mode=0755
# ./var/games/hackdir
-hackdir uname=games gname=games mode=0775
+hackdir uname=root gname=games mode=0775
# ./var/games/hackdir/save
-save uname=games gname=games mode=0770
+save uname=root gname=games mode=0770
# ./var/games/hackdir/save
..
..
# ./var/games/hackdir/save XXX
-save uname=games gname=games mode=0775
+save uname=root gname=games mode=0775
# ./var/games/hackdir/save XXX
..
# ./var/games/larn
-larn uname=games gname=games mode=0775
+larn uname=root gname=games mode=0775
# ./var/games/larn
..
# ./var/games/phantasia
-phantasia uname=games gname=games mode=0775
+phantasia uname=root gname=games mode=0775
# ./var/games/phantasia
..
-# $OpenBSD: special,v 1.8 1996/12/15 20:21:56 millert Exp $
+# $OpenBSD: special,v 1.9 1996/12/19 22:19:51 deraadt Exp $
# $NetBSD: special,v 1.4 1996/05/08 21:30:18 pk Exp $
# @(#)special 8.2 (Berkeley) 1/23/94
#
bin type=dir mode=0755 uname=root gname=wheel ignore
.. #usr/bin
games type=dir mode=0755 uname=root gname=wheel optional
-hide type=dir mode=0700 uname=games gname=games optional ignore
+hide type=dir mode=0700 uname=root gname=wheel optional ignore
.. #usr/games/hide
.. #usr/games
include type=dir mode=0755 uname=root gname=bin ignore
*/
/* hdr.h: included by c advent files */
+#include <sys/types.h>
int datfd; /* message file descriptor */
int delhit;
int hints[20][5]; /* info on hints */
int hinted[20],hintlc[20];
-int place[101], prop[101],link[201];
+int place[101], prop[101],linkx[201];
int abb[LOCSIZ];
int maxtrs,tally,tally2; /* treasure values */
/* We need to get a little tricky to avoid strings */
#define DECR(a,b,c,d,e) decr('a'+'+','b'+'-','c'+'#','d'+'&','e'+'%')
+
+gid_t egid;
struct text *kk;
extern trapdel();
- /* adventure doesn't need setuid-ness, so, just get rid of it */
- if (setuid(getuid()) < 0)
- perror("setuid");
+ egid = getegid();
+ setegid(getgid());
init(); /* Initialize everything */
signal(SIGINT,trapdel);
if (loc==33 && pct(25)&&!closng) rspeak(8);
if (!dark(0))
{ abb[loc]++;
- for (i=atloc[loc]; i!=0; i=link[i]) /*2004 */
+ for (i=atloc[loc]; i!=0; i=linkx[i]) /*2004 */
{ obj=i;
if (obj>100) obj -= 100;
if (obj==steps && toting(nugget)) continue;
l4080:
switch(verb)
{ case 1: /* take = 8010 */
- if (atloc[loc]==0||link[atloc[loc]]!=0) goto l8000;
+ if (atloc[loc]==0||linkx[atloc[loc]]!=0) goto l8000;
for (i=1; i<=5; i++)
if (dloc[i]==loc&&dflag>=2) goto l8000;
obj=atloc[loc];
dseen, sizeof(dseen),
fixed, sizeof(fixed),
hinted, sizeof(hinted),
- link, sizeof(link),
+ linkx, sizeof(linkx),
odloc, sizeof(odloc),
place, sizeof(place),
prop, sizeof(prop),
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++)
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);
holdng++;
}
if (atloc[where]==object)
- { atloc[where]=link[object];
+ { atloc[where]=linkx[object];
return;
}
- for (temp=atloc[where]; link[temp]!=object; temp=link[temp]);
- link[temp]=link[object];
+ for (temp=atloc[where]; linkx[temp]!=object; temp=linkx[temp]);
+ linkx[temp]=linkx[object];
}
place[object]=where;
}
if (where<=0) return;
- link[object]=atloc[where];
+ linkx[object]=atloc[where];
atloc[where]=object;
}
datime(d,t)
int *d,*t;
{ int tvec[2],*tptr;
- int *localtime();
time(tvec);
tptr=localtime(tvec);
extern char *default_game(), *okay_game();
extern void log_score(), quit(), update();
+ setgid(getgid());
+
start_time = seed = time(0);
name = *av++;
register char c; /* non-descript character storage */
long t; /* time for random num generator */
+ setgid(getgid());
+
/* initialization */
bflag = 2; /* default no board */
signal (2, getout); /* trap interrupts */
{
register int i;
+ setgid(getgid());
+
signal (2,getout);
if (tcgetattr (0, &old) == -1) /* get old tty mode */
errexit ("teachgammon(gtty)");
{
int ch;
+ setgid(getgid());
+
while ((ch = getopt(argc, argv, "w:td")) != EOF)
switch(ch) {
case 'w':
char mainbuf[LINELENGTH];
char *next;
+ egid = getegid();
+ setegid(getgid());
+
initialize(argc < 2 || strcmp(argv[1], "-r"));
start:
news();
};
struct objs dayobjs[];
struct objs nightobjs[];
+
+gid_t egid;
{
char *getenv();
char *home;
- char home1[100];
+ char home1[1024];
register int n;
int tmp;
register FILE *fp;
strcpy(home1, home);
strcat(home1, "/Bstar");
} else {
- fprintf(stderr, "%s/Bstar: %s\n", home, strerror(ENAMETOOLONG));
+ fprintf(stderr, "%s: %s\n", home1, strerror(ENAMETOOLONG));
return;
}
+ setegid(egid);
if ((fp = fopen(home1, "r")) == 0) {
perror(home1);
+ setegid(getgid());
return;
}
+ setegid(getgid());
fread(&WEIGHT, sizeof WEIGHT, 1, fp);
fread(&CUMBER, sizeof CUMBER, 1, fp);
fread(&clock, sizeof clock, 1, fp);
fprintf(stderr, "%s/Bstar: %s\n", home, strerror(ENAMETOOLONG));
return;
}
+ setegid(egid);
if ((fp = fopen(home1, "w")) == 0) {
perror(home1);
+ setegid(getgid());
return;
}
+ setegid(getgid());
printf("Saved in %s.\n", home1);
fwrite(&WEIGHT, sizeof WEIGHT, 1, fp);
fwrite(&CUMBER, sizeof CUMBER, 1, fp);
* but this seems kind of silly. So this one doesn't.
*/
+ setgid(getgid());
+
if (argc > 1) {
while (--argc)
printcard(*++argv);
int ch, done, i, selfuse, sflag;
char *bspec, *p;
+ setgid(getgid());
+
batch = debug = reuse = selfuse = sflag = 0;
bspec = NULL;
minlength = 3;
-/* $OpenBSD: bs.c,v 1.1 1996/08/21 08:18:36 downsj Exp $ */
+/* $OpenBSD: bs.c,v 1.2 1996/12/19 22:21:13 deraadt Exp $ */
/*
* bs.c - original author: Bruce Holloway
* salvo option by: Chuck A DeGaul
int argc;
char *argv[];
{
+ setgid(getgid());
+
do_options(argc, argv);
intro();
int obs[26], try, winner;
char *malloc(), *strerror();
+ setgid(getgid());
+
if (argc > 1)
printit(argv[1]);
srandom(getpid());
time(&acctstart);
initdeck(deck);
- uid = getuid();
if (uid < 0)
uid = 0;
dbfd = open(_PATH_SCORE, 2);
+ setegid(getgid());
if (dbfd < 0)
return;
i = lseek(dbfd, uid * sizeof(struct betinfo), 0);
raw();
noecho();
initall();
+ setgid(getgid()); /* revoke */
instruct();
makeboard();
for (;;) {
perror(_PATH_SCORE);
exit(2);
}
+ setgid(getgid()); /* revoke */
setpwent();
if (argc == 1) {
uid = getuid();
BOOLEAN playing;
FILE *f;
int ch;
+ gid_t egid;
+
+ egid = getegid();
+ setegid(getgid());
while ((ch = getopt(argc, argv, "eqr")) != EOF)
switch (ch) {
Tablewin = subwin(stdscr, TABLE_Y, TABLE_X, 0, PLAY_X);
Compwin = subwin(stdscr, COMP_Y, COMP_X, 0, TABLE_X + PLAY_X);
Msgwin = subwin(stdscr, MSG_Y, MSG_X, Y_MSG_START, SCORE_X + 1);
+
leaveok(Playwin, TRUE);
leaveok(Tablewin, TRUE);
leaveok(Compwin, TRUE);
playing = (getuchar() == 'Y');
} while (playing);
+ setegid(egid);
if (f = fopen(_PATH_LOG, "a")) {
(void)fprintf(f, "%s: won %5.5d, lost %5.5d\n",
getlogin(), cgames, pgames);
(void) fclose(f);
}
+ setegid(getgid());
bye();
if (!f) {
(void) fprintf(stderr, "\ncribbage: can't open %s.\n",
int ch;
char *p, buf[100]; /* > max number of digits. */
+ setgid(getgid());
+
while ((ch = getopt(argc, argv, "")) != EOF)
switch (ch) {
case '?':
-/* $OpenBSD: main.c,v 1.1.1.1 1996/12/16 06:56:08 downsj Exp $ */
+/* $OpenBSD: main.c,v 1.2 1996/12/19 22:21:28 deraadt Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
"%3d %-6s"
};
+ setgid(getgid());
+
prog = strrchr(argv[0], '/');
if (prog)
prog++;
-/* $OpenBSD: grdc.c,v 1.1 1996/08/21 07:58:08 downsj Exp $ */
+/* $OpenBSD: grdc.c,v 1.2 1996/12/19 22:21:30 deraadt Exp $ */
/*
* Grand digital clock for curses compatible terminals
* Usage: grdc [-s] [n] -- run for n seconds (default infinity)
initscr();
+ setgid(getgid());
+
signal(SIGINT,sighndl);
signal(SIGTERM,sighndl);
signal(SIGHUP,sighndl);
{
void die();
+ setgid(getgid());
+
initscr();
signal(SIGINT, die);
setup();
register bool restore;
- /* run as the user */
- setuid(getuid());
+ setgid(getgid()); /* run as the user */
if (strcmp(av[0], "a.out") == 0) {
outf = fopen("q", "w");
char *av[]; {
int n;
+ setgid(getgid());
+
getargs(ac, av);
if ((inf = fopen(infile, "r")) == NULL) {
perror(infile);
register int ch;
register char *p;
+ setgid(getgid());
+
while ((ch = getopt(argc, argv, "s")) != EOF)
switch((char)ch) {
case 's':
int ch, first;
char line[256];
+ setgid(getgid());
+
lflag = 0;
while ((ch = getopt(argc, argv, "l")) != EOF)
switch (ch) {
int ch;
char buf[1024];
+ setgid(getgid());
+
while ((ch = getopt(argc, argv, "")) != EOF)
switch(ch) {
case '?':
double days, today, tomorrow;
int cnt;
+ setgid(getgid());
+
if (gettimeofday(&tp,&tzp)) {
(void)fprintf(stderr, "pom: %s\n", strerror(errno));
exit(1);
register int c;
register char *p;
+ setgid(getgid());
+
(void) puts("___________");
if (argc > 1)
while (p = *++argv)
int ch;
char *p;
+ setgid(getgid());
+
while ((ch = getopt(argc, argv, "")) != EOF)
switch (ch) {
case '?':
register int ch;
char *indexfile;
+ setgid(getgid());
+
indexfile = _PATH_QUIZIDX;
while ((ch = getopt(argc, argv, "i:t")) != EOF)
switch(ch) {
struct winsize ws;
#endif
+ setgid(getgid());
+
if (!(term = getenv("TERM"))) {
fprintf(stderr, "%s: TERM: parameter not set\n", *argv);
exit(1);
int ch, random_exit, selected, unbuffer_output;
char *ep;
+ setgid(getgid());
+
random_exit = unbuffer_output = 0;
while ((ch = getopt(argc, argv, "er")) != EOF)
switch (ch) {
time_t tv;
char *tn;
+int rawscores;
+FILE *logfile;
+
main(argc,argv)
int argc;
char **argv;
int ch, i, j, k;
void stop();
+ rawscores = open(_PATH_RAWSCORES, O_RDWR|O_CREAT, 0644);
+ logfile = fopen(_PATH_LOGFILE, "a");
+ setgid(getgid());
+
(void)time(&tv);
srandom((int)tv);
int iscore, flag;
{
short score = iscore;
- int rawscores;
short uid;
short oldbest=0;
short allbwho=0, allbscore=0;
pr("No saved scores for uid %d.\n", uid);
return(1);
}
- if ((rawscores = open(_PATH_RAWSCORES, O_RDWR|O_CREAT, 0644)) < 0) {
+ if (rawscores == -1) {
pr("No score file %s: %s.\n", _PATH_RAWSCORES,
strerror(errno));
return(1);
logit(msg)
char *msg;
{
- FILE *logfile;
time_t t;
- if ((logfile=fopen(_PATH_LOGFILE, "a")) != NULL) {
+ if (logfile != NULL) {
time(&t);
fprintf(logfile, "%s $%d %dx%d %s %s",
getlogin(), cashvalue, lcnt, ccnt, msg, ctime(&t));
struct passwd *p;
fd = fopen(recfile, "r");
+ setgid(getgid());
if (fd == NULL) {
perror(recfile);
exit(1);
register char **av;
struct termios argp;
+ setgid(getgid());
+
av = argv;
ac = argc;
av++;
{
char ch;
+ setgid(getgid());
+
if (argc == 2)
start_len = atoi(argv[1]);
if ((start_len <= 0) || (start_len > 500))
struct winsize ws;
#endif
+ setgid(getgid());
+
length = 16;
number = 3;
trail = ' ';
extern char *optarg;
int c;
+ setgid(getgid());
+
#ifdef DEBUG
while ((c = getopt(argc, argv, "a:b:hp:r:t:d")) != EOF)
#else