diff options
author | rob <rob@cvs.openbsd.org> | 2017-08-10 16:03:11 +0000 |
---|---|---|
committer | rob <rob@cvs.openbsd.org> | 2017-08-10 16:03:11 +0000 |
commit | 6c059cfe438aa3aadca1b91720d9b94b558a5c7a (patch) | |
tree | 637a9c10c299338a28e1c94b6c8e929760dce031 /usr.sbin/snmpctl | |
parent | effcd0ddc20d920e45dca518c1d95ee8349c98ae (diff) |
Pledge snmpctl. Ok jca@, tb@
Diffstat (limited to 'usr.sbin/snmpctl')
-rw-r--r-- | usr.sbin/snmpctl/snmpclient.c | 5 | ||||
-rw-r--r-- | usr.sbin/snmpctl/snmpctl.c | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/snmpctl/snmpclient.c b/usr.sbin/snmpctl/snmpclient.c index b62128fa99f..5f6a08be9f9 100644 --- a/usr.sbin/snmpctl/snmpclient.c +++ b/usr.sbin/snmpctl/snmpclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpclient.c,v 1.13 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: snmpclient.c,v 1.14 2017/08/10 16:03:10 rob Exp $ */ /* * Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org> @@ -160,6 +160,9 @@ snmpclient(struct parse_result *res) #endif } + if (pledge("stdio dns", NULL) == -1) + fatal("pledge"); + sc.sc_fd = s; sc.sc_community = res->community; sc.sc_version = res->version; diff --git a/usr.sbin/snmpctl/snmpctl.c b/usr.sbin/snmpctl/snmpctl.c index 08bd69a714d..39c5aee3f9c 100644 --- a/usr.sbin/snmpctl/snmpctl.c +++ b/usr.sbin/snmpctl/snmpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpctl.c,v 1.22 2016/10/28 20:49:32 natano Exp $ */ +/* $OpenBSD: snmpctl.c,v 1.23 2017/08/10 16:03:10 rob Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org> @@ -123,6 +123,8 @@ main(int argc, char *argv[]) usage(); break; case SHOW_MIB: + if (pledge("stdio", NULL) == -1) + fatal("pledge"); show_mib(); break; case WALK: @@ -138,6 +140,9 @@ main(int argc, char *argv[]) return (0); connect: + if (pledge("stdio unix", NULL) == -1) + fatal("pledge"); + /* connect to snmpd control socket */ if ((ctl_sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) err(1, "socket"); @@ -156,6 +161,9 @@ main(int argc, char *argv[]) err(1, "connect: %s", sock); } + if (pledge("stdio", NULL) == -1) + fatal("pledge"); + imsg_init(&ibuf, ctl_sock); done = 0; |