1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

proper gid revoke

This commit is contained in:
deraadt 1996-12-22 20:00:41 +00:00
parent 31194d319d
commit 161033a189
33 changed files with 84 additions and 14 deletions

View File

@ -4,7 +4,7 @@
BINGRP?= games
.if defined(HIDEGAME)
BINDIR?= /usr/games/hide
BINMODE?= 2550
BINMODE?= 550
.else
BINDIR?= /usr/games
.endif

View File

@ -77,6 +77,8 @@ main(ac, av)
extern char *default_game(), *okay_game();
extern void log_score(), quit(), update();
/* revoke privs */
setegid(getgid());
setgid(getgid());
start_time = seed = time(0);

View File

@ -109,6 +109,8 @@ char **argv;
register char c; /* non-descript character storage */
long t; /* time for random num generator */
/* revoke privs */
setegid(getgid());
setgid(getgid());
/* initialization */

View File

@ -84,6 +84,8 @@ char **argv;
{
register int i;
/* revoke privs */
setegid(getgid());
setgid(getgid());
signal (2,getout);

View File

@ -1036,6 +1036,8 @@ main(argc, argv)
{
int ch;
/* revoke */
setegid(getgid());
setgid(getgid());
while ((ch = getopt(argc, argv, "w:td")) != EOF)

View File

@ -134,6 +134,8 @@ main(argc, argv)
* but this seems kind of silly. So this one doesn't.
*/
/* revoke privs */
setegid(getgid());
setgid(getgid());
if (argc > 1) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bs.c,v 1.2 1996/12/19 22:21:13 deraadt Exp $ */
/* $OpenBSD: bs.c,v 1.3 1996/12/22 20:01:00 deraadt Exp $ */
/*
* bs.c - original author: Bruce Holloway
* salvo option by: Chuck A DeGaul
@ -1203,6 +1203,8 @@ main(argc, argv)
int argc;
char *argv[];
{
/* revoke privs */
setegid(getgid());
setgid(getgid());
do_options(argc, argv);

View File

@ -85,6 +85,8 @@ main(argc, argv)
int obs[26], try, winner;
char *malloc(), *strerror();
/* revoke privs */
setegid(getgid());
setgid(getgid());
if (argc > 1)

View File

@ -1699,7 +1699,11 @@ main(argc, argv)
raw();
noecho();
initall();
setgid(getgid()); /* revoke */
/* revoke privs */
setegid(getgid());
setgid(getgid());
instruct();
makeboard();
for (;;) {

View File

@ -80,7 +80,11 @@ main(argc, argv)
perror(_PATH_SCORE);
exit(2);
}
setgid(getgid()); /* revoke */
/* revoke privs */
setegid(getgid());
setgid(getgid());
setpwent();
if (argc == 1) {
uid = getuid();

View File

@ -99,6 +99,8 @@ main(argc, argv)
int ch;
char *p, buf[100]; /* > max number of digits. */
/* revoke privs */
setegid(getgid());
setgid(getgid());
while ((ch = getopt(argc, argv, "")) != EOF)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.4 1996/12/21 21:17:51 tholo Exp $ */
/* $OpenBSD: main.c,v 1.5 1996/12/22 20:01:16 deraadt Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@ -89,6 +89,8 @@ main(argc, argv)
"%3d %-6s"
};
/* revoke privs */
setegid(getgid());
setgid(getgid());
prog = strrchr(argv[0], '/');

View File

@ -1,4 +1,4 @@
/* $OpenBSD: grdc.c,v 1.2 1996/12/19 22:21:30 deraadt Exp $ */
/* $OpenBSD: grdc.c,v 1.3 1996/12/22 20:01:17 deraadt Exp $ */
/*
* Grand digital clock for curses compatible terminals
* Usage: grdc [-s] [n] -- run for n seconds (default infinity)
@ -57,6 +57,8 @@ int n = 0;
initscr();
/* revoke privs */
setegid(getgid());
setgid(getgid());
signal(SIGINT,sighndl);

View File

@ -468,8 +468,9 @@ boolean wr;
&& strcmp(dir, HACKDIR) /* and not the default? */
#endif
) {
(void) setuid(getuid()); /* Ron Wessels */
(void) setgid(getgid());
/* revoke */
setegid(getgid());
setgid(getgid());
}
#endif

View File

@ -384,8 +384,9 @@ child(wt) {
f = fork();
if(f == 0){ /* child */
settty((char *) 0); /* also calls end_screen() */
(void) setuid(getuid());
(void) setgid(getgid());
/* revoke */
setegid(getgid());
setgid(getgid());
#ifdef CHDIR
(void) chdir(getenv("HOME"));
#endif CHDIR

View File

@ -56,6 +56,8 @@ main()
{
void die();
/* revoke */
setegid(getgid());
setgid(getgid());
initscr();

View File

@ -65,7 +65,9 @@ register char *av[]; {
register bool restore;
setgid(getgid()); /* run as the user */
/* revoke */
setegid(getgid());
setgid(getgid());
if (strcmp(av[0], "a.out") == 0) {
outf = fopen("q", "w");

View File

@ -82,6 +82,8 @@ int ac;
char *av[]; {
int n;
/* revoke */
setegid(getgid());
setgid(getgid());
getargs(ac, av);

View File

@ -103,6 +103,8 @@ main(argc, argv)
register int ch;
register char *p;
/* revoke */
setegid(getgid());
setgid(getgid());
while ((ch = getopt(argc, argv, "s")) != EOF)

View File

@ -96,6 +96,8 @@ main(argc, argv)
int ch, first;
char line[256];
/* revoke */
setegid(getgid());
setgid(getgid());
lflag = 0;

View File

@ -66,6 +66,8 @@ main(argc, argv)
int ch;
char buf[1024];
/* revoke */
setegid(getgid());
setgid(getgid());
while ((ch = getopt(argc, argv, "")) != EOF)

View File

@ -86,6 +86,8 @@ main()
double days, today, tomorrow;
int cnt;
/* revoke */
setegid(getgid());
setgid(getgid());
if (gettimeofday(&tp,&tzp)) {

View File

@ -58,6 +58,8 @@ main(argc, argv)
register int c;
register char *p;
/* revoke */
setegid(getgid());
setgid(getgid());
(void) puts("___________");

View File

@ -120,6 +120,8 @@ main(argc, argv)
int ch;
char *p;
/* revoke */
setegid(getgid());
setgid(getgid());
while ((ch = getopt(argc, argv, "")) != EOF)

View File

@ -84,6 +84,8 @@ main(argc, argv)
register int ch;
char *indexfile;
/* revoke */
setegid(getgid());
setgid(getgid());
indexfile = _PATH_QUIZIDX;

View File

@ -81,6 +81,8 @@ main(argc, argv)
struct winsize ws;
#endif
/* revoke */
setegid(getgid());
setgid(getgid());
if (!(term = getenv("TERM"))) {

View File

@ -73,6 +73,8 @@ main(argc, argv)
int ch, random_exit, selected, unbuffer_output;
char *ep;
/* revoke */
setegid(getgid());
setgid(getgid());
random_exit = unbuffer_output = 0;

View File

@ -62,6 +62,10 @@ char **av;
extern int Max_per_uid;
void quit();
/* revoke */
setegid(getgid());
setgid(getgid());
show_only = FALSE;
if (ac > 1) {
bad_arg = FALSE;
@ -70,8 +74,6 @@ char **av;
if (isdigit(av[0][0]))
Max_per_uid = atoi(av[0]);
else {
setuid(getuid());
setgid(getgid());
Scorefile = av[0];
# ifdef FANCY
sp = rindex(Scorefile, '/');

View File

@ -114,6 +114,9 @@ char **argv;
rawscores = open(_PATH_RAWSCORES, O_RDWR|O_CREAT, 0644);
logfile = fopen(_PATH_LOGFILE, "a");
/* revoke privs */
setegid(getgid());
setgid(getgid());
(void)time(&tv);

View File

@ -75,11 +75,16 @@ main()
struct passwd *p;
fd = fopen(recfile, "r");
setgid(getgid());
if (fd == NULL) {
perror(recfile);
exit(1);
}
/* revoke privs */
setegid(getgid());
setgid(getgid());
printf("Snake players scores to date\n");
fread(&whoallbest, sizeof(short), 1, fd);
fread(&allbest, sizeof(short), 1, fd);

View File

@ -89,6 +89,8 @@ main(argc, argv)
{
char ch;
/* revoke */
setegid(getgid());
setgid(getgid());
if (argc == 2)

View File

@ -211,6 +211,8 @@ main(argc, argv)
struct winsize ws;
#endif
/* revoke */
setegid(getgid());
setgid(getgid());
length = 16;

View File

@ -118,6 +118,8 @@ main(argc, argv)
extern char *optarg;
int c;
/* revoke */
setegid(getgid());
setgid(getgid());
#ifdef DEBUG