diff --git a/.cvsignore b/.cvsignore index e69de29..67a4ae6 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +bsd-games-2.17.tar.gz diff --git a/bsd-games-2.17-debian.patch b/bsd-games-2.17-debian.patch new file mode 100644 index 0000000..dbc293f --- /dev/null +++ b/bsd-games-2.17-debian.patch @@ -0,0 +1,154 @@ +--- bsdgames-2.17.orig/fish/Makefrag ++++ bsdgames-2.17/fish/Makefrag +@@ -31,7 +31,9 @@ + fish_all: fish/fish fish/fish.instr fish/fish.6 + + fish_install: fish_all +- $(INSTALL_BINARY) fish/fish $(INSTALL_PREFIX)$(GAMESDIR)/fish +- $(HIDE_GAME) fish ++ $(INSTALL_BINARY) fish/fish $(INSTALL_PREFIX)$(GAMESDIR)/go-fish ++ $(HIDE_GAME) go-fish + $(INSTALL_DATA) fish/fish.instr $(INSTALL_PREFIX)$(FISH_INSTRFILE) +- $(INSTALL_MANUAL) fish/fish.6 ++ ln -sf fish.6 fish/go-fish.6 # hack for rename ++ $(INSTALL_MANUAL) fish/go-fish.6 ++ rm -f fish/go-fish.6 +--- bsdgames-2.17.orig/fish/fish.6 ++++ bsdgames-2.17/fish/fish.6 +@@ -30,10 +30,10 @@ + .\" @(#)fish.6 8.1 (Berkeley) 5/31/93 + .\" + .Dd May 31, 1993 +-.Dt FISH 6 ++.Dt GO-FISH 6 + .Os + .Sh NAME +-.Nm fish ++.Nm go-fish + .Nd play + .Dq Go Fish + .Sh SYNOPSIS +--- bsdgames-2.17.orig/gomoku/gomoku.6 ++++ bsdgames-2.17/gomoku/gomoku.6 +@@ -45,7 +45,7 @@ + .Op Ar inputfile + .Sh DESCRIPTION + .Nm +-is a two player game were the object is to get 5 in a row horizontally, ++is a two player game where the object is to get 5 in a row horizontally, + vertically or diagonally on a 19 by 19 grid. + By convention, black always moves first. + With no arguments, +--- bsdgames-2.17.orig/hack/Makefrag ++++ bsdgames-2.17/hack/Makefrag +@@ -56,7 +56,8 @@ + $(INSTALL_SCORE_GAME) hack/hack $(INSTALL_PREFIX)$(GAMESDIR)/hack + $(HIDE_GAME) hack + $(INSTALL_HACK_DIR) $(INSTALL_PREFIX)$(HACK_DIR) +- set -e; for f in data help hh rumors; do $(INSTALL_DATA) hack/$$f $(INSTALL_PREFIX)$(HACK_DIR)/$$f; done ++ install -d $(INSTALL_PREFIX)/usr/share/bsd-games/hack ++ set -e; for f in data help hh rumors; do $(INSTALL_DATA) hack/$$f $(INSTALL_PREFIX)/usr/share/bsd-games/hack/$$f; done + $(INSTALL_SCORE_FILE) $(HACK_DIR)/perm + $(INSTALL_SCORE_FILE) $(HACK_DIR)/record + $(INSTALL_MANUAL) hack/hack.6 +--- bsdgames-2.17.orig/hack/config.h ++++ bsdgames-2.17/hack/config.h +@@ -88,13 +88,18 @@ + /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */ + /* #define NOWAITINCLUDE */ /* neither nor exists */ + +-#define WIZARD "bruno" /* the person allowed to use the -D option */ ++/* ++ * Debian mods: use root for WIZARD, and move files that are static to ++ * /usr/share/ -- JEH ++ */ ++#define WIZARD "root" /* the person allowed to use the -D option */ ++#define SHAREDIR "/usr/share/bsd-games/hack/" + #define RECORD "record"/* the file containing the list of topscorers */ + #define NEWS "news" /* the file containing the latest hack news */ +-#define HELP "help" /* the file containing a description of the commands */ +-#define SHELP "hh" /* abbreviated form of the same */ +-#define RUMORFILE "rumors" /* a file with fortune cookies */ +-#define DATAFILE "data" /* a file giving the meaning of symbols used */ ++#define HELP SHAREDIR "help" /* the file containing a description of the commands */ ++#define SHELP SHAREDIR "hh" /* abbreviated form of the same */ ++#define RUMORFILE SHAREDIR "rumors" /* a file with fortune cookies */ ++#define DATAFILE SHAREDIR "data" /* a file giving the meaning of symbols used */ + #define FMASK 0660 /* file creation mask */ + #define HLOCK "perm" /* an empty file used for locking purposes */ + #define LLOCK "safelock" /* link to previous */ +--- bsdgames-2.17.orig/hunt/hunt/hunt.c ++++ bsdgames-2.17/hunt/hunt/hunt.c +@@ -394,7 +394,8 @@ + + vec_cnt = 0; + for (ip = ifp; ip; ip = ip->ifa_next) +- if ((ip->ifa_addr->sa_family == AF_INET) && ++ if (ip->ifa_addr && ++ (ip->ifa_addr->sa_family == AF_INET) && + (ip->ifa_flags & IFF_BROADCAST)) + vec_cnt++; + +@@ -405,7 +406,8 @@ + + vec_cnt = 0; + for (ip = ifp; ip; ip = ip->ifa_next) +- if ((ip->ifa_addr->sa_family == AF_INET) && ++ if (ip->ifa_addr && ++ (ip->ifa_addr->sa_family == AF_INET) && + (ip->ifa_flags & IFF_BROADCAST)) + memcpy(&(*vector)[vec_cnt++], ip->ifa_broadaddr, + sizeof(struct sockaddr_in)); +--- bsdgames-2.17.orig/sail/pl_main.c ++++ bsdgames-2.17/sail/pl_main.c +@@ -219,7 +219,7 @@ + printf("\nInitial broadside %s (grape, chain, round, double): ", + n ? "right" : "left"); + fflush(stdout); +- scanf("%s", buf); ++ scanf("%9s", buf); + switch (*buf) { + case 'g': + load = L_GRAPE; +--- bsdgames-2.17.orig/tetris/scores.c ++++ bsdgames-2.17/tetris/scores.c +@@ -335,7 +335,8 @@ + continue; + } + } +- levelfound[sp->hs_level] = 1; ++ if (sp->hs_level < NLEVELS && sp->hs_level >= 0) ++ levelfound[sp->hs_level] = 1; + i++, sp++; + } + return (num > MAXHISCORES ? MAXHISCORES : num); +@@ -374,12 +375,14 @@ + for (i = MINLEVEL; i < NLEVELS; i++) + levelfound[i] = 0; + for (i = 0, sp = scores; i < nscores; i++, sp++) { +- if (levelfound[sp->hs_level]) +- sp->hs_time = 0; +- else { +- sp->hs_time = 1; +- levelfound[sp->hs_level] = 1; +- } ++ if (sp->hs_level < NLEVELS && sp->hs_level >= 0) { ++ if (levelfound[sp->hs_level]) ++ sp->hs_time = 0; ++ else { ++ sp->hs_time = 1; ++ levelfound[sp->hs_level] = 1; ++ } ++ } + } + + /* +@@ -433,7 +436,7 @@ + continue; + } + sp = &hs[item]; +- (void)sprintf(buf, ++ (void)snprintf(buf, sizeof(buf), + "%3d%c %6d %-11s (%6d on %d)", + item + offset, sp->hs_time ? '*' : ' ', + sp->hs_score * sp->hs_level, diff --git a/bsd-games-2.17-getline.patch b/bsd-games-2.17-getline.patch new file mode 100644 index 0000000..da91b24 --- /dev/null +++ b/bsd-games-2.17-getline.patch @@ -0,0 +1,194 @@ +diff -Naur bsd-games-2.17/boggle/boggle/bog.c bsd-games-2.17.new/boggle/boggle/bog.c +--- bsd-games-2.17/boggle/boggle/bog.c 2004-12-07 05:34:21.000000000 -0800 ++++ bsd-games-2.17.new/boggle/boggle/bog.c 2006-04-04 14:15:20.000000000 -0700 +@@ -336,7 +336,7 @@ + } + + while (1) { +- if (getline(buf) == NULL) { ++ if (xgetline(buf) == NULL) { + if (feof(stdin)) + clearerr(stdin); + break; +diff -Naur bsd-games-2.17/boggle/boggle/extern.h bsd-games-2.17.new/boggle/boggle/extern.h +--- bsd-games-2.17/boggle/boggle/extern.h 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/boggle/boggle/extern.h 2006-04-04 14:15:05.000000000 -0700 +@@ -43,7 +43,7 @@ + long dictseek(FILE *, long, int); + void findword(void); + void flushin(FILE *); +-char *getline(char *); ++char *xgetline(char *); + void getword(char *); + int help(void); + int inputch(void); +diff -Naur bsd-games-2.17/boggle/boggle/mach.c bsd-games-2.17.new/boggle/boggle/mach.c +--- bsd-games-2.17/boggle/boggle/mach.c 2004-12-07 05:34:21.000000000 -0800 ++++ bsd-games-2.17.new/boggle/boggle/mach.c 2006-04-04 14:14:43.000000000 -0700 +@@ -168,7 +168,7 @@ + * - doesn't accept words longer than MAXWORDLEN or containing caps + */ + char * +-getline(q) ++xgetline(q) + char *q; + { + int ch, done; +diff -Naur bsd-games-2.17/cribbage/cribbage.h bsd-games-2.17.new/cribbage/cribbage.h +--- bsd-games-2.17/cribbage/cribbage.h 2004-02-08 14:29:14.000000000 -0800 ++++ bsd-games-2.17.new/cribbage/cribbage.h 2006-04-04 14:11:46.000000000 -0700 +@@ -77,7 +77,7 @@ + int fifteens(const CARD [], int); + void game(void); + void gamescore(void); +-char *getline(void); ++char *xgetline(void); + int getuchar(void); + int incard(CARD *); + int infrom(const CARD [], int, const char *); +diff -Naur bsd-games-2.17/cribbage/crib.c bsd-games-2.17.new/cribbage/crib.c +--- bsd-games-2.17/cribbage/crib.c 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/cribbage/crib.c 2006-04-04 14:11:05.000000000 -0700 +@@ -221,7 +221,7 @@ + if (!rflag) { /* player cuts deck */ + msg(quiet ? "Cut for crib? " : + "Cut to see whose crib it is -- low card wins? "); +- getline(); ++ xgetline(); + } + i = (rand() >> 4) % CARDS; /* random cut */ + do { /* comp cuts deck */ +@@ -397,7 +397,7 @@ + if (!rflag) { /* random cut */ + msg(quiet ? "Cut the deck? " : + "How many cards down do you wish to cut the deck? "); +- getline(); ++ xgetline(); + } + i = (rand() >> 4) % (CARDS - pos); + turnover = deck[i + pos]; +diff -Naur bsd-games-2.17/cribbage/io.c bsd-games-2.17.new/cribbage/io.c +--- bsd-games-2.17/cribbage/io.c 2004-12-07 05:34:21.000000000 -0800 ++++ bsd-games-2.17.new/cribbage/io.c 2006-04-04 14:11:05.000000000 -0700 +@@ -245,7 +245,7 @@ + + retval = FALSE; + rnk = sut = EMPTY; +- if (!(line = getline())) ++ if (!(line = xgetline())) + goto gotit; + p = p1 = line; + while (*p1 != ' ' && *p1 != '\0') +@@ -346,7 +346,7 @@ + + for (sum = 0;;) { + msg(prompt); +- if (!(p = getline()) || *p == '\0') { ++ if (!(p = xgetline()) || *p == '\0') { + msg(quiet ? "Not a number" : + "That doesn't look like a number"); + continue; +@@ -528,12 +528,12 @@ + } + + /* +- * getline: ++ * xgetline: + * Reads the next line up to '\n' or EOF. Multiple spaces are + * compressed to one space; a space is inserted before a ',' + */ + char * +-getline() ++xgetline() + { + char *sp; + int c, oy, ox; +diff -Naur bsd-games-2.17/gomoku/bdisp.c bsd-games-2.17.new/gomoku/bdisp.c +--- bsd-games-2.17/gomoku/bdisp.c 2003-12-16 18:47:37.000000000 -0800 ++++ bsd-games-2.17.new/gomoku/bdisp.c 2006-04-04 14:11:05.000000000 -0700 +@@ -241,7 +241,7 @@ + } + + int +-getline(buf, size) ++xgetline(buf, size) + char *buf; + int size; + { +diff -Naur bsd-games-2.17/gomoku/gomoku.h bsd-games-2.17.new/gomoku/gomoku.h +--- bsd-games-2.17/gomoku/gomoku.h 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/gomoku/gomoku.h 2006-04-04 14:12:15.000000000 -0700 +@@ -263,7 +263,7 @@ + + void bdinit(struct spotstr *); + void init_overlap(void); +-int getline(char *, int); ++int xgetline(char *, int); + void ask(const char *); + void dislog(const char *); + void bdump(FILE *); +diff -Naur bsd-games-2.17/gomoku/main.c bsd-games-2.17.new/gomoku/main.c +--- bsd-games-2.17/gomoku/main.c 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/gomoku/main.c 2006-04-04 14:11:05.000000000 -0700 +@@ -155,7 +155,7 @@ + if (inputfp == NULL && test == 0) { + for (;;) { + ask("black or white? "); +- getline(buf, sizeof(buf)); ++ xgetline(buf, sizeof(buf)); + if (buf[0] == 'b' || buf[0] == 'B') { + color = BLACK; + break; +@@ -172,7 +172,7 @@ + } + } else { + setbuf(stdout, 0); +- getline(buf, sizeof(buf)); ++ xgetline(buf, sizeof(buf)); + if (strcmp(buf, "black") == 0) + color = BLACK; + else if (strcmp(buf, "white") == 0) +@@ -244,7 +244,7 @@ + getinput: + if (interactive) + ask("move? "); +- if (!getline(buf, sizeof(buf))) { ++ if (!xgetline(buf, sizeof(buf))) { + curmove = RESIGN; + break; + } +@@ -256,7 +256,7 @@ + FILE *fp; + + ask("save file name? "); +- (void)getline(buf, sizeof(buf)); ++ (void)xgetline(buf, sizeof(buf)); + if ((fp = fopen(buf, "w")) == NULL) { + glog("cannot create save file"); + goto getinput; +@@ -309,14 +309,14 @@ + if (i != RESIGN) { + replay: + ask("replay? "); +- if (getline(buf, sizeof(buf)) && ++ if (xgetline(buf, sizeof(buf)) && + (buf[0] == 'y' || buf[0] == 'Y')) + goto again; + if (strcmp(buf, "save") == 0) { + FILE *fp; + + ask("save file name? "); +- (void)getline(buf, sizeof(buf)); ++ (void)xgetline(buf, sizeof(buf)); + if ((fp = fopen(buf, "w")) == NULL) { + glog("cannot create save file"); + goto replay; +@@ -367,7 +367,7 @@ + quit(); + top: + ask("cmd? "); +- if (!getline(fmtbuf, sizeof(fmtbuf))) ++ if (!xgetline(fmtbuf, sizeof(fmtbuf))) + quit(); + switch (*fmtbuf) { + case '\0': diff --git a/bsd-games-2.17-hackgid.patch b/bsd-games-2.17-hackgid.patch new file mode 100644 index 0000000..52307f0 --- /dev/null +++ b/bsd-games-2.17-hackgid.patch @@ -0,0 +1,440 @@ +diff -Naur --exclude '*.swp' bsd-games-2.17/hack/hack.bones.c bsd-games-2.17.new/hack/hack.bones.c +--- bsd-games-2.17/hack/hack.bones.c 2003-12-16 18:47:37.000000000 -0800 ++++ bsd-games-2.17.new/hack/hack.bones.c 2006-04-27 14:17:06.000000000 -0700 +@@ -140,10 +140,14 @@ + * ghost */ + } + } +- if ((fd = creat(bones, FMASK)) < 0) ++ setgid(hackgid); ++ if ((fd = creat(bones, FMASK)) < 0) { ++ setgid(getgid()); + return; ++ } + savelev(fd, dlevel); + (void) close(fd); ++ setgid(getgid()); + } + + int +@@ -168,9 +172,12 @@ + if (!wizard) /* duvel!frans: don't remove bones while + * debugging */ + #endif /* WiZARD */ ++ setgid(hackgid); + if (unlink(bones) < 0) { ++ setgid(getgid()); + pline("Cannot unlink %s .", bones); + return (0); + } ++ setgid(getgid()); + return (ok); + } +diff -Naur --exclude '*.swp' bsd-games-2.17/hack/hack.do.c bsd-games-2.17.new/hack/hack.do.c +--- bsd-games-2.17/hack/hack.do.c 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/hack/hack.do.c 2006-04-27 14:32:43.000000000 -0700 +@@ -206,7 +206,9 @@ + return; /* this can happen */ + + glo(dlevel); ++ setgid(hackgid); + fd = creat(lock, FMASK); ++ setgid(getgid()); + if (fd < 0) { + /* + * This is not quite impossible: e.g., we may have +@@ -231,8 +233,10 @@ + u.ux = FAR; /* hack */ + (void) inshop(); /* probably was a trapdoor */ + ++ setgid(hackgid); + savelev(fd, dlevel); + (void) close(fd); ++ setgid(getgid()); + + dlevel = newlevel; + if (maxdlevel < dlevel) +diff -Naur --exclude '*.swp' bsd-games-2.17/hack/hack.end.c bsd-games-2.17.new/hack/hack.end.c +--- bsd-games-2.17/hack/hack.end.c 2003-12-16 18:47:37.000000000 -0800 ++++ bsd-games-2.17.new/hack/hack.end.c 2006-04-27 15:48:03.000000000 -0700 +@@ -290,7 +290,11 @@ + #ifdef WIZARD + if (!wizard) + #endif /* WIZARD */ +- topten(); ++ { ++ setgid(hackgid); ++ topten(); ++ setgid(getgid()); ++ } + if (done_stopprint) + printf("\n\n"); + exit(0); +diff -Naur --exclude '*.swp' bsd-games-2.17/hack/hack.h bsd-games-2.17.new/hack/hack.h +--- bsd-games-2.17/hack/hack.h 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/hack/hack.h 2006-04-27 11:48:15.000000000 -0700 +@@ -218,6 +218,7 @@ + extern int bases[]; + extern int doorindex; + extern int hackpid; ++extern gid_t hackgid; + extern int multi; + extern int nroom; + extern long moves; +diff -Naur --exclude '*.swp' bsd-games-2.17/hack/hack.main.c bsd-games-2.17.new/hack/hack.main.c +--- bsd-games-2.17/hack/hack.main.c 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/hack/hack.main.c 2006-04-27 20:16:23.000000000 -0700 +@@ -61,6 +61,7 @@ + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __RCSID("$NetBSD: hack.main.c,v 1.9 2004/01/27 20:30:29 jsm Exp $"); +@@ -70,6 +71,9 @@ + #include + #include + #include ++#include ++#include ++#include + #include "hack.h" + #include "extern.h" + +@@ -83,12 +87,13 @@ + int (*occupation)(void); + const char *occtxt; /* defined when occupation != NULL */ + ++gid_t hackgid; /* privileged gid for writing scoreboard */ + int hackpid; /* current pid */ + int locknum; /* max num of players */ + #ifdef DEF_PAGER + const char *catmore; /* default pager */ + #endif +-char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */ ++char SAVEF[PATH_MAX + PL_NSIZ + 11] = ".hack.save"; + char *hname; /* name of the game (argv[0] of call) */ + char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ + +@@ -101,9 +106,10 @@ + char *argv[]; + { + int fd; +-#ifdef CHDIR +- char *dir; +-#endif ++ char *savedir = (char *)NULL; ++ ++ hackgid = getegid(); ++ setgid(getgid()); + + /* Check for dirty tricks with closed fds 0, 1, 2 */ + fd = open("/dev/null", O_RDONLY); +@@ -114,31 +120,47 @@ + hname = argv[0]; + hackpid = getpid(); + +-#ifdef CHDIR /* otherwise no chdir() */ + /* +- * See if we must change directory to the playground. +- * (Perhaps hack runs suid and playground is inaccessible +- * for the player.) ++ * Find the directory containing the save files. + * The environment variable HACKDIR is overridden by a + * -d command line option (must be the first option given) + */ + +- dir = getenv("HACKDIR"); ++ savedir = getenv("HACKDIR"); + if (argc > 1 && !strncmp(argv[1], "-d", 2)) { + argc--; + argv++; +- dir = argv[0] + 2; +- if (*dir == '=' || *dir == ':') +- dir++; +- if (!*dir && argc > 1) { ++ savedir = argv[0] + 2; ++ if (*savedir == '=' || *savedir == ':') ++ savedir++; ++ if (!*savedir && argc > 1) { + argc--; + argv++; +- dir = argv[0]; ++ savedir = argv[0]; + } +- if (!*dir) ++ if (!*savedir) + error("Flag -d must be followed by a directory name."); + } +-#endif ++ ++ /* ++ * If the user didn't tell us where the save games are stored then ++ * look in the home directory. ++ */ ++ if (savedir == (char *)NULL) { ++ if ((savedir = getenv("HOME")) == (char *)NULL) { ++ struct passwd *pwe; ++ pwe = getpwuid(getuid()); ++ if (pwe == NULL || (savedir = pwe->pw_dir) == (char *)NULL) { ++ savedir = "."; ++ } ++ } ++ } ++ /* ++ * One final check in case we missed something earlier. ++ */ ++ if (savedir == NULL || strlen(savedir) > PATH_MAX-30) { ++ savedir = "."; ++ } + + /* + * Who am i? Algorithm: 1. Use name as specified in HACKOPTIONS +@@ -155,12 +177,21 @@ + char *s; + + initoptions(); +- if (!*plname && (s = getenv("USER"))) ++ if (!*plname && (s = getenv("USER"))) { + (void) strncpy(plname, s, sizeof(plname) - 1); +- if (!*plname && (s = getenv("LOGNAME"))) ++ } ++ if (!*plname && (s = getenv("LOGNAME"))) { + (void) strncpy(plname, s, sizeof(plname) - 1); +- if (!*plname && (s = getlogin())) ++ } ++ if (!*plname && (s = getlogin())) { + (void) strncpy(plname, s, sizeof(plname) - 1); ++ } ++ /* ++ * Ensure that plname is null-terminated. strncpy ++ * doesn't guarantee it if the source is longer than ++ * the destination. ++ */ ++ plname[sizeof(plname) - 1] = (char)NULL; + } + + /* +@@ -169,11 +200,12 @@ + */ + if (argc > 1 && !strncmp(argv[1], "-s", 2)) { + #ifdef CHDIR +- chdirx(dir, 0); ++ chdirx(_PATH_HACK, 0); + #endif + prscore(argc, argv); + exit(0); + } ++ + /* + * It seems he really wants to play. + * Remember tty modes, to be restored on exit. +@@ -191,13 +223,13 @@ + * Find the creation date of this game, + * so as to avoid restoring outdated savefiles. + */ +- gethdate(hname); ++ gethdate(argv[0]); + + /* + * We cannot do chdir earlier, otherwise gethdate will fail. + */ + #ifdef CHDIR +- chdirx(dir, 1); ++ chdirx(_PATH_HACK, 1); + #endif + + /* +@@ -277,7 +309,9 @@ + (void) signal(SIGINT, SIG_IGN); + if (!locknum) + (void) strcpy(lock, plname); ++ setgid(hackgid); + getlock(); /* sets lock if locknum != 0 */ ++ setgid(getgid()); + #ifdef WIZARD + } else { + char *sfoo; +@@ -308,10 +342,21 @@ + } + #endif + setftty(); +- (void) sprintf(SAVEF, "save/%d%s", getuid(), plname); +- regularize(SAVEF + 5); /* avoid . or / in name */ +- if ((fd = open(SAVEF, O_RDONLY)) >= 0 && +- (uptodate(fd) || unlink(SAVEF) == 666)) { ++ ++ (void) snprintf(SAVEF, PATH_MAX, "%s/.hack.save-%d%s", savedir, getuid(), plname); ++ /* Disable this regularization. It's only needed when using ++ * setgid and a a shared directory for save games. In Fedora we've ++ * patched it to save games with normal user permissions (not setgid), ++ * so this isn't necessary anymore. ++ */ ++ /*regularize(SAVEF + 5);*/ /* avoid . or / in name */ ++ /* ++ * Removed check if the save game is up-to-date so we can avoid ++ * invalidating games during bugfix releases. It would be ++ * _much_ better to store some sort of savefile version number ++ * in the savefile itself. ++ */ ++ if ((fd = open(SAVEF, O_RDONLY)) >= 0) { + (void) signal(SIGINT, done1); + pline("Restoring old save file..."); + (void) fflush(stdout); +@@ -540,16 +585,6 @@ + boolean wr; + { + +-#ifdef SECURE +- if (dir /* User specified directory? */ +-#ifdef HACKDIR +- && strcmp(dir, HACKDIR) /* and not the default? */ +-#endif +- ) { +- (void) setuid(getuid()); /* Ron Wessels */ +- (void) setregid(getgid(), getgid()); +- } +-#endif + + #ifdef HACKDIR + if (dir == NULL) +@@ -568,12 +603,34 @@ + + if (dir == NULL) + dir = "."; +- if ((fd = open(RECORD, O_RDWR)) < 0) { +- printf("Warning: cannot write %s/%s", dir, RECORD); ++ ++ setgid(hackgid); ++ fd = open(RECORD, O_RDWR); ++ setgid(getgid()); ++ ++ if (fd < 0) { ++ printf("Warning: cannot write %s", RECORD); + getret(); + } else + (void) close(fd); + } ++ ++#ifdef SECURE ++ if (dir /* User specified directory? */ ++#ifdef HACKDIR ++ && strcmp(dir, HACKDIR) /* and not the default? */ ++#endif ++ ) { ++ if (setresuid(-1, getuid(), getuid()) == -1) { ++ perror("Could not drop setuid privileges. Aborting."); ++ exit(1); ++ } ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } ++ } ++#endif + } + #endif + +diff -Naur --exclude '*.swp' bsd-games-2.17/hack/hack.save.c bsd-games-2.17.new/hack/hack.save.c +--- bsd-games-2.17/hack/hack.save.c 2003-12-16 18:47:37.000000000 -0800 ++++ bsd-games-2.17.new/hack/hack.save.c 2006-04-27 20:12:41.000000000 -0700 +@@ -105,8 +105,9 @@ + (void) signal(SIGHUP, SIG_IGN); + (void) signal(SIGINT, SIG_IGN); + if ((fd = creat(SAVEF, FMASK)) < 0) { +- if (!hu) +- pline("Cannot open save file. (Continue or Quit)"); ++ if (!hu) { ++ pline("Cannot open save file %s. (Continue or Quit)", SAVEF); ++ } + (void) unlink(SAVEF); /* ab@unido */ + return (0); + } +@@ -198,10 +199,14 @@ + break; + getlev(fd, 0, tmp); + glo(tmp); +- if ((nfd = creat(lock, FMASK)) < 0) ++ setgid(hackgid); ++ if ((nfd = creat(lock, FMASK)) < 0) { ++ setgid(getgid()); + panic("Cannot open temp file %s!\n", lock); ++ } + savelev(nfd, tmp); + (void) close(nfd); ++ setgid(getgid()); + } + (void) lseek(fd, (off_t) 0, SEEK_SET); + getlev(fd, 0, 0); +diff -Naur --exclude '*.swp' bsd-games-2.17/hack/hack.unix.c bsd-games-2.17.new/hack/hack.unix.c +--- bsd-games-2.17/hack/hack.unix.c 2003-12-16 18:47:37.000000000 -0800 ++++ bsd-games-2.17.new/hack/hack.unix.c 2006-04-27 19:50:20.000000000 -0700 +@@ -161,6 +161,9 @@ + + struct stat buf, hbuf; + ++/* ++ * Get the timestamp of the named executable. ++ */ + void + gethdate(name) + char *name; +@@ -192,9 +195,15 @@ + for (;;) { + if ((np = strchr(path, ':')) == NULL) + np = path + strlen(path); /* point to end str */ +- if (np - path <= 1) /* %% */ ++ if (np - path <= 1) { /* %% */ + (void) strcpy(filename, name); +- else { ++ } else if (strlen(path) >= MAXPATHLEN-strlen(name)-2) { ++ /* ++ * Protect against long directories in PATH by skipping them. ++ */ ++ path = np + 1; ++ continue; ++ } else { + (void) strncpy(filename, path, np - path); + filename[np - path] = '/'; + (void) strcpy(filename + (np - path) + 1, name); +@@ -231,6 +240,9 @@ + { + int i; + time_t date; ++ gid_t initial_egid; ++ ++ initial_egid = getegid(); + + if (fstat(fd, &buf)) + return (0); /* cannot get status */ +@@ -255,13 +267,17 @@ + return (0); + } + (void) close(fd); ++ setgid(hackgid); + for (i = 1; i <= MAXLEVEL; i++) { /* try to remove all */ + glo(i); + (void) unlink(lock); + } + glo(0); +- if (unlink(lock)) ++ if (unlink(lock)) { ++ setgid(initial_egid); + return (0); /* cannot remove it */ ++ } ++ setgid(initial_egid); + return (1); /* success! */ + } + +@@ -321,8 +337,9 @@ + : "There is a game in progress under your name."); + gotlock: + fd = creat(lock, FMASK); +- if (unlink(LLOCK) == -1) ++ if (unlink(LLOCK) == -1) { + error("Cannot unlink %s.", LLOCK); ++ } + if (fd == -1) { + error("cannot creat lock file."); + } else { diff --git a/bsd-games-2.17-ospeed.patch b/bsd-games-2.17-ospeed.patch new file mode 100644 index 0000000..b42cc47 --- /dev/null +++ b/bsd-games-2.17-ospeed.patch @@ -0,0 +1,43 @@ +diff -Naur bsd-games-2.17/backgammon/backgammon/main.c bsd-games-2.17.new/backgammon/backgammon/main.c +--- bsd-games-2.17/backgammon/backgammon/main.c 2005-02-15 22:24:50.000000000 -0800 ++++ bsd-games-2.17.new/backgammon/backgammon/main.c 2006-04-03 21:52:19.000000000 -0700 +@@ -30,6 +30,7 @@ + */ + + #include ++#include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); +@@ -53,7 +54,7 @@ + extern const char *const instr[]; /* text of instructions */ + extern const char *const message[]; /* update message */ + #ifndef NCURSES_VERSION +-short ospeed; /* tty output speed */ ++/*short ospeed; */ /* tty output speed */ + #endif + + const char *const helpm[] = { /* help message */ +diff -Naur bsd-games-2.17/backgammon/teachgammon/teach.c bsd-games-2.17.new/backgammon/teachgammon/teach.c +--- bsd-games-2.17/backgammon/teachgammon/teach.c 2005-02-15 22:24:50.000000000 -0800 ++++ bsd-games-2.17.new/backgammon/teachgammon/teach.c 2006-04-03 21:52:19.000000000 -0700 +@@ -30,6 +30,7 @@ + */ + + #include ++#include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); +diff -Naur bsd-games-2.17/tetris/screen.c bsd-games-2.17.new/tetris/screen.c +--- bsd-games-2.17/tetris/screen.c 2004-01-27 12:52:07.000000000 -0800 ++++ bsd-games-2.17.new/tetris/screen.c 2006-04-03 21:52:19.000000000 -0700 +@@ -73,7 +73,7 @@ + extern char PC, *BC, *UP; /* tgoto requires globals: ugh! */ + static char BCdefault[] = "\b"; + #ifndef NCURSES_VERSION +-short ospeed; ++/*short ospeed;*/ + #endif + + static char diff --git a/bsd-games-2.17-phantasiagid.patch b/bsd-games-2.17-phantasiagid.patch new file mode 100644 index 0000000..8b52238 --- /dev/null +++ b/bsd-games-2.17-phantasiagid.patch @@ -0,0 +1,170 @@ +diff -Naur --exclude '*.swp' bsd-games-2.17/phantasia/gamesupport.c bsd-games-2.17.new/phantasia/gamesupport.c +--- bsd-games-2.17/phantasia/gamesupport.c 2006-04-27 22:51:04.000000000 -0700 ++++ bsd-games-2.17.new/phantasia/gamesupport.c 2006-04-27 21:01:11.000000000 -0700 +@@ -518,7 +518,10 @@ + long loc = 0L; /* location in scoreboard file */ + bool found = FALSE; /* set if we found an entry for this login */ + +- if ((fp = fopen(_PATH_SCORE, "r+")) != NULL) { ++ SET_PRIV_GID; ++ fp = fopen(_PATH_SCORE, "r+"); ++ DROP_PRIV_GID; ++ if (fp != NULL) { + while (fread((char *) &sbuf, SZ_SCORESTRUCT, 1, fp) == 1) + if (strcmp(Player.p_login, sbuf.sb_login) == 0) { + found = TRUE; +diff -Naur --exclude '*.swp' bsd-games-2.17/phantasia/interplayer.c bsd-games-2.17.new/phantasia/interplayer.c +--- bsd-games-2.17/phantasia/interplayer.c 2006-04-27 22:51:04.000000000 -0700 ++++ bsd-games-2.17.new/phantasia/interplayer.c 2006-04-27 21:01:45.000000000 -0700 +@@ -640,14 +640,18 @@ + mvaddstr(4, 0, "You have become king!\n"); + + /* let everyone else know */ ++ SET_PRIV_GID; + fp = fopen(_PATH_MESS, "w"); ++ DROP_PRIV_GID; + fprintf(fp, "All hail the new king!"); + fclose(fp); + + /* clear all energy voids; retain location of holy grail */ + fseek(Energyvoidfp, 0L, SEEK_SET); + fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp); ++ SET_PRIV_GID; + fp = fopen(_PATH_VOID, "w"); ++ DROP_PRIV_GID; + fwrite((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, fp); + fclose(fp); + } +@@ -716,7 +720,10 @@ + break; + + case '5': /* collect accumulated taxes */ +- if ((fp = fopen(_PATH_GOLD, "r+")) != NULL) ++ SET_PRIV_GID; ++ fp = fopen(_PATH_GOLD, "r+"); ++ DROP_PRIV_GID; ++ if (fp != NULL) + /* collect taxes */ + { + fread((char *) &temp1, sizeof(double), 1, fp); +diff -Naur --exclude '*.swp' bsd-games-2.17/phantasia/macros.h bsd-games-2.17.new/phantasia/macros.h +--- bsd-games-2.17/phantasia/macros.h 1997-07-17 09:42:20.000000000 -0700 ++++ bsd-games-2.17.new/phantasia/macros.h 2006-04-27 22:49:40.000000000 -0700 +@@ -4,6 +4,10 @@ + * macros.h - macro definitions for Phantasia + */ + ++/* setgid macros */ ++#define SET_PRIV_GID setgid(phant_gid) ++#define DROP_PRIV_GID setgid(getgid()) ++ + #define ROLL(BASE,INTERVAL) floor((BASE) + (INTERVAL) * drandom()) + #define SGN(X) ((X) < 0 ? -1 : 1) + #define CIRCLE(X, Y) floor(distance(X, 0.0, Y, 0.0) / 125.0 + 1) +diff -Naur --exclude '*.swp' bsd-games-2.17/phantasia/main.c bsd-games-2.17.new/phantasia/main.c +--- bsd-games-2.17/phantasia/main.c 2006-04-27 22:51:04.000000000 -0700 ++++ bsd-games-2.17.new/phantasia/main.c 2006-04-27 21:00:46.000000000 -0700 +@@ -61,6 +61,9 @@ + #undef bool + #include + ++ ++gid_t phant_gid; ++ + int main(int, char **); + + int +@@ -74,6 +77,9 @@ + time_t seconds; /* for time of day */ + double dtemp; /* for temporary calculations */ + ++ phant_gid = getegid(); ++ DROP_PRIV_GID; ++ + initialstate(); /* init globals */ + + /* process arguments */ +@@ -290,22 +296,28 @@ + Login = getpwuid(getuid())->pw_name; + + /* open some files */ ++ SET_PRIV_GID; + if ((Playersfp = fopen(_PATH_PEOPLE, "r+")) == NULL) + error(_PATH_PEOPLE); ++ DROP_PRIV_GID; + /* NOTREACHED */ + if (fileno(Playersfp) < 3) + exit(1); + ++ SET_PRIV_GID; + if ((Monstfp = fopen(_PATH_MONST, "r+")) == NULL) + error(_PATH_MONST); ++ DROP_PRIV_GID; + /* NOTREACHED */ + + if ((Messagefp = fopen(_PATH_MESS, "r")) == NULL) + error(_PATH_MESS); + /* NOTREACHED */ + ++ SET_PRIV_GID; + if ((Energyvoidfp = fopen(_PATH_VOID, "r+")) == NULL) + error(_PATH_VOID); ++ DROP_PRIV_GID; + if (fstat(fileno(Energyvoidfp), &sb) == -1) + error("stat"); + if (sb.st_size == 0) { +@@ -508,7 +520,9 @@ + getstring(Databuf, SZ_DATABUF); + /* we open the file for writing to erase any data which is + * already there */ ++ SET_PRIV_GID; + fp = fopen(_PATH_MESS, "w"); ++ DROP_PRIV_GID; + if (Databuf[0] != '\0') + fprintf(fp, "%s: %s", Player.p_name, Databuf); + fclose(fp); +diff -Naur --exclude '*.swp' bsd-games-2.17/phantasia/misc.c bsd-games-2.17.new/phantasia/misc.c +--- bsd-games-2.17/phantasia/misc.c 2006-04-27 22:51:04.000000000 -0700 ++++ bsd-games-2.17.new/phantasia/misc.c 2006-04-27 21:02:34.000000000 -0700 +@@ -651,14 +651,18 @@ + enterscore(); /* update score board */ + + /* put info in last dead file */ ++ SET_PRIV_GID; + fp = fopen(_PATH_LASTDEAD, "w"); ++ DROP_PRIV_GID; + fprintf(fp, "%s (%s, run by %s, level %.0f, killed by %s)", + Player.p_name, descrtype(&Player, TRUE), + Player.p_login, Player.p_level, how); + fclose(fp); + + /* let other players know */ ++ SET_PRIV_GID; + fp = fopen(_PATH_MESS, "w"); ++ DROP_PRIV_GID; + fprintf(fp, "%s was killed by %s.", Player.p_name, how); + fclose(fp); + +@@ -1060,7 +1064,10 @@ + } + Player.p_gold -= taxes; + +- if ((fp = fopen(_PATH_GOLD, "r+")) != NULL) ++ SET_PRIV_GID; ++ fp = fopen(_PATH_GOLD, "r+"); ++ DROP_PRIV_GID; ++ if (fp != NULL) + /* update taxes */ + { + dtemp = 0.0; +diff -Naur --exclude '*.swp' bsd-games-2.17/phantasia/phantglobs.h bsd-games-2.17.new/phantasia/phantglobs.h +--- bsd-games-2.17/phantasia/phantglobs.h 2006-04-27 22:51:04.000000000 -0700 ++++ bsd-games-2.17.new/phantasia/phantglobs.h 2006-04-27 20:25:34.000000000 -0700 +@@ -4,6 +4,7 @@ + * phantglobs.h - global declarations for Phantasia + */ + ++extern gid_t phant_gid; /* gid under which the game runs */ + extern double Circle; /* which circle player is in */ + extern double Shield; /* force field thrown up in monster battle */ + diff --git a/bsd-games-2.17-setresgid.patch b/bsd-games-2.17-setresgid.patch new file mode 100644 index 0000000..4a3a452 --- /dev/null +++ b/bsd-games-2.17-setresgid.patch @@ -0,0 +1,914 @@ +diff -Naur --exclude '*.swp' bsd-games-2.17/adventure/main.c bsd-games-2.17.new/adventure/main.c +--- bsd-games-2.17/adventure/main.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/adventure/main.c 2006-04-07 17:27:16.000000000 -0700 +@@ -34,6 +34,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ +@@ -71,7 +72,10 @@ + struct text *kk; + + /* revoke setgid privileges from dm */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + init(); /* Initialize everything */ + signal(SIGINT, trapdel); +diff -Naur --exclude '*.swp' bsd-games-2.17/arithmetic/arithmetic.c bsd-games-2.17.new/arithmetic/arithmetic.c +--- bsd-games-2.17/arithmetic/arithmetic.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/arithmetic/arithmetic.c 2006-04-04 17:33:55.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ +@@ -117,7 +118,10 @@ + int ch, cnt; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "r:o:")) != -1) + switch(ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/atc/main.c bsd-games-2.17.new/atc/main.c +--- bsd-games-2.17/atc/main.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/atc/main.c 2006-04-06 13:35:43.000000000 -0700 +@@ -41,6 +41,7 @@ + * For more info on this and all of my stuff, mail edjames@berkeley.edu. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\ +@@ -77,7 +78,10 @@ + + /* Open the score file then revoke setgid privileges */ + open_score_file(); +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + start_time = seed = time(NULL); + +diff -Naur --exclude '*.swp' bsd-games-2.17/backgammon/backgammon/main.c bsd-games-2.17.new/backgammon/backgammon/main.c +--- bsd-games-2.17/backgammon/backgammon/main.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/backgammon/backgammon/main.c 2006-04-06 13:39:23.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #include + #ifndef lint +@@ -101,7 +102,10 @@ + long t; /* time for random num generator */ + + /* revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + /* initialization */ + bflag = 2; /* default no board */ +diff -Naur --exclude '*.swp' bsd-games-2.17/backgammon/teachgammon/teach.c bsd-games-2.17.new/backgammon/teachgammon/teach.c +--- bsd-games-2.17/backgammon/teachgammon/teach.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/backgammon/teachgammon/teach.c 2006-04-06 13:39:44.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #include + #ifndef lint +@@ -68,7 +69,10 @@ + int i; + + /* revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + signal(SIGINT, getout); + if (tcgetattr(0, &old) == -1) /* get old tty mode */ +diff -Naur --exclude '*.swp' bsd-games-2.17/banner/banner.c bsd-games-2.17.new/banner/banner.c +--- bsd-games-2.17/banner/banner.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/banner/banner.c 2006-04-04 17:42:03.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993, 1994\n\ +@@ -1036,7 +1037,10 @@ + int ch; + + /* revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "w:td")) != -1) + switch (ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/battlestar/battlestar.c bsd-games-2.17.new/battlestar/battlestar.c +--- bsd-games-2.17/battlestar/battlestar.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/battlestar/battlestar.c 2006-04-06 13:33:22.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ +@@ -64,7 +65,10 @@ + + /* Open the score file then revoke setgid privileges */ + open_score_file(); +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + if (argc < 2) + initialize(NULL); +diff -Naur --exclude '*.swp' bsd-games-2.17/bcd/bcd.c bsd-games-2.17.new/bcd/bcd.c +--- bsd-games-2.17/bcd/bcd.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/bcd/bcd.c 2006-04-04 17:34:57.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ +@@ -135,7 +136,10 @@ + char cardline[80]; + + /* revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + /* + * The original bcd prompts with a "%" when reading from stdin, +diff -Naur --exclude '*.swp' bsd-games-2.17/boggle/boggle/bog.c bsd-games-2.17.new/boggle/boggle/bog.c +--- bsd-games-2.17/boggle/boggle/bog.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/boggle/boggle/bog.c 2006-04-04 17:41:17.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1993\n\ +@@ -131,7 +132,10 @@ + char *bspec, *p; + + /* revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + seed = 0; + batch = debug = reuse = selfuse = sflag = 0; +diff -Naur --exclude '*.swp' bsd-games-2.17/caesar/caesar.c bsd-games-2.17.new/caesar/caesar.c +--- bsd-games-2.17/caesar/caesar.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/caesar/caesar.c 2006-04-04 17:31:41.000000000 -0700 +@@ -37,6 +37,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ +@@ -90,7 +91,10 @@ + int obs[26], try, winner; + + /* revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + winnerdot = 0; + if (argc > 1) +diff -Naur --exclude '*.swp' bsd-games-2.17/canfield/canfield/canfield.c bsd-games-2.17.new/canfield/canfield/canfield.c +--- bsd-games-2.17/canfield/canfield/canfield.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/canfield/canfield/canfield.c 2006-04-06 13:31:18.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -1666,6 +1667,20 @@ + } + + /* ++ * Open the high score file and then drop setgid. ++ */ ++void ++open_score() { ++ dbfd = open(_PATH_SCORE, O_RDWR); ++ ++ /* Revoke setgid privileges */ ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } ++} ++ ++/* + * procedure to initialize the game + */ + void +@@ -1679,10 +1694,6 @@ + uid = getuid(); + if (uid < 0) + uid = 0; +- dbfd = open(_PATH_SCORE, O_RDWR); +- +- /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); + + if (dbfd < 0) + return; +@@ -1797,6 +1808,8 @@ + exit(0); + } + #endif ++ open_score(); ++ + signal(SIGINT, askquit); + signal(SIGHUP, cleanup); + signal(SIGTERM, cleanup); +diff -Naur --exclude '*.swp' bsd-games-2.17/canfield/cfscores/cfscores.c bsd-games-2.17.new/canfield/cfscores/cfscores.c +--- bsd-games-2.17/canfield/cfscores/cfscores.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/canfield/cfscores/cfscores.c 2006-04-06 13:14:59.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ +@@ -78,7 +79,10 @@ + int uid; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + if (argc > 2) { + printf("Usage: cfscores [user]\n"); +diff -Naur --exclude '*.swp' bsd-games-2.17/cribbage/crib.c bsd-games-2.17.new/cribbage/crib.c +--- bsd-games-2.17/cribbage/crib.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/cribbage/crib.c 2006-04-04 18:30:44.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -76,7 +77,10 @@ + exit(1); + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + /* Set close-on-exec flag on log file */ + if (f != NULL) { +diff -Naur --exclude '*.swp' bsd-games-2.17/cribbage/instr.c bsd-games-2.17.new/cribbage/instr.c +--- bsd-games-2.17/cribbage/instr.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/cribbage/instr.c 2006-04-04 17:30:46.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + #if 0 +@@ -71,6 +72,11 @@ + * for mailx and man. We only use a pager if stdout is + * a terminal, and we pass the file on stdin to sh -c pager. + */ ++ if (setresgid(-1, getgid(), getgid()) != 0) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } ++ + if (!isatty(1)) + path = "cat"; + else { +diff -Naur --exclude '*.swp' bsd-games-2.17/factor/factor.c bsd-games-2.17.new/factor/factor.c +--- bsd-games-2.17/factor/factor.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/factor/factor.c 2006-04-07 17:26:49.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ +@@ -138,6 +139,12 @@ + int ch; + char *p, buf[LINE_MAX]; /* > max number of digits. */ + ++ /* Revoke setgid privileges */ ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } ++ + #ifdef HAVE_OPENSSL + ctx = BN_CTX_new(); + #endif +@@ -145,9 +152,6 @@ + if (val == NULL) + errx(1, "can't initialise bignum"); + +- /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); +- + while ((ch = getopt(argc, argv, "")) != -1) + switch (ch) { + case '?': +diff -Naur --exclude '*.swp' bsd-games-2.17/fish/fish.c bsd-games-2.17.new/fish/fish.c +--- bsd-games-2.17/fish/fish.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/fish/fish.c 2006-04-04 17:34:45.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\ +@@ -103,7 +104,10 @@ + int ch, move; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "p")) != -1) + switch(ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/fortune/fortune/fortune.c bsd-games-2.17.new/fortune/fortune/fortune.c +--- bsd-games-2.17/fortune/fortune/fortune.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/fortune/fortune/fortune.c 2006-04-07 17:28:14.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1986, 1993\n\ +@@ -227,7 +228,10 @@ + #endif /* OK_TO_WRITE_DISK */ + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + getargs(ac, av); + +diff -Naur --exclude '*.swp' bsd-games-2.17/gomoku/main.c bsd-games-2.17.new/gomoku/main.c +--- bsd-games-2.17/gomoku/main.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/gomoku/main.c 2006-04-04 17:35:38.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1994\n\ +@@ -95,7 +96,10 @@ + }; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + color = curmove = 0; + +diff -Naur --exclude '*.swp' bsd-games-2.17/hangman/main.c bsd-games-2.17.new/hangman/main.c +--- bsd-games-2.17/hangman/main.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/hangman/main.c 2006-04-04 17:35:55.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ +@@ -57,7 +58,10 @@ + int ch; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "d:m:")) != -1) { + switch (ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/hunt/hunt/hunt.c bsd-games-2.17.new/hunt/hunt/hunt.c +--- bsd-games-2.17/hunt/hunt/hunt.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/hunt/hunt/hunt.c 2006-04-04 17:36:13.000000000 -0700 +@@ -30,6 +30,7 @@ + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __RCSID("$NetBSD: hunt.c,v 1.23 2004/11/05 21:30:32 dsl Exp $"); +@@ -138,7 +139,10 @@ + long enter_status; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + enter_status = env_init((long) Q_CLOAK); + while ((c = getopt(ac, av, "Sbcfh:l:mn:op:qst:w:")) != -1) { +diff -Naur --exclude '*.swp' bsd-games-2.17/mille/mille.c bsd-games-2.17.new/mille/mille.c +--- bsd-games-2.17/mille/mille.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/mille/mille.c 2006-04-04 17:36:28.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1982, 1993\n\ +@@ -58,7 +59,10 @@ + bool restore; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + if (strcmp(av[0], "a.out") == 0) { + outf = fopen("q", "w"); +diff -Naur --exclude '*.swp' bsd-games-2.17/monop/monop.c bsd-games-2.17.new/monop/monop.c +--- bsd-games-2.17/monop/monop.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/monop/monop.c 2006-04-04 17:36:51.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -65,7 +66,10 @@ + char *av[]; + { + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + srand(getpid()); + heapstart = sbrk(0); +diff -Naur --exclude '*.swp' bsd-games-2.17/morse/morse.c bsd-games-2.17.new/morse/morse.c +--- bsd-games-2.17/morse/morse.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/morse/morse.c 2006-04-04 17:37:05.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ +@@ -127,7 +128,10 @@ + char *p; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "ds")) != -1) + switch((char)ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/number/number.c bsd-games-2.17.new/number/number.c +--- bsd-games-2.17/number/number.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/number/number.c 2006-04-07 17:30:32.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\ +@@ -94,7 +95,10 @@ + char line[256]; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + lflag = 0; + while ((ch = getopt(argc, argv, "l")) != -1) +diff -Naur --exclude '*.swp' bsd-games-2.17/pig/pig.c bsd-games-2.17.new/pig/pig.c +--- bsd-games-2.17/pig/pig.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/pig/pig.c 2006-04-04 17:37:19.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ +@@ -66,7 +67,10 @@ + char buf[1024]; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "")) != -1) + switch(ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/pom/pom.c bsd-games-2.17.new/pom/pom.c +--- bsd-games-2.17/pom/pom.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/pom/pom.c 2006-04-04 17:37:30.000000000 -0700 +@@ -31,6 +31,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ +@@ -101,7 +102,10 @@ + char buf[1024]; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + if (time(&now) == (time_t)-1) + err(1, "time"); +diff -Naur --exclude '*.swp' bsd-games-2.17/ppt/ppt.c bsd-games-2.17.new/ppt/ppt.c +--- bsd-games-2.17/ppt/ppt.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/ppt/ppt.c 2006-04-04 17:37:39.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ +@@ -73,7 +74,10 @@ + int c, start, neednl, dflag; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + dflag = 0; + while ((c = getopt(argc, argv, "dh")) != -1) +diff -Naur --exclude '*.swp' bsd-games-2.17/primes/primes.c bsd-games-2.17.new/primes/primes.c +--- bsd-games-2.17/primes/primes.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/primes/primes.c 2006-04-07 17:29:06.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ +@@ -119,7 +120,10 @@ + char *p; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "")) != -1) + switch (ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/quiz/quiz.c bsd-games-2.17.new/quiz/quiz.c +--- bsd-games-2.17/quiz/quiz.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/quiz/quiz.c 2006-04-04 17:37:56.000000000 -0700 +@@ -33,6 +33,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ +@@ -85,7 +86,10 @@ + const char *indexfile; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + indexfile = _PATH_QUIZIDX; + while ((ch = getopt(argc, argv, "i:t")) != -1) +diff -Naur --exclude '*.swp' bsd-games-2.17/rain/rain.c bsd-games-2.17.new/rain/rain.c +--- bsd-games-2.17/rain/rain.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/rain/rain.c 2006-04-04 17:38:07.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -77,7 +78,10 @@ + int xpos[5], ypos[5]; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + while ((ch = getopt(argc, argv, "d:")) != -1) + switch (ch) { +diff -Naur --exclude '*.swp' bsd-games-2.17/random/random.c bsd-games-2.17.new/random/random.c +--- bsd-games-2.17/random/random.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/random/random.c 2006-04-04 17:38:19.000000000 -0700 +@@ -32,6 +32,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1994\n\ +@@ -73,7 +74,10 @@ + char *ep; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + denom = 0; + random_exit = unbuffer_output = 0; +diff -Naur --exclude '*.swp' bsd-games-2.17/robots/main.c bsd-games-2.17.new/robots/main.c +--- bsd-games-2.17/robots/main.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/robots/main.c 2006-04-06 13:35:58.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -68,7 +69,10 @@ + exit(1); + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + show_only = FALSE; + Num_games = 1; +diff -Naur --exclude '*.swp' bsd-games-2.17/snake/snake/snake.c bsd-games-2.17.new/snake/snake/snake.c +--- bsd-games-2.17/snake/snake/snake.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/snake/snake/snake.c 2006-04-06 13:32:03.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -159,7 +160,10 @@ + warn("fopen %s", _PATH_LOGFILE); + sleep(2); + } +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + (void) time(&tv); + +diff -Naur --exclude '*.swp' bsd-games-2.17/snake/snscore/snscore.c bsd-games-2.17.new/snake/snscore/snscore.c +--- bsd-games-2.17/snake/snscore/snscore.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/snake/snscore/snscore.c 2006-04-06 13:15:19.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -75,7 +76,10 @@ + struct passwd *p; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + fd = fopen(recfile, "r"); + if (fd == NULL) +diff -Naur --exclude '*.swp' bsd-games-2.17/trek/main.c bsd-games-2.17.new/trek/main.c +--- bsd-games-2.17/trek/main.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/trek/main.c 2006-04-04 17:38:38.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -173,7 +174,10 @@ + struct termios argp; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + av = argv; + ac = argc; +diff -Naur --exclude '*.swp' bsd-games-2.17/worm/worm.c bsd-games-2.17.new/worm/worm.c +--- bsd-games-2.17/worm/worm.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/worm/worm.c 2006-04-07 17:28:35.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -99,7 +100,10 @@ + { + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + setbuf(stdout, outbuf); + srand(getpid()); +diff -Naur --exclude '*.swp' bsd-games-2.17/worms/worms.c bsd-games-2.17.new/worms/worms.c +--- bsd-games-2.17/worms/worms.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/worms/worms.c 2006-04-04 17:41:34.000000000 -0700 +@@ -29,6 +29,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ +@@ -199,7 +200,10 @@ + unsigned int delay = 0; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + mp = NULL; + length = 16; +diff -Naur --exclude '*.swp' bsd-games-2.17/wump/wump.c bsd-games-2.17.new/wump/wump.c +--- bsd-games-2.17/wump/wump.c 2006-04-14 15:55:41.000000000 -0700 ++++ bsd-games-2.17.new/wump/wump.c 2006-04-04 17:41:55.000000000 -0700 +@@ -33,6 +33,7 @@ + * SUCH DAMAGE. + */ + ++#define _GNU_SOURCE + #include + #ifndef lint + __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ +@@ -145,7 +146,10 @@ + int c; + + /* Revoke setgid privileges */ +- setregid(getgid(), getgid()); ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + + #ifdef DEBUG + while ((c = getopt(argc, argv, "a:b:hp:r:t:d")) != -1) diff --git a/bsd-games-2.17-tetrisgid.patch b/bsd-games-2.17-tetrisgid.patch new file mode 100644 index 0000000..4c7912c --- /dev/null +++ b/bsd-games-2.17-tetrisgid.patch @@ -0,0 +1,225 @@ +diff -Naur --exclude '*.swp' bsd-games-2.17/tetris/scores.c bsd-games-2.17.new/tetris/scores.c +--- bsd-games-2.17/tetris/scores.c 2006-04-22 20:46:56.000000000 -0700 ++++ bsd-games-2.17.new/tetris/scores.c 2006-04-22 22:02:45.000000000 -0700 +@@ -41,6 +41,7 @@ + * + * Major whacks since then. + */ ++#define _GNU_SOURCE /* this must be done before the first include of unistd.h */ + #include + #include + #include +@@ -77,85 +78,88 @@ + + static int checkscores(struct highscore *, int); + static int cmpscores(const void *, const void *); +-static void getscores(FILE **); ++static void getscores(FILE *); + static void printem(int, int, struct highscore *, int, const char *); + static char *thisuser(void); + + /* +- * Read the score file. Can be called from savescore (before showscores) +- * or showscores (if savescore will not be called). If the given pointer +- * is not NULL, sets *fpp to an open file pointer that corresponds to a +- * read/write score file that is locked with LOCK_EX. Otherwise, the +- * file is locked with LOCK_SH for the read and closed before return. +- * +- * Note, we assume closing the stdio file releases the lock. ++ * Read the score file from a previously opened file pointer. If the file ++ * pointer is null, then read the scoreboard from a known location. Otherwise, ++ * the FILE pointer is rewound, read, and left open to be read again later. + */ + static void +-getscores(fpp) +- FILE **fpp; ++getscores(fp) ++ FILE *fp; + { +- int sd, mint, lck; +- mode_t mask; +- const char *mstr, *human; +- FILE *sf; +- +- if (fpp != NULL) { +- mint = O_RDWR | O_CREAT; +- mstr = "r+"; +- human = "read/write"; +- lck = LOCK_EX; +- } else { +- mint = O_RDONLY; +- mstr = "r"; +- human = "reading"; +- lck = LOCK_SH; +- } +- setegid(egid); +- mask = umask(S_IWOTH); +- sd = open(_PATH_SCOREFILE, mint, 0666); +- (void)umask(mask); +- if (sd < 0) { +- if (fpp == NULL) { +- nscores = 0; +- setegid(gid); +- return; +- } +- err(1, "cannot open %s for %s", _PATH_SCOREFILE, human); +- } +- if ((sf = fdopen(sd, mstr)) == NULL) { +- err(1, "cannot fdopen %s for %s", _PATH_SCOREFILE, human); +- } +- setegid(gid); ++ int sd = -1; ++ FILE *sf = fp; + +- /* +- * Grab a lock. +- */ +- if (flock(sd, lck)) +- warn("warning: score file %s cannot be locked", +- _PATH_SCOREFILE); ++ if (sf == NULL) { ++ sd = open(_PATH_SCOREFILE, O_RDONLY, 0664); ++ if (sd < 0) { ++ nscores = 0; ++ return; ++ err(1, "cannot open %s for reading", _PATH_SCOREFILE); ++ } ++ if ((sf = fdopen(sd, "r")) == NULL) { ++ err(1, "cannot fdopen %s for reading", _PATH_SCOREFILE); ++ } ++ } else { ++ rewind(sf); ++ } + + nscores = fread(scores, sizeof(scores[0]), MAXHISCORES, sf); + if (ferror(sf)) { + err(1, "error reading %s", _PATH_SCOREFILE); + } + +- if (fpp) +- *fpp = sf; +- else +- (void)fclose(sf); ++ else { ++ if (fp == NULL) { ++ (void)fclose(sf); ++ } ++ } ++} ++ ++/* ++ * Open the high score file and then drop setgid privileges. If running ++ * setgid, then calling this function a second time will result in a ++ * permission denied error since gid privileges will have been lost. ++ */ ++void ++open_score(fd, fp) ++ int *fd; ++ FILE **fp; ++{ ++ *fd = open(_PATH_SCOREFILE, O_RDWR | O_CREAT, 0664); ++ if (*fd < 0) { ++ err(1, "Could not open scoreboard file %s", _PATH_SCOREFILE); ++ } else { ++ *fp = fdopen(*fd, "r+"); ++ if (*fp == NULL) { ++ err(1, "Could not open scoreboard file %s", _PATH_SCOREFILE); ++ } ++ } ++ if (setresgid(-1, getgid(), getgid()) == -1) { ++ perror("Could not drop setgid privileges. Aborting."); ++ exit(1); ++ } + } + + void +-savescore(level) ++savescore(level, sf) + int level; ++ FILE *sf; + { + struct highscore *sp; + int i; + int change; +- FILE *sf; + const char *me; + +- getscores(&sf); ++ if (sf == NULL) { ++ return; ++ } ++ ++ getscores(sf); + gotscores = 1; + (void)time(&now); + +@@ -215,14 +219,17 @@ + static char * + thisuser() + { +- const char *p; ++ const char *p = (char *)NULL; + struct passwd *pw; + size_t l; + static char u[sizeof(scores[0].hs_name)]; + + if (u[0]) + return (u); ++ /* Don't use getlogin() as it will return the wrong result ++ * for someone who has su'd to a different user. + p = getlogin(); ++ */ + if (p == NULL || *p == '\0') { + pw = getpwuid(getuid()); + if (pw != NULL) +@@ -359,7 +366,7 @@ + int levelfound[NLEVELS]; + + if (!gotscores) +- getscores((FILE **)NULL); ++ getscores(NULL); + (void)printf("\n\t\t\t Tetris High Scores\n"); + + /* +diff -Naur --exclude '*.swp' bsd-games-2.17/tetris/scores.h bsd-games-2.17.new/tetris/scores.h +--- bsd-games-2.17/tetris/scores.h 2006-04-22 20:46:56.000000000 -0700 ++++ bsd-games-2.17.new/tetris/scores.h 2006-04-22 16:30:46.000000000 -0700 +@@ -48,5 +48,6 @@ + #define MAXSCORES 9 /* maximum high score entries per person */ + #define EXPIRATION (5L * 365 * 24 * 60 * 60) + +-void savescore(int); ++void savescore(int, FILE *); ++void open_score(int *, FILE **); + void showscores(int); +diff -Naur --exclude '*.swp' bsd-games-2.17/tetris/tetris.c bsd-games-2.17.new/tetris/tetris.c +--- bsd-games-2.17/tetris/tetris.c 2006-04-22 20:46:56.000000000 -0700 ++++ bsd-games-2.17.new/tetris/tetris.c 2006-04-22 21:02:27.000000000 -0700 +@@ -135,10 +135,15 @@ + char key_write[6][10]; + int ch, i, j; + int fd; ++ int sd = 0; ++ FILE *sf = (FILE *)NULL; + +- gid = getgid(); +- egid = getegid(); +- setegid(gid); ++ /* ++ * This function has the side effect of dropping setgid privileges. ++ * sd is not used, but is kept around in case we want to add code ++ * to lock shared access to the scoreboard later. ++ */ ++ open_score(&sd, &sf); + + fd = open("/dev/null", O_RDONLY); + if (fd < 3) +@@ -307,7 +312,7 @@ + + (void)printf("Your score: %d point%s x level %d = %d\n", + score, score == 1 ? "" : "s", level, score * level); +- savescore(level); ++ savescore(level, sf); + + printf("\nHit RETURN to see high scores, ^C to skip.\n"); + diff --git a/bsd-games-2.17-utmpstruct.patch b/bsd-games-2.17-utmpstruct.patch new file mode 100644 index 0000000..fc07265 --- /dev/null +++ b/bsd-games-2.17-utmpstruct.patch @@ -0,0 +1,12 @@ +--- bsd-games-2.17.new/dm/utmpentry.c 2004-10-23 05:17:21.000000000 -0700 ++++ bsd-games-2.17/dm/utmpentry.c 2006-04-04 10:51:17.000000000 -0700 +@@ -291,7 +291,8 @@ + e->line[sizeof(e->line) - 1] = '\0'; + (void)strncpy(e->host, up->ut_host, sizeof(up->ut_host)); + e->name[sizeof(e->host) - 1] = '\0'; +- e->tv = up->ut_tv; ++ e->tv.tv_sec = up->ut_tv.tv_sec; ++ e->tv.tv_usec = up->ut_tv.tv_usec; + adjust_size(e); + } + #endif diff --git a/bsd-games.spec b/bsd-games.spec new file mode 100644 index 0000000..d7e8121 --- /dev/null +++ b/bsd-games.spec @@ -0,0 +1,282 @@ +Summary: Collection of text-based games +Name: bsd-games +Version: 2.17 +Release: 8%{?dist} +License: BSD +Group: Amusements/Games +URL: ftp://metalab.unc.edu/pub/Linux/games/ +Source0: ftp://metalab.unc.edu/pub/Linux/games/bsd-games-%{version}.tar.gz +Source1: config.params +# A collection of patches from Debian. +Patch0: bsd-games-2.17-debian.patch +# Patches from Fedora Core 1 +Patch1: bsd-games-2.17-ospeed.patch +Patch2: bsd-games-2.17-getline.patch +Patch3: bsd-games-2.17-utmpstruct.patch +# Additional new patches +Patch4: bsd-games-2.17-setresgid.patch +Patch5: bsd-games-2.17-tetrisgid.patch +Patch6: bsd-games-2.17-hackgid.patch +Patch7: bsd-games-2.17-phantasiagid.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# It looks like textutils became coreutils at some point. I'm not sure +# what is needed from it, so I'm commenting it out until I can find out. +#Requires: textutils +BuildRequires: ncurses-devel libtermcap-devel words +Requires(Pre): /usr/sbin/groupadd + +%description +Bsd-games includes adventure, arithmetic, atc, backgammon, battlestar, +bcd, caesar, canfield, cfscores, cribbage, go-fish, gomoku, +hunt, mille, monop, morse, number, phantasia, pig, pom, ppt, primes, +quiz, rain, random, robots, rot13, sail, snake, snscore, teachgammon, +tetris-bsd, trek, wargames, worm, worms and wump. + +%prep +%setup -q +install -p -m 755 %{SOURCE1} . +%patch0 -p1 -b .debian +%patch1 -p1 -b .ospeed +%patch2 -p1 -b .getline +%patch3 -p1 -b .utmpstruct +%patch4 -p1 -b .setresgid +%patch5 -p1 -b .tetrisgid +%patch6 -p1 -b .hackgid +%patch7 -p1 -b .phantasiagid + +%build +# We include a templatized configuration settings file to set +# reasonable defaults, and to tell the configure script not to +# run in interactive mode. +sed -i.bak -e "s#@DESTDIR@#$RPM_BUILD_ROOT#" \ + -e "s#@bindir@#%{_bindir}#" \ + -e "s#@docdir@#%{_docdir}#" \ + -e "s#@sbindir@#%{_sbindir}#" \ + -e "s#@datadir@#%{_datadir}#" \ + -e "s#@libdir@#%{_libdir}#" \ + -e "s#@mandir@#%{_mandir}#" \ + -e "s#@var@#%{_var}#" \ + -e "s#@RPM_OPT_FLAGS@#$RPM_OPT_FLAGS#" \ + config.params + +# Don't use %%configure. This configure script wasn't generated by +# autoconf and doesn't obey things like --prefix. +./configure +make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" %{?_smp_mflags} + +# Rename one doc file to avoid naming collisions +cp hunt/README README.hunt + +%install +rm -rf $RPM_BUILD_ROOT +make RPM_BUILD_ROOT="$RPM_BUILD_ROOT" install + +# Change the binary name for monop to prevent a conflict with the mono-devel +# package +mv $RPM_BUILD_ROOT/%{_bindir}/monop $RPM_BUILD_ROOT/%{_bindir}/mpoly + +# Remove this doc file. We're copying it to a different location for Fedora. +rm -f $RPM_BUILD_ROOT/%{_docdir}/trek.me + +%clean +rm -rf $RPM_BUILD_ROOT + +%pre +%{_sbindir}/groupadd gamehack &>/dev/null || : +%{_sbindir}/groupadd gamesail &>/dev/null || : +%{_sbindir}/groupadd gamephant &>/dev/null || : + +%files +%defattr(-,root,root) +%{_bindir}/adventure +%{_bindir}/arithmetic +%attr(2755,root,games) %{_bindir}/atc +%{_bindir}/backgammon +%{_bindir}/teachgammon +%attr(2755,root,games) %{_bindir}/battlestar +%{_bindir}/banner +%{_bindir}/boggle +%{_bindir}/bcd +%{_bindir}/caesar +%{_bindir}/dab +%{_bindir}/rot13 +%attr(2755,root,games) %{_bindir}/canfield +%{_bindir}/cfscores +%attr(2755,root,games) %{_bindir}/cribbage +%{_bindir}/go-fish +%{_bindir}/gomoku +%attr(2755,root,gamehack) %{_bindir}/hack +%{_bindir}/hangman +%{_bindir}/hunt +%{_bindir}/mille +%{_bindir}/mpoly +%{_bindir}/morse +%{_bindir}/number +%attr(2755,root,gamephant) %{_bindir}/phantasia +%{_bindir}/pig +%{_bindir}/pom +%{_bindir}/ppt +%{_bindir}/primes +%{_bindir}/quiz +%{_bindir}/rain +%{_bindir}/random +%attr(2755,root,games) %{_bindir}/robots +%attr(2755,root,gamesail) %{_bindir}/sail +%attr(2755,root,games) %{_bindir}/snake +%{_bindir}/snscore +%attr(2755,root,games) %{_bindir}/tetris-bsd +%{_bindir}/trek +%{_bindir}/wargames +%{_bindir}/worm +%{_bindir}/worms +%{_bindir}/wtf +%{_bindir}/wump +%dir %{_datadir}/bsd-games +%{_datadir}/bsd-games/atc +%{_datadir}/bsd-games/boggle +%{_datadir}/bsd-games/cribbage.instr +%{_datadir}/bsd-games/fish.instr +%{_datadir}/bsd-games/monop-cards.pck +%{_datadir}/bsd-games/quiz +%{_datadir}/bsd-games/wump.info +%{_datadir}/misc/acronyms +%{_datadir}/misc/acronyms.comp +%{_mandir}/man6/* +%{_sbindir}/huntd +%attr(664,root,games) %{_var}/games/atc_score +%attr(664,root,games) %{_var}/games/battlestar.log +%attr(664,root,games) %{_var}/games/cfscores +%attr(664,root,games) %{_var}/games/criblog +%{_datadir}/bsd-games/hack/ +%dir %attr(0775,root,gamehack) %{_var}/games/hack +%attr(664,root,gamehack) %{_var}/games/hack/* +%dir %attr(775,root,gamephant) %{_var}/games/phantasia +%attr(664,root,gamephant) %{_var}/games/phantasia/* +%dir %attr(775,root,gamesail) %{_var}/games/sail +%attr(644,root,games) %{_var}/games/robots_roll +%attr(664,root,gamesail) %{_var}/games/saillog +%attr(664,root,games) %{_var}/games/snake.log +%attr(664,root,games) %{_var}/games/snakerawscores +%attr(664,root,games) %{_var}/games/tetris-bsd.scores +%doc AUTHORS COPYING ChangeLog ChangeLog.0 THANKS YEAR2000 README.hunt trek/USD.doc/trek.me + +%changelog +* Fri Apr 28 2006 Wart 2.17-8 +- Fix directory ownership of _datadir/bsd-games +- Change license to BSD + +* Thu Apr 27 2006 Wart 2.17-7 +- Remove dm for Fedora +- Turn off setgid bit for cfscores +- Limit setgid code segments in hack +- Limit setgid code segments in phantasia + +* Wed Apr 26 2006 Wart 2.17-6 +- Remove bones file modifications from hack and run with a custom group + instead. + +* Sun Apr 24 2006 Wart 2.17-5 +- Modified bones file handling to allow us to drop setgid earlier. + +* Sat Apr 22 2006 Wart 2.17-4 +- Added dist tag to release number +- Added patch to limit potential security holes in tetris-bsd +- Added patch set from Debian's package, which includes a security patch + for CVE-2006-1744 +- Rename monop to mpoly to avoid conflict with the mono-devel package. + +* Fri Apr 14 2006 Wart 2.17-3 +- Updated setresgid patch to disable potential security holes from + user-specified scoreboard files. +- Move hack save games to $HOME, but can be moved using HACKDIR or the + '-d' command line option. + +* Sat Apr 8 2006 Wart 2.17-2 +- Added patch to change use of setregid to setresgid almost everywhere. +- Added missing BuildRequires + +* Mon Apr 3 2006 Wart 2.17-1 +- Updated to 2.17 with new configuration system +- Updated patches for 2.17 +- Updated spec file for Fedora Extras + +* Fri Feb 16 2001 Tim Powers +- fixed getline() redefinition, it is included in stdio.h now, so + getline had to be renamed. Also, -D_GNU_SOURCE +- fix bug 27850, where certain games need to be setgid games, and + their scorefiles etc. need to belong to group games + +* Tue Aug 1 2000 Tim Powers +- fix bug #15013, bad dir permissions + +* Mon Jul 24 2000 Prospector +- rebuilt + +* Thu Jul 13 2000 Trond Eivind Glomsrød +- use %%{_tmppath} +- don't use internal rpm programs +- kill countmail, no longer require frm from elm + +* Mon Jun 5 2000 Tim Powers +- fixed man page location to be in %{_mandir} +- fixed so that regular users can build + +* Fri May 5 2000 Tim Powers +- rebuilt for 7.0 +- compress man pages + +* Thu Feb 10 2000 Tim Powers +- strip binaries. + +* Sun Nov 21 1999 Bernhard Rosenkraenzer +- 2.9 + +* Mon Nov 1 1999 Tim Powers +- updated source to 2.8 +- fixed problem with ospeed being defined in the source instead of including + termcap.h (new ospeed patch) +- using files list in %files section instead of entering + _every_single_filename_. + +* Sat Aug 21 1999 Bill Nottingham +- fix countmail (#3722). I must be bored. + +* Mon Aug 16 1999 Bill Nottingham +- make dm setgid games, not setuid root... + +* Fri Jul 9 1999 Tim Powers +- updated source to 2.7 +- updated patches to fix bugs and the braindead configure script, + dropped a few of the older patches that made it into this release +- replaced -make install with make install-strip +- built for 6.1 + +* Wed May 12 1999 Bill Nottingham +- pick up some more files + +* Thu Apr 01 1999 Michael Maher +- only a fool would add a dependency to this package on a + day like today. + +* Fri Mar 18 1999 Michael Maher +- fixed bug 1550 + +* Mon Feb 08 1999 Michael Maher +- moved pacakge to PowerTools. + +* Thu Jun 18 1998 Alan Cox +- Chris Evans pointed out a hole in sail I missed. + +* Wed Jun 17 1998 Alan Cox +- Stopped people using cribbage to be able to cheat game score files. + +* Tue May 05 1998 Prospector System +- translations modified for de, fr, tr + +* Thu Apr 30 1998 Cristian Gafton +- fixed the config patch so that it will build on non /usr/src/redhat build + trees + +* Tue Apr 07 1998 Erik Troan +- updated to bsd-games 2.1 +- started over on package diff --git a/config.params b/config.params new file mode 100644 index 0000000..bfbc46a --- /dev/null +++ b/config.params @@ -0,0 +1,42 @@ +#!/bin/sh + +# This file contains the configuration settings for the bsd games +# collection as packaged for Fedora Extras. Only some settings are +# listed here. You'll have to comb through the configure script +# to discover other things that can be modified. + +bsd_games_cfg_non_interactive=y +bsd_games_cfg_install_prefix=@DESTDIR@ +bsd_games_cfg_no_build_dirs="countmail dm factor fortune" +bsd_games_cfg_gamesdir=@bindir@ +bsd_games_cfg_sbindir=@sbindir@ +bsd_games_cfg_libexecdir=@libdir@ +bsd_games_cfg_man6dir=@mandir@/man6 +bsd_games_cfg_man8dir=@mandir@/man8 +bsd_games_cfg_man5dir=@mandir@/man5 +bsd_games_cfg_docdir=@docdir@ +bsd_games_cfg_sharedir=@datadir@/bsd-games/ +bsd_games_cfg_varlibdir=@var@/games/ +# Don't try to chown the files. This will fail for non-root users and +# will instead be handled in the rpm packaging. +bsd_games_cfg_do_chown=n +bsd_games_cfg_use_dot_so=.so +bsd_games_cfg_gzip_manpages=y +bsd_games_cfg_cc=gcc +bsd_games_cfg_cxx=g++ +bsd_games_cfg_optimize_flags="@RPM_OPT_FLAGS@" +bsd_games_cfg_ncurses_lib=-lncurses +bsd_games_cfg_ncurses_includes= +bsd_games_cfg_base_libs= +bsd_games_cfg_yacc="bison -y" +bsd_games_cfg_lex=flex +bsd_games_cfg_lex_lib=-lfl +bsd_games_cfg_pager=/usr/bin/less +bsd_games_cfg_sail_dir="$bsd_games_cfg_varlibdir/sail" +bsd_games_cfg_sail_dir_owner="root" +bsd_games_cfg_sail_dir_group="root" +bsd_games_cfg_sail_dir_perms="0750" +bsd_games_cfg_hack_dir="/var/games/hack" +bsd_games_cfg_hack_dir_owner="root" +bsd_games_cfg_hack_dir_group="root" +bsd_games_cfg_hack_dir_perms="0755" diff --git a/sources b/sources index e69de29..283f917 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +238a38a3a017ca9b216fc42bde405639 bsd-games-2.17.tar.gz