summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2018-05-22 06:58:58 +0000
committeranton <anton@cvs.openbsd.org>2018-05-22 06:58:58 +0000
commit5e9862c12ac9542c5e346abf53a9111d1cef696d (patch)
treeb6158d74a510daced9285191ddf1144dc2c1c57b
parent9f71741a59c606fe5ce3be2cc0063a6760688f01 (diff)
pledge rebounds-ns
-rw-r--r--regress/usr.sbin/rebound/rebound-ns.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/regress/usr.sbin/rebound/rebound-ns.c b/regress/usr.sbin/rebound/rebound-ns.c
index 4cca4dbb970..8f62bc91a27 100644
--- a/regress/usr.sbin/rebound/rebound-ns.c
+++ b/regress/usr.sbin/rebound/rebound-ns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rebound-ns.c,v 1.1 2018/05/09 19:34:53 anton Exp $ */
+/* $OpenBSD: rebound-ns.c,v 1.2 2018/05/22 06:58:57 anton Exp $ */
/*
* Copyright (c) 2018 Anton Lindqvist <anton@openbsd.org>
*
@@ -75,6 +75,9 @@ main(int argc, char *argv[])
size_t nrecords = 0;
int c, fd;
+ if (pledge("stdio inet dns proc", NULL) == -1)
+ err(1, "pledge");
+
while ((c = getopt(argc, argv, "l:")) != -1)
switch (c) {
case 'l':
@@ -107,9 +110,12 @@ main(int argc, char *argv[])
if (bind(fd, &bindaddr.a, bindaddr.a.sa_len) == -1)
err(1, "bind");
- if (daemon(0, 1) == -1)
+ if (daemon(1, 1) == -1)
err(1, "daemon");
+ if (pledge("stdio inet", NULL) == -1)
+ err(1, "pledge");
+
req.u8 = recvbuf;
for (;;) {
fromlen = sizeof(fromaddr.a);