summaryrefslogtreecommitdiffstats
path: root/battlestar/battlestar.c
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1999-07-21 03:56:53 +0000
committerhubertf <hubertf@NetBSD.org>1999-07-21 03:56:53 +0000
commit36f340bd47acb8baf6515e7754448dbb1e48a5a8 (patch)
tree748b31d2937624a543ba8d8a001dc09881c3205e /battlestar/battlestar.c
parent76808686fda1c6ee705960f64ccee77a9b29e5ee (diff)
downloadbsdgames-darwin-36f340bd47acb8baf6515e7754448dbb1e48a5a8.tar.gz
bsdgames-darwin-36f340bd47acb8baf6515e7754448dbb1e48a5a8.tar.zst
bsdgames-darwin-36f340bd47acb8baf6515e7754448dbb1e48a5a8.zip
Drop setgid privileges early. Derived from OpenBSD and sent in as PR 5970
by Joseph Myers <jsm28@cam.ac.uk>.
Diffstat (limited to 'battlestar/battlestar.c')
-rw-r--r--battlestar/battlestar.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/battlestar/battlestar.c b/battlestar/battlestar.c
index acafb5c1..9eb63707 100644
--- a/battlestar/battlestar.c
+++ b/battlestar/battlestar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: battlestar.c,v 1.6 1997/10/11 02:06:55 lukem Exp $ */
+/* $NetBSD: battlestar.c,v 1.7 1999/07/21 03:56:53 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: battlestar.c,v 1.6 1997/10/11 02:06:55 lukem Exp $");
+__RCSID("$NetBSD: battlestar.c,v 1.7 1999/07/21 03:56:53 hubertf Exp $");
#endif
#endif /* not lint */
@@ -66,6 +66,9 @@ main(argc, argv)
char mainbuf[LINELENGTH];
char *next;
+ /* Open the score file then revoke setgid privileges */
+ open_score_file();
+ setregid(getgid(), getgid());
initialize(argc < 2 || strcmp(argv[1], "-r"));
start:
news();