diff options
-rw-r--r-- | games/atc/main.c | 9 | ||||
-rw-r--r-- | games/battlestar/battlestar.c | 11 | ||||
-rw-r--r-- | games/canfield/canfield/canfield.c | 9 | ||||
-rw-r--r-- | games/canfield/cfscores/cfscores.c | 11 | ||||
-rw-r--r-- | games/hack/hack.main.c | 11 | ||||
-rw-r--r-- | games/hack/hack.pager.c | 11 | ||||
-rw-r--r-- | games/robots/main.c | 11 | ||||
-rw-r--r-- | games/snake/snake.c | 9 |
8 files changed, 45 insertions, 37 deletions
diff --git a/games/atc/main.c b/games/atc/main.c index 172417f47f8..f2f07e60e7c 100644 --- a/games/atc/main.c +++ b/games/atc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.12 2004/11/29 08:52:28 jsg Exp $ */ +/* $OpenBSD: main.c,v 1.13 2005/05/01 02:43:11 djm Exp $ */ /* $NetBSD: main.c,v 1.4 1995/04/27 21:22:25 mycroft Exp $ */ /*- @@ -52,7 +52,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.12 2004/11/29 08:52:28 jsg Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.13 2005/05/01 02:43:11 djm Exp $"; #endif #endif /* not lint */ @@ -67,6 +67,7 @@ main(int ac, char *av[]) const char *file = NULL; char *name, *ptr, *seed; struct sigaction sa; + gid_t gid; #ifdef BSD struct itimerval itv; #endif @@ -74,8 +75,8 @@ main(int ac, char *av[]) open_score_file(); /* revoke privs */ - setegid(getgid()); - setgid(getgid()); + gid = getgid(); + setresgid(gid, gid, gid); start_time = time(0); makenoise = 1; diff --git a/games/battlestar/battlestar.c b/games/battlestar/battlestar.c index cd94a6d14d9..fcb961d6453 100644 --- a/games/battlestar/battlestar.c +++ b/games/battlestar/battlestar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: battlestar.c,v 1.14 2004/07/10 07:26:22 deraadt Exp $ */ +/* $OpenBSD: battlestar.c,v 1.15 2005/05/01 02:43:12 djm Exp $ */ /* $NetBSD: battlestar.c,v 1.3 1995/03/21 15:06:47 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: battlestar.c,v 1.14 2004/07/10 07:26:22 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: battlestar.c,v 1.15 2005/05/01 02:43:12 djm Exp $"; #endif #endif /* not lint */ @@ -61,12 +61,13 @@ main(int argc, char *argv[]) { char mainbuf[LINELENGTH]; char *next; + gid_t gid; open_score_file(); - /* revoke privs. */ - setegid(getgid()); - setgid(getgid()); + /* revoke privs */ + gid = getgid(); + setresgid(gid, gid, gid); if (argc < 2) initialize(NULL); diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c index 60c8ce2fcfc..77ccc925490 100644 --- a/games/canfield/canfield/canfield.c +++ b/games/canfield/canfield/canfield.c @@ -1,4 +1,4 @@ -/* $OpenBSD: canfield.c,v 1.10 2004/07/09 15:59:26 deraadt Exp $ */ +/* $OpenBSD: canfield.c,v 1.11 2005/05/01 02:43:12 djm Exp $ */ /* $NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: canfield.c,v 1.10 2004/07/09 15:59:26 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: canfield.c,v 1.11 2005/05/01 02:43:12 djm Exp $"; #endif #endif /* not lint */ @@ -1752,6 +1752,7 @@ askquit(int dummy) int main(int argc, char *argv[]) { + gid_t gid; #ifdef MAXLOAD double vec[3]; @@ -1770,8 +1771,8 @@ main(int argc, char *argv[]) initall(); /* revoke privs */ - setegid(getgid()); - setgid(getgid()); + gid = getgid(); + setresgid(gid, gid, gid); instruct(); makeboard(); diff --git a/games/canfield/cfscores/cfscores.c b/games/canfield/cfscores/cfscores.c index 177f5c2caa2..0a4a91bbc73 100644 --- a/games/canfield/cfscores/cfscores.c +++ b/games/canfield/cfscores/cfscores.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfscores.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $ */ +/* $OpenBSD: cfscores.c,v 1.13 2005/05/01 02:43:12 djm Exp $ */ /* $NetBSD: cfscores.c,v 1.3 1995/03/21 15:08:37 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: cfscores.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cfscores.c,v 1.13 2005/05/01 02:43:12 djm Exp $"; #endif #endif /* not lint */ @@ -73,7 +73,8 @@ int main(int argc, char *argv[]) { struct passwd *pw; - int uid; + uid_t uid; + gid_t gid; if (argc > 2) { fprintf(stderr, "Usage: cfscores [user]\n"); @@ -84,8 +85,8 @@ main(int argc, char *argv[]) err(2, "%s", _PATH_SCORE); /* revoke privs */ - setegid(getgid()); - setgid(getgid()); + gid = getgid(); + setresgid(gid, gid, gid); setpwent(); if (argc == 1) { diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c index d240035272e..5f69d9365c3 100644 --- a/games/hack/hack.main.c +++ b/games/hack/hack.main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.main.c,v 1.13 2003/07/06 02:07:45 avsm Exp $ */ +/* $OpenBSD: hack.main.c,v 1.14 2005/05/01 02:43:12 djm Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -62,7 +62,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: hack.main.c,v 1.13 2003/07/06 02:07:45 avsm Exp $"; +static const char rcsid[] = "$OpenBSD: hack.main.c,v 1.14 2005/05/01 02:43:12 djm Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -519,6 +519,7 @@ impossible(char *s, ...) static void chdirx(char *dir, boolean wr) { + gid_t gid; #ifdef SECURE if(dir /* User specified directory? */ @@ -526,9 +527,9 @@ chdirx(char *dir, boolean wr) && strcmp(dir, HACKDIR) /* and not the default? */ #endif ) { - /* revoke */ - setegid(getgid()); - setgid(getgid()); + /* revoke privs */ + gid = getgid(); + setresgid(gid, gid, gid); } #endif diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c index 64fd8836569..9210f410edb 100644 --- a/games/hack/hack.pager.c +++ b/games/hack/hack.pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.pager.c,v 1.10 2003/05/19 06:30:56 pjanzen Exp $ */ +/* $OpenBSD: hack.pager.c,v 1.11 2005/05/01 02:43:12 djm Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -62,7 +62,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: hack.pager.c,v 1.10 2003/05/19 06:30:56 pjanzen Exp $"; +static const char rcsid[] = "$OpenBSD: hack.pager.c,v 1.11 2005/05/01 02:43:12 djm Exp $"; #endif /* not lint */ /* This file contains the command routine dowhatis() and a pager. */ @@ -435,13 +435,14 @@ child(int wt) int status; int f; char *home; + gid_t gid; f = fork(); if(f == 0){ /* child */ settty((char *) 0); /* also calls end_screen() */ - /* revoke */ - setegid(getgid()); - setgid(getgid()); + /* revoke privs */ + gid = getgid(); + setresgid(gid, gid, gid); #ifdef CHDIR home = getenv("HOME"); if (home == NULL || *home == '\0') diff --git a/games/robots/main.c b/games/robots/main.c index ae4a631e025..f21294a42b7 100644 --- a/games/robots/main.c +++ b/games/robots/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.15 2005/04/10 13:49:13 jmc Exp $ */ +/* $OpenBSD: main.c,v 1.16 2005/05/01 02:43:12 djm Exp $ */ /* $NetBSD: main.c,v 1.5 1995/04/22 10:08:54 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.15 2005/04/10 13:49:13 jmc Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.16 2005/05/01 02:43:12 djm Exp $"; #endif #endif /* not lint */ @@ -62,6 +62,7 @@ main(int ac, char *av[]) int score_err = 0; /* hold errno from score file open */ int ch; extern int optind; + gid_t gid; #ifdef FANCY char *sp; #endif @@ -69,9 +70,9 @@ main(int ac, char *av[]) if ((score_wfd = open(Scorefile, O_RDWR)) < 0) score_err = errno; - /* revoke */ - setegid(getgid()); - setgid(getgid()); + /* revoke privs */ + gid = getgid(); + setresgid(gid, gid, gid); show_only = FALSE; while ((ch = getopt(ac, av, "srajt")) != -1) diff --git a/games/snake/snake.c b/games/snake/snake.c index 32d9c4a7b5f..fe34108f12b 100644 --- a/games/snake/snake.c +++ b/games/snake/snake.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snake.c,v 1.9 2004/07/10 07:26:24 deraadt Exp $ */ +/* $OpenBSD: snake.c,v 1.10 2005/05/01 02:43:12 djm Exp $ */ /* $NetBSD: snake.c,v 1.8 1995/04/29 00:06:41 mycroft Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94"; #else -static char rcsid[] = "$OpenBSD: snake.c,v 1.9 2004/07/10 07:26:24 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: snake.c,v 1.10 2005/05/01 02:43:12 djm Exp $"; #endif #endif /* not lint */ @@ -150,6 +150,7 @@ main(int argc, char *argv[]) int ch, i; char *p, **av; struct sigaction sa; + gid_t gid; /* don't create the score file if it doesn't exist. */ rawscores = open(_PATH_RAWSCORES, O_RDWR, 0664); @@ -158,8 +159,8 @@ main(int argc, char *argv[]) #endif /* revoke privs */ - setegid(getgid()); - setgid(getgid()); + gid = getgid(); + setresgid(gid, gid, gid); /* check to see if we were called as snscore */ av = argv; |