As in previously sent patches: backgammon(6) does not need setgid

games privileges from dm, so should revoke them on startup.

Patch submitteed in PR 8024 bye Joseph Myers <jsm28@cam.ac.uk>
This commit is contained in:
hubertf 1999-07-19 00:33:58 +00:00
parent 5e22318a8d
commit 3521abbb40
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.10 1999/07/14 22:46:21 hubertf Exp $ */ /* $NetBSD: main.c,v 1.11 1999/07/19 00:33:58 hubertf Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: main.c,v 1.10 1999/07/14 22:46:21 hubertf Exp $"); __RCSID("$NetBSD: main.c,v 1.11 1999/07/19 00:33:58 hubertf Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -99,6 +99,9 @@ main(argc, argv)
char c; /* non-descript character storage */ char c; /* non-descript character storage */
long t; /* time for random num generator */ long t; /* time for random num generator */
/* revoke setgid privileges */
setregid(getgid(), getgid());
/* initialization */ /* initialization */
bflag = 2; /* default no board */ bflag = 2; /* default no board */
signal(SIGINT, getout); /* trap interrupts */ signal(SIGINT, getout); /* trap interrupts */

View File

@ -1,4 +1,4 @@
/* $NetBSD: teach.c,v 1.8 1999/02/10 12:29:48 hubertf Exp $ */ /* $NetBSD: teach.c,v 1.9 1999/07/19 00:34:00 hubertf Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: teach.c,v 1.8 1999/02/10 12:29:48 hubertf Exp $"); __RCSID("$NetBSD: teach.c,v 1.9 1999/07/19 00:34:00 hubertf Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -72,6 +72,9 @@ main(argc, argv)
{ {
int i; int i;
/* revoke setgid privileges */
setregid(getgid(), getgid());
signal(SIGINT, getout); signal(SIGINT, getout);
if (tcgetattr(0, &old) == -1) /* get old tty mode */ if (tcgetattr(0, &old) == -1) /* get old tty mode */
errexit("teachgammon(gtty)"); errexit("teachgammon(gtty)");