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

Pledge; OK millert@

This commit is contained in:
tim 2015-11-01 14:02:37 +00:00
parent 1835fe0e2d
commit 49afeee2d5
2 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: skeyaudit.c,v 1.25 2015/01/16 06:40:11 deraadt Exp $ */ /* $OpenBSD: skeyaudit.c,v 1.26 2015/11/01 14:02:37 tim Exp $ */
/* /*
* Copyright (c) 1997, 2000, 2003 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 1997, 2000, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@ -47,6 +47,9 @@ main(int argc, char **argv)
char *name; char *name;
int ch, left, aflag, iflag, limit; int ch, left, aflag, iflag, limit;
if (pledge("stdio rpath wpath flock getpw proc exec id", NULL) == -1)
err(1, "pledge");
aflag = iflag = 0; aflag = iflag = 0;
limit = 12; limit = 12;
while ((ch = getopt(argc, argv, "ail:")) != -1) while ((ch = getopt(argc, argv, "ail:")) != -1)
@ -72,6 +75,11 @@ main(int argc, char **argv)
usage(); usage();
} }
if (iflag) {
if (pledge("stdio rpath wpath flock getpw", NULL) == -1)
err(1, "pledge");
}
/* /*
* Make sure STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO are open. * Make sure STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO are open.
* If not, open /dev/null in their place or bail. * If not, open /dev/null in their place or bail.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: skeyinfo.c,v 1.14 2003/06/17 21:56:26 millert Exp $ */ /* $OpenBSD: skeyinfo.c,v 1.15 2015/11/01 14:02:37 tim Exp $ */
/* /*
* Copyright (c) 1997, 2001, 2002 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 1997, 2001, 2002 Todd C. Miller <Todd.Miller@courtesan.com>
@ -42,6 +42,9 @@ main(int argc, char **argv)
char *name = NULL; char *name = NULL;
int error, ch, verbose = 0; int error, ch, verbose = 0;
if (pledge("stdio rpath wpath flock getpw", NULL) == -1)
err(1, "pledge");
while ((ch = getopt(argc, argv, "v")) != -1) while ((ch = getopt(argc, argv, "v")) != -1)
switch(ch) { switch(ch) {
case 'v': case 'v':