summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2021-01-13 13:49:34 +0000
committerkn <kn@openbsd.org>2021-01-13 13:49:34 +0000
commit0fe80eca407ec09c2db7cdbe251a5113f36e8315 (patch)
treede77f8c00a69e88f95b541355aa2c069609de7d0
parentConvert mbuf type KDASSERT() to a proper KASSERT() in m_get(9). (diff)
downloadwireguard-openbsd-0fe80eca407ec09c2db7cdbe251a5113f36e8315.tar.xz
wireguard-openbsd-0fe80eca407ec09c2db7cdbe251a5113f36e8315.zip
Pledge the "-C" code path
In "Parse and check config" mode nothing is executed so pledge without "exec" while still setuid and before reading/parsing the config file. OK millert
-rw-r--r--usr.bin/doas/doas.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/doas/doas.c b/usr.bin/doas/doas.c
index 537c910fa3b..0054f170bbb 100644
--- a/usr.bin/doas/doas.c
+++ b/usr.bin/doas/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.84 2020/10/09 07:43:38 kn Exp $ */
+/* $OpenBSD: doas.c,v 1.85 2021/01/13 13:49:34 kn Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -183,6 +183,8 @@ checkconfig(const char *confpath, int argc, char **argv,
const struct rule *rule;
setresuid(uid, uid, uid);
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
parseconfig(confpath, 0);
if (!argc)
exit(0);
@@ -373,6 +375,8 @@ main(int argc, char **argv)
}
if (confpath) {
+ if (pledge("stdio rpath getpw id", NULL) == -1)
+ err(1, "pledge");
checkconfig(confpath, argc, argv, uid, groups, ngroups,
target);
exit(1); /* fail safe */