-/* $OpenBSD: cat.c,v 1.22 2015/10/03 18:56:20 deraadt Exp $ */
+/* $OpenBSD: cat.c,v 1.23 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */
/*
setlocale(LC_ALL, "");
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "benstuv")) != -1)
switch (ch) {
-/* $OpenBSD: chmod.c,v 1.37 2015/10/03 15:00:13 deraadt Exp $ */
+/* $OpenBSD: chmod.c,v 1.38 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: chmod.c,v 1.12 1995/03/21 09:02:09 cgd Exp $ */
/*
atflags = 0;
if (ischflags) {
- if (tame("stdio rpath fattr", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath fattr", NULL) == -1)
+ err(1, "pledge");
flags = *argv;
if (*flags >= '0' && *flags <= '7') {
-/* $OpenBSD: cp.c,v 1.41 2015/10/08 04:39:24 deraadt Exp $ */
+/* $OpenBSD: cp.c,v 1.42 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */
/*
* -p will use fchown, fchmod, lchown, fchflags..
*/
if (Rflag == 0 && pflag == 0)
- if (tame("stdio rpath wpath cpath fattr", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
+ err(1, "pledge");
if (argc < 2)
usage();
-/* $OpenBSD: date.c,v 1.48 2015/10/07 05:59:36 deraadt Exp $ */
+/* $OpenBSD: date.c,v 1.49 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */
/*
argc--;
}
- if (tame("stdio rpath wpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath", NULL) == -1)
+ err(1, "pledge");
if (*argv && **argv == '+') {
format = *argv + 1;
-/* $OpenBSD: dd.c,v 1.22 2015/10/04 15:01:47 deraadt Exp $ */
+/* $OpenBSD: dd.c,v 1.23 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: dd.c,v 1.6 1996/02/20 19:29:06 jtc Exp $ */
/*-
if (out.offset)
pos_out();
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
/*
* Truncate the output file; ignore errors because it fails on some
-/* $OpenBSD: df.c,v 1.53 2015/10/04 15:54:15 deraadt Exp $ */
+/* $OpenBSD: df.c,v 1.54 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: df.c,v 1.21.2.1 1995/11/01 00:06:11 jtc Exp $ */
/*
int width, maxwidth;
char *mntpt;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "hiklnPt:")) != -1)
switch (ch) {
-/* $OpenBSD: echo.c,v 1.9 2015/10/03 14:51:39 deraadt Exp $ */
+/* $OpenBSD: echo.c,v 1.10 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: echo.c,v 1.6 1995/03/21 09:04:27 cgd Exp $ */
/*
{
int nflag;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
/* This utility may NOT do getopt(3) option parsing. */
if (*++argv && !strcmp(*argv, "-n")) {
-/* $OpenBSD: main.c,v 1.49 2015/10/07 05:37:42 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.50 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
int c, n;
int status = 0;
- if (tame("stdio rpath wpath cpath proc exec tty", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath proc exec tty", NULL) == -1)
+ err(1, "pledge");
home = getenv("HOME");
-/* $OpenBSD: expr.c,v 1.21 2015/10/04 16:01:07 deraadt Exp $ */
+/* $OpenBSD: expr.c,v 1.22 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: expr.c,v 1.3.6.1 1996/06/04 20:41:47 cgd Exp $ */
/*
(void) setlocale(LC_ALL, "");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if (argc > 1 && !strcmp(argv[1], "--"))
argv++;
-/* $OpenBSD: ls.c,v 1.42 2015/10/04 16:00:43 deraadt Exp $ */
+/* $OpenBSD: ls.c,v 1.43 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */
/*
termwidth = width;
}
- if (tame("stdio rpath getpw", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
/* Root is -A automatically. */
if (!getuid())
-/* $OpenBSD: md5.c,v 1.81 2015/10/04 04:56:50 deraadt Exp $ */
+/* $OpenBSD: md5.c,v 1.82 2015/10/09 01:37:06 deraadt Exp $ */
/*
* Copyright (c) 2001,2003,2005-2007,2010,2013,2014
int fl, error, base64, i;
int bflag, cflag, pflag, rflag, tflag, xflag;
- if (tame("stdio cpath rpath wpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio cpath rpath wpath", NULL) == -1)
+ err(1, "pledge");
TAILQ_INIT(&hl);
input_string = NULL;
if (ofile == NULL)
ofile = stdout;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
/* Most arguments are mutually exclusive */
fl = pflag + (tflag ? 1 : 0) + xflag + cflag + (input_string != NULL);
-/* $OpenBSD: mkdir.c,v 1.26 2015/10/07 14:17:18 deraadt Exp $ */
+/* $OpenBSD: mkdir.c,v 1.27 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: mkdir.c,v 1.14 1995/06/25 21:59:21 mycroft Exp $ */
/*
argv += optind;
if (mode & (S_ISUID | S_ISGID | S_ISTXT) == 0) {
- if (tame("stdio cpath rpath fattr", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio cpath rpath fattr", NULL) == -1)
+ err(1, "pledge");
}
if (*argv == NULL)
-/* $OpenBSD: print.c,v 1.62 2015/07/19 19:26:00 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.63 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
*cp++ = 's';
if ((kp->p_psflags & PS_CONTROLT) && kp->p__pgid == kp->p_tpgid)
*cp++ = '+';
- if (kp->p_psflags & PS_TAMED)
- *cp++ = 't';
+ if (kp->p_psflags & PS_PLEDGE)
+ *cp++ = 'p';
*cp = '\0';
if (state == 'R' && kp->p_cpuid != KI_NOCPU) {
-.\" $OpenBSD: ps.1,v 1.100 2015/07/19 19:26:00 deraadt Exp $
+.\" $OpenBSD: ps.1,v 1.101 2015/10/09 01:37:06 deraadt Exp $
.\" $NetBSD: ps.1,v 1.16 1996/03/21 01:36:28 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
.\"
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\"
-.Dd $Mdocdate: July 19 2015 $
+.Dd $Mdocdate: October 9 2015 $
.Dt PS 1
.Os
.Sh NAME
PS_EMBRYO 0x20000 New process, not yet fledged
PS_ZOMBIE 0x40000 Dead and ready to be waited for
PS_NOBROADCASTKILL 0x80000 Process excluded from kill -1
-PS_TAMED 0x100000 process has called tame(2)
+PS_PLEDGE 0x100000 process has called pledge(2)
.Ed
.It Cm re
Core residency time (in seconds; 127 = infinity).
.It N
The process has a reduced CPU
scheduling priority.
+.It p
+The process has called
+.Xr pledge 2 .
.\" .It S
.\" The process has asked for FIFO
.\" page replacement
.\" sequentially address voluminous data).
.It s
The process is a session leader.
-.It t
-The process has called
-.Xr tame 2 .
.It V
The process is suspended during a
.Xr vfork 2 .
-/* $OpenBSD: pwd.c,v 1.13 2015/10/05 05:24:12 deraadt Exp $ */
+/* $OpenBSD: pwd.c,v 1.14 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: pwd.c,v 1.22 2011/08/29 14:51:19 joerg Exp $ */
/*
int ch, lFlag = 0;
const char *p;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "LP")) != -1) {
switch (ch) {
-/* $OpenBSD: rm.c,v 1.31 2015/10/08 13:17:06 deraadt Exp $ */
+/* $OpenBSD: rm.c,v 1.32 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
/*-
argv += optind;
if (Pflag) {
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio rpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath cpath", NULL) == -1)
+ err(1, "pledge");
}
if (argc < 1 && fflag == 0)
-/* $OpenBSD: rmdir.c,v 1.10 2015/10/07 15:47:56 deraadt Exp $ */
+/* $OpenBSD: rmdir.c,v 1.11 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: rmdir.c,v 1.13 1995/03/21 09:08:31 cgd Exp $ */
/*-
setlocale(LC_ALL, "");
- if (tame("stdio cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio cpath", NULL) == -1)
+ err(1, "pledge");
pflag = 0;
while ((ch = getopt(argc, argv, "p")) != -1)
-/* $OpenBSD: sleep.c,v 1.22 2015/10/03 03:10:38 deraadt Exp $ */
+/* $OpenBSD: sleep.c,v 1.23 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: sleep.c,v 1.8 1995/03/21 09:11:11 cgd Exp $ */
/*
struct timespec rqtp;
int i;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
signal(SIGALRM, alarmh);
-/* $OpenBSD: test.c,v 1.14 2015/10/03 23:34:01 deraadt Exp $ */
+/* $OpenBSD: test.c,v 1.15 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: test.c,v 1.15 1995/03/21 07:04:06 cgd Exp $ */
/*
extern char *__progname;
int res;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
if (strcmp(__progname, "[") == 0) {
if (strcmp(argv[--argc], "]"))
-/* $OpenBSD: dmesg.c,v 1.26 2015/10/04 18:49:30 deraadt Exp $ */
+/* $OpenBSD: dmesg.c,v 1.27 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */
/*-
if (sysctl(mib, 2, bufdata, &len, NULL, 0))
err(1, "sysctl: KERN_MSGBUF");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
memcpy(&cur, bufdata, sizeof(cur));
bufdata = ((struct msgbuf *)bufdata)->msg_bufc;
"dmesg")) == NULL)
return (1);
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if (kvm_nlist(kd, nl) == -1)
errx(1, "kvm_nlist: %s", kvm_geterr(kd));
-/* $OpenBSD: ping.c,v 1.126 2015/10/03 00:44:37 deraadt Exp $ */
+/* $OpenBSD: ping.c,v 1.127 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
(void)printf("PING %s: %d data bytes\n", hostname, datalen);
if (options & F_NUMERIC) {
- if (tame("stdio inet", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio inet", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio inet dns", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio inet dns", NULL) == -1)
+ err(1, "pledge");
}
(void)signal(SIGINT, finish);
-/* $OpenBSD: ping6.c,v 1.119 2015/10/04 04:56:50 deraadt Exp $ */
+/* $OpenBSD: ping6.c,v 1.120 2015/10/09 01:37:06 deraadt Exp $ */
/* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */
/*
warn("setsockopt(IPV6_RECVHOPLIMIT)"); /* XXX err? */
if (options & F_HOSTNAME) {
- if (tame("stdio inet dns", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio inet dns", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio inet", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio inet", NULL) == -1)
+ err(1, "pledge");
}
arc4random_buf(&tv64_offset, sizeof(tv64_offset));
-/* $OpenBSD: banner.c,v 1.10 2015/10/05 05:33:29 deraadt Exp $ */
+/* $OpenBSD: banner.c,v 1.11 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: banner.c,v 1.2 1995/04/09 06:00:15 cgd Exp $ */
/*
{
char word[10+1]; /* strings limited to 10 chars */
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while (*++argv) {
(void)strlcpy(word, *argv, sizeof (word));
scan_out(1, word, '\0');
-/* $OpenBSD: basename.c,v 1.10 2015/10/03 01:07:15 deraadt Exp $ */
+/* $OpenBSD: basename.c,v 1.11 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: basename.c,v 1.9 1995/09/02 05:29:46 jtc Exp $ */
/*-
setlocale(LC_ALL, "");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1) {
switch (ch) {
-/* $OpenBSD: cal.c,v 1.29 2015/10/05 13:30:30 deraadt Exp $ */
+/* $OpenBSD: cal.c,v 1.30 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: cal.c,v 1.6 1995/03/26 03:10:24 glass Exp $ */
/*
int ch, month, year, yflag;
const char *errstr;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
yflag = year = 0;
while ((ch = getopt(argc, argv, "jmwy")) != -1)
-/* $OpenBSD: col.c,v 1.18 2015/10/05 06:04:18 deraadt Exp $ */
+/* $OpenBSD: col.c,v 1.19 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: col.c,v 1.7 1995/09/02 05:48:50 jtc Exp $ */
/*-
int adjust, opt, warned;
const char *errstr;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
max_bufd_lines = 256;
compress_spaces = 1; /* compress spaces into tabs */
-/* $OpenBSD: colrm.c,v 1.10 2015/10/05 13:30:30 deraadt Exp $ */
+/* $OpenBSD: colrm.c,v 1.11 2015/10/09 01:37:06 deraadt Exp $ */
/* $NetBSD: colrm.c,v 1.4 1995/09/02 05:51:37 jtc Exp $ */
/*-
int ch;
char *p;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1)
switch(ch) {
-/* $OpenBSD: column.c,v 1.20 2015/10/05 13:30:30 deraadt Exp $ */
+/* $OpenBSD: column.c,v 1.21 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */
/*
} else
termwidth = win.ws_col;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
tflag = xflag = 0;
while ((ch = getopt(argc, argv, "c:s:tx")) != -1)
}
}
}
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if (!entries)
exit(eval);
-/* $OpenBSD: comm.c,v 1.9 2015/10/05 13:30:30 deraadt Exp $ */
+/* $OpenBSD: comm.c,v 1.10 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: comm.c,v 1.10 1995/09/05 19:57:43 jtc Exp $ */
/*
setlocale(LC_ALL, "");
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
flag1 = flag2 = flag3 = 1;
compare = strcoll;
-/* $OpenBSD: main.c,v 1.88 2015/10/04 16:50:29 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.89 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
char outfile[PATH_MAX], _infile[PATH_MAX], suffix[16];
int bits, ch, error, rc, cflag, oflag;
- if (tame("stdio rpath wpath cpath fattr", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
+ err(1, "pledge");
bits = cflag = oflag = 0;
storename = -1;
-/* $OpenBSD: csplit.c,v 1.6 2015/10/07 03:50:10 deraadt Exp $ */
+/* $OpenBSD: csplit.c,v 1.7 2015/10/09 01:37:07 deraadt Exp $ */
/* $FreeBSD: src/usr.bin/csplit/csplit.c,v 1.9 2004/03/22 11:15:03 tjr Exp $ */
/*-
setlocale(LC_ALL, "");
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
kflag = sflag = 0;
prefix = "xx";
if (strcmp(infn, "-") == 0) {
infile = stdin;
infn = "stdin";
- if (tame("stdio wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio wpath cpath", NULL) == -1)
+ err(1, "pledge");
} else if ((infile = fopen(infn, "r")) == NULL)
err(1, "%s", infn);
-/* $OpenBSD: ctags.c,v 1.17 2015/10/07 06:33:31 deraadt Exp $ */
+/* $OpenBSD: ctags.c,v 1.18 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: ctags.c,v 1.4 1995/09/02 05:57:23 jtc Exp $ */
/*
int step; /* step through args */
int ch; /* getopts char */
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
aflag = uflag = NO;
while ((ch = getopt(argc, argv, "BFadf:tuwvx")) != -1)
-/* $OpenBSD: cut.c,v 1.20 2015/10/05 13:27:45 deraadt Exp $ */
+/* $OpenBSD: cut.c,v 1.21 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: cut.c,v 1.9 1995/09/02 05:59:23 jtc Exp $ */
/*
setlocale (LC_ALL, "");
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
dchar = '\t'; /* default delimiter is \t */
}
}
else {
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
fcn(stdin, "stdin");
}
exit(rval);
-/* $OpenBSD: dc.c,v 1.14 2015/10/03 18:39:13 deraadt Exp $ */
+/* $OpenBSD: dc.c,v 1.15 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
char *buf, *p;
struct stat st;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
if ((buf = strdup("")) == NULL)
err(1, NULL);
file = fopen(argv[0], "r");
if (file == NULL)
err(1, "cannot open file %s", argv[0]);
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if (fstat(fileno(file), &st) == -1)
err(1, "%s", argv[0]);
if (S_ISDIR(st.st_mode))
*/
return (0);
}
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
src_setstream(&src, stdin);
reset_bmachine(&src);
eval();
-/* $OpenBSD: deroff.c,v 1.12 2015/10/05 06:05:42 deraadt Exp $ */
+/* $OpenBSD: deroff.c,v 1.13 2015/10/09 01:37:07 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
int errflg = 0;
int kflag = NO;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
iflag = NO;
wordflag = NO;
-/* $OpenBSD: diff.c,v 1.62 2015/10/05 20:15:00 millert Exp $ */
+/* $OpenBSD: diff.c,v 1.63 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
argv += optind;
if (getenv("TMPDIR")) {
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio rpath tmppath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath tmppath", NULL) == -1)
+ err(1, "pledge");
}
/*
-/* $OpenBSD: diff3prog.c,v 1.16 2015/10/05 13:30:30 deraadt Exp $ */
+/* $OpenBSD: diff3prog.c,v 1.17 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
{
int ch, i, m, n;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
eflag = 0;
oflag = 0;
-/* $OpenBSD: dirname.c,v 1.14 2015/10/05 13:30:30 deraadt Exp $ */
+/* $OpenBSD: dirname.c,v 1.15 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
setlocale(LC_ALL, "");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1) {
switch (ch) {
-/* $OpenBSD: expand.c,v 1.13 2015/10/05 13:24:39 deraadt Exp $ */
+/* $OpenBSD: expand.c,v 1.14 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: expand.c,v 1.5 1995/09/02 06:19:46 jtc Exp $ */
/*
int c, column;
int n;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
/* handle obsolete syntax */
while (argc > 1 && argv[1][0] == '-' &&
%{
-/* $OpenBSD: fgen.l,v 1.11 2015/10/06 05:51:01 deraadt Exp $ */
+/* $OpenBSD: fgen.l,v 1.12 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: fgen.l,v 1.12 2001/06/13 10:46:05 wiz Exp $ */
/* FLEX input for FORTH input file scanner */
/*
char *hdrtype = "version1";
int i;
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
outf = 1; /* stdout */
myname = argv[0];
-/* $OpenBSD: file.c,v 1.51 2015/10/06 15:39:44 deraadt Exp $ */
+/* $OpenBSD: file.c,v 1.52 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
msg.error = errno;
} else {
/*
- * tame(2) doesn't let us pass directory file
+ * pledge(2) doesn't let us pass directory file
* descriptors around - but in fact we don't need them,
* so just don't open directories or symlinks (which
* could be to directories).
int i, idx;
size_t len, width = 0;
- if (tame("stdio getpw proc recvfd", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw proc recvfd", NULL) == -1)
+ err(1, "pledge");
if (geteuid() == 0) {
pw = getpwnam(FILE_USER);
err(1, "setresuid");
}
- if (tame("stdio recvfd", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio recvfd", NULL) == -1)
+ err(1, "pledge");
m = magic_load(magicfp, magicpath, cflag || Wflag);
if (cflag) {
-/* $OpenBSD: find.c,v 1.18 2015/10/05 15:25:16 deraadt Exp $ */
+/* $OpenBSD: find.c,v 1.19 2015/10/09 01:37:07 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
PLAN *p;
if (mayexecve == 0)
- if (tame("stdio getpw rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath", NULL) == -1)
+ err(1, "pledge");
rval = 0;
-/* $OpenBSD: finger.c,v 1.21 2015/10/03 02:09:33 deraadt Exp $ */
+/* $OpenBSD: finger.c,v 1.22 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
mflag++;
}
- if (tame("stdio getpw rpath inet", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath inet", NULL) == -1)
+ err(1, "pledge");
(void)time(&now);
setpassent(1);
* not selected. Force the -s BEFORE we get names so proper
* screening will be done.
*/
- if (tame("stdio getpw rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath", NULL) == -1)
+ err(1, "pledge");
if (!lflag)
sflag = 1; /* if -l not explicit, force -s */
loginlist();
goto net;
if (nettail == &nethead)
- if (tame("stdio getpw rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath", NULL) == -1)
+ err(1, "pledge");
/*
* traverse the list of possible login names and check the login name
-/* $OpenBSD: fmt.c,v 1.32 2015/10/05 06:21:15 deraadt Exp $ */
+/* $OpenBSD: fmt.c,v 1.33 2015/10/09 01:37:07 deraadt Exp $ */
/* Sensible version of fmt
*
(void)setlocale(LC_CTYPE, "");
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
/* 1. Grok parameters. */
while ((ch = getopt(argc, argv, "0123456789cd:hl:mnpst:w:")) != -1) {
while (argc-- > 0)
process_named_file(*argv++);
} else {
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
process_stream(stdin, "standard input");
}
-/* $OpenBSD: fold.c,v 1.16 2015/10/05 06:26:33 deraadt Exp $ */
+/* $OpenBSD: fold.c,v 1.17 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: fold.c,v 1.6 1995/09/01 01:42:44 jtc Exp $ */
/*-
unsigned int width;
const char *errstr;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
width = 0;
lastch = '\0';
width = DEFLINEWIDTH;
if (!*argv) {
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
fold(width);
} else {
for (; *argv; ++argv) {
-/* $OpenBSD: from.c,v 1.21 2015/10/07 06:51:50 deraadt Exp $ */
+/* $OpenBSD: from.c,v 1.22 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */
/*
}
argv += optind;
- if (tame("stdio rpath getpw", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
file = mail_spool(file, *argv);
if ((fp = fopen(file, "r")) == NULL) {
if (!fflag && errno == ENOENT)
exit(EXIT_SUCCESS);
err(1, "%s", file);
}
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
for (newline = 1; (linelen = getline(&line, &linesize, fp)) != -1;) {
if (*line == '\n') {
newline = 1;
-/* $OpenBSD: getopt.c,v 1.9 2015/10/07 06:39:16 deraadt Exp $ */
+/* $OpenBSD: getopt.c,v 1.10 2015/10/09 01:37:07 deraadt Exp $ */
/*
* This material, written by Henry Spencer, was released by him
int c;
int status = 0;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
optind = 2; /* Past the program name and the option letters. */
while ((c = getopt(argc, argv, argv[1])) != -1)
-/* $OpenBSD: grep.c,v 1.53 2015/10/03 05:36:34 deraadt Exp $ */
+/* $OpenBSD: grep.c,v 1.54 2015/10/09 01:37:07 deraadt Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
char **expr;
const char *errstr;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
SLIST_INIT(&patfilelh);
switch (__progname[0]) {
-/* $OpenBSD: head.c,v 1.19 2015/10/07 06:55:10 deraadt Exp $ */
+/* $OpenBSD: head.c,v 1.20 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 1980, 1987 Regents of the University of California.
char *p = NULL;
int status = 0;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
/* handle obsolete -number syntax */
if (argc > 1 && argv[1][0] == '-' &&
if (!firsttime)
exit(status);
fp = stdin;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
} else {
if ((fp = fopen(*argv, "r")) == NULL) {
warn("%s", *argv++);
-/* $OpenBSD: hexdump.c,v 1.18 2015/10/05 06:36:18 deraadt Exp $ */
+/* $OpenBSD: hexdump.c,v 1.19 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: hexdump.c,v 1.7 1997/10/19 02:34:06 lukem Exp $ */
/*
FS *tfs;
char *p;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
if (!(p = strrchr(argv[0], 'o')) || strcmp(p, "od"))
newsyntax(argc, &argv);
-/* $OpenBSD: htpasswd.c,v 1.12 2015/10/07 06:44:01 deraadt Exp $ */
+/* $OpenBSD: htpasswd.c,v 1.13 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
*
ssize_t linelen;
mode_t old_umask;
- if (tame("stdio rpath wpath cpath tmppath tty", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath tmppath tty", NULL) == -1)
+ err(1, "pledge");
while ((c = getopt(argc, argv, "I")) != -1) {
switch (c) {
-/* $OpenBSD: id.c,v 1.25 2015/10/05 06:43:31 deraadt Exp $ */
+/* $OpenBSD: id.c,v 1.26 2015/10/09 01:37:07 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
gid_t gid;
const char *opts;
- if (tame("stdio getpw", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw", NULL) == -1)
+ err(1, "pledge");
cflag = Gflag = gflag = nflag = pflag = rflag = uflag = 0;
-/* $OpenBSD: indent.c,v 1.28 2015/10/05 23:42:40 deraadt Exp $ */
+/* $OpenBSD: indent.c,v 1.29 2015/10/09 01:37:07 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
int last_else = 0; /* true iff last keyword was an else */
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
/*-----------------------------------------------*\
| INITIALIZATION |
-/* $OpenBSD: join.c,v 1.26 2015/10/07 04:00:45 deraadt Exp $ */
+/* $OpenBSD: join.c,v 1.27 2015/10/09 01:37:07 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
int aflag, ch, cval, vflag;
char *end;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
F1 = &input1;
F2 = &input2;
if (F1->fp == stdin && F2->fp == stdin)
errx(1, "only one input file may be stdin");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
F1->setusedc = 0;
F2->setusedc = 0;
-/* $OpenBSD: jot.c,v 1.25 2015/10/06 22:55:51 deraadt Exp $ */
+/* $OpenBSD: jot.c,v 1.26 2015/10/09 01:37:07 deraadt Exp $ */
/* $NetBSD: jot.c,v 1.3 1994/12/02 20:29:43 pk Exp $ */
/*-
int ch;
const char *errstr;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "rb:w:cs:np:")) != -1)
switch (ch) {
-/* $OpenBSD: kdump.c,v 1.112 2015/10/06 03:27:25 deraadt Exp $ */
+/* $OpenBSD: kdump.c,v 1.113 2015/10/09 01:37:08 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
if (argc > optind)
usage();
- if (tame("stdio getpw rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath", NULL) == -1)
+ err(1, "pledge");
m = malloc(size = 1025);
if (m == NULL)
if (!freopen(tracefile, "r", stdin))
err(1, "%s", tracefile);
- if (tame("stdio getpw", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw", NULL) == -1)
+ err(1, "pledge");
if (fread_tail(&ktr_header, sizeof(struct ktr_header), 1) == 0 ||
ktr_header.ktr_type != htobe32(KTR_START))
-/* $OpenBSD: ktrstruct.c,v 1.11 2015/10/03 23:52:30 guenther Exp $ */
+/* $OpenBSD: ktrstruct.c,v 1.12 2015/10/09 01:37:08 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
memcpy(cmsg, data, datalen);
ktrcmsghdr(cmsg, datalen);
free(cmsg);
- } else if (strcmp(name, "tamereq") == 0) {
- printf("tame request=");
- showbufc(basecol + sizeof("tame request=") - 1,
+ } else if (strcmp(name, "pledgereq") == 0) {
+ printf("pledge request=");
+ showbufc(basecol + sizeof("pledge request=") - 1,
(unsigned char *)data, datalen);
- } else if (strcmp(name, "tamepath") == 0) {
- printf("tame path=");
- showbufc(basecol + sizeof("tame path=") - 1,
+ } else if (strcmp(name, "pledgepath") == 0) {
+ printf("pledge path=");
+ showbufc(basecol + sizeof("pledge path=") - 1,
(unsigned char *)data, datalen);
} else {
printf("unknown structure %s\n", name);
-/* $OpenBSD: lam.c,v 1.18 2015/10/07 04:03:57 deraadt Exp $ */
+/* $OpenBSD: lam.c,v 1.19 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $ */
/*-
{
int i;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
/* Process arguments, set numfiles to file argument count. */
getargs(argc, argv);
-/* $OpenBSD: lastcomm.c,v 1.22 2015/10/07 14:05:07 deraadt Exp $ */
+/* $OpenBSD: lastcomm.c,v 1.23 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $ */
/*
int ch;
char *acctfile;
- if (tame("stdio rpath getpw", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
acctfile = _PATH_ACCT;
while ((ch = getopt(argc, argv, "f:")) != -1)
-/* $OpenBSD: leave.c,v 1.16 2015/10/03 05:13:23 deraadt Exp $ */
+/* $OpenBSD: leave.c,v 1.17 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: leave.c,v 1.4 1995/07/03 16:50:13 phil Exp $ */
/*
int plusnow = 0, twentyfour;
char buf[50];
- if (tame("stdio proc", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio proc", NULL) == -1)
+ err(1, "pledge");
if (setvbuf(stdout, NULL, _IOLBF, 0) != 0)
errx(1, "Cannot set stdout to line buffered.");
-/* $OpenBSD: lock.c,v 1.29 2015/10/07 04:05:24 deraadt Exp $ */
+/* $OpenBSD: lock.c,v 1.30 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: lock.c,v 1.8 1996/05/07 18:32:31 jtc Exp $ */
/*
usemine = 0;
no_timeout = 0;
- if (tame("stdio getpw rpath wpath tty", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath wpath tty", NULL) == -1)
+ err(1, "pledge");
if (!(pw = getpwuid(getuid())))
errx(1, "unknown uid %u.", getuid());
-/* $OpenBSD: logger.c,v 1.15 2015/10/05 23:59:11 deraadt Exp $ */
+/* $OpenBSD: logger.c,v 1.16 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: logger.c,v 1.4 1994/12/22 06:27:00 jtc Exp $ */
/*
openlog(tag ? tag : getlogin(), logflags, 0);
(void) fclose(stdout);
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
/* log input line if appropriate */
if (argc > 0) {
-/* $OpenBSD: logname.c,v 1.8 2015/10/07 14:06:26 deraadt Exp $ */
+/* $OpenBSD: logname.c,v 1.9 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: logname.c,v 1.6 1994/12/22 06:39:32 jtc Exp $ */
/*-
setlocale(LC_ALL, "");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
-/* $OpenBSD: look.c,v 1.17 2015/10/07 14:13:23 deraadt Exp $ */
+/* $OpenBSD: look.c,v 1.18 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: look.c,v 1.7 1995/08/31 22:41:02 jtc Exp $ */
/*-
int ch, fd, termchar;
char *back, *file, *front, *string, *p;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
file = _PATH_WORDS;
termchar = '\0';
-/* $OpenBSD: main.c,v 1.113 2015/10/08 14:49:27 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.114 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */
/*
#define OPTFLAGS "BC:D:I:SV:d:ef:ij:km:npqrst"
#define OPTLETTERS "BSiknpqrst"
- if (tame("stdio rpath wpath cpath proc exec", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1)
+ err(1, "pledge");
optind = 1; /* since we're called more than once */
optreset = 1;
-/* $OpenBSD: mktemp.c,v 1.21 2015/10/07 06:43:15 deraadt Exp $ */
+/* $OpenBSD: mktemp.c,v 1.22 2015/10/09 01:37:08 deraadt Exp $ */
/*
* Copyright (c) 1996, 1997, 2001-2003, 2013
char *cp, *template, *tempfile, *prefix = _PATH_TMP;
size_t len;
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "dp:qtu")) != -1)
switch(ch) {
-/* $OpenBSD: nl.c,v 1.5 2015/10/07 07:00:01 deraadt Exp $ */
+/* $OpenBSD: nl.c,v 1.6 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: nl.c,v 1.11 2011/08/16 12:00:46 christos Exp $ */
/*-
(void)setlocale(LC_ALL, "");
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((c = getopt(argc, argv, "pb:d:f:h:i:l:n:s:v:w:")) != -1) {
switch (c) {
-/* $OpenBSD: nm.c,v 1.48 2015/10/05 07:16:03 deraadt Exp $ */
+/* $OpenBSD: nm.c,v 1.49 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */
/*
if (demangle)
pipe2cppfilt();
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
argv += optind;
argc -= optind;
-/* $OpenBSD: openssl.c,v 1.14 2015/10/07 05:21:41 deraadt Exp $ */
+/* $OpenBSD: openssl.c,v 1.15 2015/10/09 01:37:08 deraadt Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
arg.data = NULL;
arg.count = 0;
- if (tame("stdio inet rpath cpath wpath proc", NULL) == -1) {
- fprintf(stderr, "openssl: tame: %s\n", strerror(errno));
+ if (pledge("stdio inet rpath cpath wpath proc", NULL) == -1) {
+ fprintf(stderr, "openssl: pledge: %s\n", strerror(errno));
exit(1);
}
-/* $OpenBSD: paste.c,v 1.20 2015/10/07 14:12:42 deraadt Exp $ */
+/* $OpenBSD: paste.c,v 1.21 2015/10/09 01:37:08 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
extern int optind;
int ch, seq;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
seq = 0;
while ((ch = getopt(argc, argv, "d:s")) != -1) {
-/* $OpenBSD: patch.c,v 1.58 2015/10/07 06:29:26 deraadt Exp $ */
+/* $OpenBSD: patch.c,v 1.59 2015/10/09 01:37:08 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
const char *tmpdir;
char *v;
- if (tame("stdio rpath wpath cpath tmppath fattr proc exec", NULL) == -1)
- perror("tame");
+ if (pledge("stdio rpath wpath cpath tmppath fattr proc exec", NULL) == -1)
+ perror("pledge");
setvbuf(stdout, NULL, _IOLBF, 0);
setvbuf(stderr, NULL, _IOLBF, 0);
-/* $OpenBSD: pr.c,v 1.37 2015/10/07 06:15:51 deraadt Exp $ */
+/* $OpenBSD: pr.c,v 1.38 2015/10/09 01:37:08 deraadt Exp $ */
/*-
* Copyright (c) 1991 Keith Muller.
{
int ret_val;
- if (tame("stdio rpath", NULL) == -1)
- perror("tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ perror("pledge");
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
(void)signal(SIGINT, terminate);
-/* $OpenBSD: printenv.c,v 1.7 2015/10/07 06:35:19 deraadt Exp $ */
+/* $OpenBSD: printenv.c,v 1.8 2015/10/09 01:37:08 deraadt Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
char *cp, **ep;
int len;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if (argc < 2) {
for (ep = environ; *ep; ep++)
-/* $OpenBSD: printf.c,v 1.23 2015/10/06 23:01:43 deraadt Exp $ */
+/* $OpenBSD: printf.c,v 1.24 2015/10/09 01:37:08 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
setlocale (LC_ALL, "");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
/* Need to accept/ignore "--" option. */
if (argc > 1 && strcmp(argv[1], "--") == 0) {
/*
- * $OpenBSD: readlink.c,v 1.26 2015/10/07 14:10:50 deraadt Exp $
+ * $OpenBSD: readlink.c,v 1.27 2015/10/09 01:37:08 deraadt Exp $
*
* Copyright (c) 1997
* Kenneth Stailey (hereinafter referred to as the author)
int n, ch, nflag = 0, fflag = 0;
extern int optind;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "fn")) != -1)
switch (ch) {
-/* $OpenBSD: rev.c,v 1.11 2015/10/07 06:18:00 deraadt Exp $ */
+/* $OpenBSD: rev.c,v 1.12 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: rev.c,v 1.5 1995/09/28 08:49:40 tls Exp $ */
/*-
size_t len;
int ch, rval;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1)
switch(ch) {
-/* $OpenBSD: rs.c,v 1.26 2015/10/06 03:26:31 deraadt Exp $ */
+/* $OpenBSD: rs.c,v 1.27 2015/10/09 01:37:08 deraadt Exp $ */
/*-
* Copyright (c) 1993
int
main(int argc, char *argv[])
{
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
getargs(argc, argv);
getfile();
-/* $OpenBSD: script.c,v 1.30 2015/10/07 05:08:27 deraadt Exp $ */
+/* $OpenBSD: script.c,v 1.31 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: script.c,v 1.3 1994/12/21 08:55:43 jtc Exp $ */
/*
sa.sa_handler = finish;
(void)sigaction(SIGCHLD, &sa, NULL);
- if (tame("stdio tty", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio tty", NULL) == -1)
+ err(1, "pledge");
(void)fclose(fscript);
while (1) {
sa.sa_handler = SIG_IGN;
(void)sigaction(SIGCHLD, &sa, NULL);
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
value.it_interval.tv_sec = 30;
value.it_interval.tv_usec = 0;
-/* $OpenBSD: main.c,v 1.25 2015/10/03 00:58:59 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.26 2015/10/09 01:37:08 deraadt Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
termwidth = 60;
if (inplace != NULL) {
- if (tame("stdio wpath rpath cpath fattr", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio wpath rpath cpath fattr", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio wpath rpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio wpath rpath cpath", NULL) == -1)
+ err(1, "pledge");
}
/* First usage case; script is the first arg */
-/* $OpenBSD: signify.c,v 1.101 2015/10/08 16:45:50 tedu Exp $ */
+/* $OpenBSD: signify.c,v 1.102 2015/10/09 01:37:08 deraadt Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
VERIFY
} verb = NONE;
- if (tame("stdio rpath wpath cpath tty", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath tty", NULL) == -1)
+ err(1, "pledge");
rounds = 42;
/* keep it all */
break;
case CHECK:
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
break;
case VERIFY:
if (embedded && (!msgfile || strcmp(msgfile, "-") != 0)) {
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
}
break;
default:
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
break;
}
-/* $OpenBSD: split.c,v 1.19 2015/10/07 14:37:11 deraadt Exp $ */
+/* $OpenBSD: split.c,v 1.20 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */
/*
char *ep, *p;
const char *errstr;
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "0123456789a:b:l:p:-")) != -1)
switch (ch) {
--- /dev/null
+/* $OpenBSD: sandbox-pledge.c,v 1.1 2015/10/09 01:37:08 deraadt Exp $ */
+/*
+ * Copyright (c) 2015 Theo de Raadt <deraadt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pwd.h>
+
+#include "log.h"
+#include "ssh-sandbox.h"
+#include "xmalloc.h"
+
+struct ssh_sandbox {
+ pid_t child_pid;
+};
+
+struct ssh_sandbox *
+ssh_sandbox_init(void)
+{
+ struct ssh_sandbox *box;
+
+ debug3("%s: preparing pledge sandbox", __func__);
+ box = xcalloc(1, sizeof(*box));
+ box->child_pid = 0;
+
+ return box;
+}
+
+void
+ssh_sandbox_child(struct ssh_sandbox *box)
+{
+ if (pledge("stdio", NULL) == -1)
+ fatal("%s: pledge()", __func__);
+}
+
+void
+ssh_sandbox_parent_finish(struct ssh_sandbox *box)
+{
+ free(box);
+ debug3("%s: finished", __func__);
+}
+
+void
+ssh_sandbox_parent_preauth(struct ssh_sandbox *box, pid_t child_pid)
+{
+ box->child_pid = child_pid;
+ /* Nothing to do here */
+}
+++ /dev/null
-/* $OpenBSD: sandbox-tame.c,v 1.2 2015/10/02 15:52:55 deraadt Exp $ */
-/*
- * Copyright (c) 2015 Theo de Raadt <deraadt@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/syscall.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <pwd.h>
-
-#include "log.h"
-#include "ssh-sandbox.h"
-#include "xmalloc.h"
-
-struct ssh_sandbox {
- pid_t child_pid;
-};
-
-struct ssh_sandbox *
-ssh_sandbox_init(void)
-{
- struct ssh_sandbox *box;
-
- debug3("%s: preparing tame sandbox", __func__);
- box = xcalloc(1, sizeof(*box));
- box->child_pid = 0;
-
- return box;
-}
-
-void
-ssh_sandbox_child(struct ssh_sandbox *box)
-{
- if (tame("stdio", NULL) == -1)
- fatal("%s: tame()", __func__);
-}
-
-void
-ssh_sandbox_parent_finish(struct ssh_sandbox *box)
-{
- free(box);
- debug3("%s: finished", __func__);
-}
-
-void
-ssh_sandbox_parent_preauth(struct ssh_sandbox *box, pid_t child_pid)
-{
- box->child_pid = child_pid;
- /* Nothing to do here */
-}
-# $OpenBSD: Makefile,v 1.86 2015/10/03 02:37:30 deraadt Exp $
+# $OpenBSD: Makefile,v 1.87 2015/10/09 01:37:08 deraadt Exp $
.PATH: ${.CURDIR}/..
.include "${.CURDIR}/../Makefile.inc"
auth2-none.c auth2-passwd.c auth2-pubkey.c \
monitor_mm.c monitor.c monitor_wrap.c \
sftp-server.c sftp-common.c \
- roaming_common.c roaming_serv.c sandbox-tame.c
+ roaming_common.c roaming_serv.c sandbox-pledge.c
.if (${SSH1:L} == "yes")
SRCS+= auth-rsa.c auth-rh-rsa.c auth1.c
-/* $OpenBSD: stat.c,v 1.19 2015/10/06 00:24:20 deraadt Exp $ */
+/* $OpenBSD: stat.c,v 1.20 2015/10/09 01:37:08 deraadt Exp $ */
/* $NetBSD: stat.c,v 1.19 2004/06/20 22:20:16 jmc Exp $ */
/*
int lsF, fmtchar, usestat, fn, nonl, quiet;
char *statfmt, *options, *synopsis;
- if (tame("stdio getpw rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath", NULL) == -1)
+ err(1, "pledge");
lsF = 0;
fmtchar = '\0';
-/* $OpenBSD: tail.c,v 1.18 2015/10/07 03:49:41 deraadt Exp $ */
+/* $OpenBSD: tail.c,v 1.19 2015/10/09 01:37:09 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
int ch, first;
char *p;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
/*
* Tail's options are weird. First, -n10 is the same as -n-10, not
(void)fclose(fp);
}
else {
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
fname = "stdin";
is_stdin = 1;
-/* $OpenBSD: tee.c,v 1.9 2015/10/07 14:34:34 deraadt Exp $ */
+/* $OpenBSD: tee.c,v 1.10 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: tee.c,v 1.5 1994/12/09 01:43:39 jtc Exp $ */
/*
setlocale(LC_ALL, "");
- if (tame("stdio wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio wpath cpath", NULL) == -1)
+ err(1, "pledge");
append = 0;
while ((ch = getopt(argc, argv, "ai")) != -1) {
argv++;
}
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while ((rval = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {
for (p = head; p; p = p->next) {
-/* $OpenBSD: main.c,v 1.36 2015/10/07 14:36:07 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.37 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */
/*
{
f = -1;
- if (tame("stdio inet rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio inet rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
/* set default transfer mode */
strlcpy(mode, "netascii", sizeof(mode));
-/* $OpenBSD: touch.c,v 1.24 2015/10/06 13:48:34 deraadt Exp $ */
+/* $OpenBSD: touch.c,v 1.25 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: touch.c,v 1.11 1995/08/31 22:10:06 jtc Exp $ */
/*
(void)setlocale(LC_ALL, "");
- if (tame("stdio rpath wpath cpath fattr", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
+ err(1, "pledge");
aflag = cflag = mflag = timeset = 0;
while ((ch = getopt(argc, argv, "acd:fmr:t:")) != -1)
-/* $OpenBSD: tr.c,v 1.18 2015/10/06 13:49:33 deraadt Exp $ */
+/* $OpenBSD: tr.c,v 1.19 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: tr.c,v 1.5 1995/08/31 22:13:48 jtc Exp $ */
/*
int ch, cnt, lastch, *p;
int cflag, dflag, sflag, isstring2;
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
cflag = dflag = sflag = 0;
while ((ch = getopt(argc, argv, "Ccds")) != -1)
-/* $OpenBSD: tty.c,v 1.8 2015/10/07 18:00:06 deraadt Exp $ */
+/* $OpenBSD: tty.c,v 1.9 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: tty.c,v 1.4 1994/12/07 00:46:57 jtc Exp $ */
/*
int ch, sflag;
char *t;
- if (tame("stdio rpath tty", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath tty", NULL) == -1)
+ err(1, "pledge");
sflag = 0;
while ((ch = getopt(argc, argv, "s")) != -1) {
-/* $OpenBSD: uname.c,v 1.15 2015/10/03 12:41:16 deraadt Exp $ */
+/* $OpenBSD: uname.c,v 1.16 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 1994 Winning Strategies, Inc.
setlocale(LC_ALL, "");
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
while ((c = getopt(argc, argv, "amnrsvp")) != -1 ) {
switch (c) {
const char *errstr;
int opt;
- if (tame("stdio rpath wpath cpath fattr", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
+ err(1, "pledge");
while ((opt = getopt(argc, argv, "i:D:U:f:I:M:o:x:bBcdehKklmnsStV")) != -1)
switch (opt) {
-/* $OpenBSD: uniq.c,v 1.21 2015/10/04 04:56:50 deraadt Exp $ */
+/* $OpenBSD: uniq.c,v 1.22 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: uniq.c,v 1.7 1995/08/31 22:03:48 jtc Exp $ */
/*
int ch;
char *prevline, *thisline;
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
obsolete(argv);
while ((ch = getopt(argc, argv, "cdf:s:u")) != -1) {
usage();
}
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
prevline = malloc(MAXLINELEN);
thisline = malloc(MAXLINELEN);
-/* $OpenBSD: units.c,v 1.21 2015/10/06 13:29:56 deraadt Exp $ */
+/* $OpenBSD: units.c,v 1.22 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: units.c,v 1.6 1996/04/06 06:01:03 thorpej Exp $ */
/*
extern char *optarg;
extern int optind;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((optchar = getopt(argc, argv, "vqf:")) != -1) {
switch (optchar) {
readunits(userfile);
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if (argc == 3) {
strlcpy(havestr, argv[0], sizeof(havestr));
-/* $OpenBSD: unvis.c,v 1.13 2015/10/06 22:58:24 deraadt Exp $ */
+/* $OpenBSD: unvis.c,v 1.14 2015/10/09 01:37:09 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
FILE *fp;
int ch;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1)
switch(ch) {
argv++;
}
else {
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
process(stdin, "<stdin>");
}
-/* $OpenBSD: users.c,v 1.12 2015/10/07 14:35:19 deraadt Exp $ */
+/* $OpenBSD: users.c,v 1.13 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: users.c,v 1.5 1994/12/20 15:58:19 jtc Exp $ */
/*
struct utmp utmp;
int ch;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1)
switch(ch) {
-/* $OpenBSD: uudecode.c,v 1.21 2015/10/07 06:00:33 deraadt Exp $ */
+/* $OpenBSD: uudecode.c,v 1.22 2015/10/09 01:37:09 deraadt Exp $ */
/* $FreeBSD: uudecode.c,v 1.49 2003/05/03 19:44:46 obrien Exp $ */
/*-
argv += optind;
if (oflag || pflag == 0) {
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
}
if (*argv) {
-/* $OpenBSD: uuencode.c,v 1.12 2015/10/07 06:00:33 deraadt Exp $ */
+/* $OpenBSD: uuencode.c,v 1.13 2015/10/09 01:37:09 deraadt Exp $ */
/* $FreeBSD: uuencode.c,v 1.18 2004/01/22 07:23:35 grehan Exp $ */
/*-
argc -= optind;
if (argc == 2 || outfile) {
- if (tame("stdio rpath wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
}
switch(argc) {
-/* $OpenBSD: vis.c,v 1.18 2015/10/05 06:59:18 deraadt Exp $ */
+/* $OpenBSD: vis.c,v 1.19 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: vis.c,v 1.4 1994/12/20 16:13:03 jtc Exp $ */
/*-
FILE *fp;
int ch;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "anwctsobfF:ld")) != -1)
switch(ch) {
argv++;
}
else {
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
process(stdin);
}
exit(0);
-/* $OpenBSD: wc.c,v 1.18 2015/10/03 14:39:25 deraadt Exp $ */
+/* $OpenBSD: wc.c,v 1.19 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 1980, 1987, 1991, 1993
setlocale(LC_ALL, "");
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
while ((ch = getopt(argc, argv, "lwchm")) != -1)
switch(ch) {
-/* $OpenBSD: what.c,v 1.14 2015/10/06 13:47:08 deraadt Exp $ */
+/* $OpenBSD: what.c,v 1.15 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: what.c,v 1.4 1994/12/20 16:01:03 jtc Exp $ */
/*
char match[256];
int c;
- if (tame("stdio rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
matches = sflag = 0;
while ((c = getopt(argc, argv, "s")) != -1) {
-/* $OpenBSD: who.c,v 1.22 2015/10/07 17:27:35 semarie Exp $ */
+/* $OpenBSD: who.c,v 1.23 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
setlocale(LC_ALL, "");
- if (tame("stdio getpw rpath tty", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath tty", NULL) == -1)
+ err(1, "pledge");
mytty = ttyname(0);
/* strip any directory component */
/* NOTREACHED */
}
if (show_term || show_idle) {
- if (tame("stdio getpw rpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw rpath", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio getpw", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio getpw", NULL) == -1)
+ err(1, "pledge");
}
return(ufp);
}
-/* $OpenBSD: whois.c,v 1.49 2015/10/03 01:33:20 deraadt Exp $ */
+/* $OpenBSD: whois.c,v 1.50 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
if (!argc || (country != NULL && host != NULL))
usage();
- if (tame("stdio dns inet", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio dns inet", NULL) == -1)
+ err(1, "pledge");
if (host == NULL && country == NULL && !(flags & WHOIS_QUICK))
flags |= WHOIS_RECURSE;
-/* $OpenBSD: write.c,v 1.30 2015/10/06 03:25:02 deraadt Exp $ */
+/* $OpenBSD: write.c,v 1.31 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
/*
* Unfortunately this is rather late - well after utmp
* parsing, then pinned by the tty open and setresgid
*/
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
(void)signal(SIGINT, done);
(void)signal(SIGHUP, done);
-/* $OpenBSD: acpidump.c,v 1.14 2015/10/04 08:31:01 jmc Exp $ */
+/* $OpenBSD: acpidump.c,v 1.15 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
* All rights reserved.
acpi_user_init();
- if (tame("stdio wpath cpath", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio wpath cpath", NULL) == -1)
+ err(1, "pledge");
rp = acpi_find_rsd_ptr();
if (!rp)
-/* $OpenBSD: arp.c,v 1.67 2015/10/07 20:25:40 deraadt Exp $ */
+/* $OpenBSD: arp.c,v 1.68 2015/10/09 01:37:09 deraadt Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
if (setsockopt(s, PF_ROUTE, ROUTE_TABLEFILTER, &rdomain, len) < 0)
err(1, "ROUTE_TABLEFILTER");
- if (tame("stdio dns", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio dns", NULL) == -1)
+ err(1, "pledge");
}
struct sockaddr_in so_mask = { 8, 0, 0, { 0xffffffff } };
struct sockaddr_inarp *sin;
struct sockaddr_dl *sdl;
- if (tame("stdio dns route", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio dns route", NULL) == -1)
+ err(1, "pledge");
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
-/* $OpenBSD: rde.c,v 1.340 2015/10/07 20:26:16 deraadt Exp $ */
+/* $OpenBSD: rde.c,v 1.341 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid))
fatal("can't drop privileges");
- if (tame("stdio unix route recvfd", NULL) == -1)
- fatal("tame");
+ if (pledge("stdio unix route recvfd", NULL) == -1)
+ fatal("pledge");
signal(SIGTERM, rde_sighdlr);
signal(SIGINT, rde_sighdlr);
-/* $OpenBSD: session.c,v 1.343 2015/10/07 20:25:22 deraadt Exp $ */
+/* $OpenBSD: session.c,v 1.344 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid))
fatal("can't drop privileges");
- if (tame("stdio inet recvfd", NULL) == -1)
- fatal("tame");
+ if (pledge("stdio inet recvfd", NULL) == -1)
+ fatal("pledge");
signal(SIGTERM, session_sighdlr);
signal(SIGINT, session_sighdlr);
-/* $OpenBSD: ntp_dns.c,v 1.11 2015/10/03 02:48:54 deraadt Exp $ */
+/* $OpenBSD: ntp_dns.c,v 1.12 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
fatal(NULL);
imsg_init(ibuf_dns, pipe_ntp[1]);
- if (tame("dns rw", NULL) == -1)
- err(1, "tame");
+ if (pledge("dns rw", NULL) == -1)
+ err(1, "pledge");
while (quit_dns == 0) {
pfd[0].fd = ibuf_dns->fd;
-/* $OpenBSD: ntpd.c,v 1.95 2015/10/03 02:47:15 deraadt Exp $ */
+/* $OpenBSD: ntpd.c,v 1.96 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1)
err(1, "connect: %s", sockname);
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if ((ibuf_ctl = malloc(sizeof(struct imsgbuf))) == NULL)
err(1, NULL);
-/* $OpenBSD: portmap.c,v 1.46 2015/10/08 14:02:09 deraadt Exp $ */
+/* $OpenBSD: portmap.c,v 1.47 2015/10/09 01:37:09 deraadt Exp $ */
/*-
* Copyright (c) 1996, 1997 Theo de Raadt (OpenBSD). All rights reserved.
}
endpwent();
- if (tame("stdio rpath inet proc", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath inet proc", NULL) == -1)
+ err(1, "pledge");
if (svc_register(xprt, PMAPPROG, PMAPVERS, reg_service, FALSE) == 0) {
syslog(LOG_ERR, "svc_register failed.");
return;
}
- if (tame("stdio rpath inet", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath inet", NULL) == -1)
+ err(1, "pledge");
port = pml->pml_map.pm_port;
get_myaddress(&me);
-/* $OpenBSD: privsep.c,v 1.37 2015/10/06 15:39:44 deraadt Exp $ */
+/* $OpenBSD: privsep.c,v 1.38 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
case PRIV_INIT_DONE:
test_state(cmd, STATE_RUN);
impl_init_done(socks[0], &bpfd);
- if (tame("stdio rpath inet unix ioctl dns recvfd", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio rpath inet unix ioctl dns recvfd", NULL) == -1)
+ err(1, "pledge");
break;
case PRIV_GETHOSTBYADDR:
test_state(cmd, STATE_RUN);
-/* $OpenBSD: tcpdump.c,v 1.73 2015/10/03 00:51:08 deraadt Exp $ */
+/* $OpenBSD: tcpdump.c,v 1.74 2015/10/09 01:37:09 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
if (tflag > 0)
thiszone = gmt2local(0);
- if (tame("stdio", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
if (pcap_loop(pd, cnt, printer, pcap_userdata) < 0) {
(void)fprintf(stderr, "%s: pcap_loop: %s\n",
-/* $OpenBSD: traceroute.c,v 1.142 2015/10/03 02:22:38 deraadt Exp $ */
+/* $OpenBSD: traceroute.c,v 1.143 2015/10/09 01:37:10 deraadt Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
err(6, "SO_SNDBUF");
if (nflag) {
- if (tame("stdio inet", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio inet", NULL) == -1)
+ err(1, "pledge");
} else {
- if (tame("stdio inet dns", NULL) == -1)
- err(1, "tame");
+ if (pledge("stdio inet dns", NULL) == -1)
+ err(1, "pledge");
}
if (getnameinfo(to, to->sa_len, hbuf,