diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2005-05-01 02:43:13 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2005-05-01 02:43:13 +0000 |
commit | c95bccb936556e0fd39a029d1dcd998c0691187d (patch) | |
tree | bf587d52b86dbbf6c51b4dc5f672f56e62222f50 /games/canfield | |
parent | ddeaac82999e25819a7b555fb4af8b901a6a5aab (diff) |
use setresgid() to drop privs, it is simply a better and less ambiguous API;
ok deraadt@ and millert@ a while ago, more to come
Diffstat (limited to 'games/canfield')
-rw-r--r-- | games/canfield/canfield/canfield.c | 9 | ||||
-rw-r--r-- | games/canfield/cfscores/cfscores.c | 11 |
2 files changed, 11 insertions, 9 deletions
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) { |