summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd/snmpe.c
diff options
context:
space:
mode:
authorRicardo Mestre <mestre@cvs.openbsd.org>2018-11-05 11:59:06 +0000
committerRicardo Mestre <mestre@cvs.openbsd.org>2018-11-05 11:59:06 +0000
commit38bc9243f25d37d67b5d21ac8bcfb8f033a0908f (patch)
treeb1f17c8d003d86a96b1704f502ea2f7c882761d7 /usr.sbin/snmpd/snmpe.c
parentc29a48c4e2d506c6c62391ab6288cd5290a4af5d (diff)
snmpd(8)'s main process needs to open the config file and /dev/pf both with
read permissions, but once it reaches pledge(2) just before the main loop both were already opened. Since snmpd(8) doesn't have a way to load or reload the config file, not even through SIGHUP, then rpath promise is not needed. The snmpe process cannot yet be pledged, but it doesn't need fs access so we can disable the access through unveil("/", ""); unveil(NULL, NULL); "looks right" to deraadt@
Diffstat (limited to 'usr.sbin/snmpd/snmpe.c')
-rw-r--r--usr.sbin/snmpd/snmpe.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c
index 97503f46a12..0b0d39c8ea6 100644
--- a/usr.sbin/snmpd/snmpe.c
+++ b/usr.sbin/snmpd/snmpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpe.c,v 1.54 2018/07/31 11:01:29 claudio Exp $ */
+/* $OpenBSD: snmpe.c,v 1.55 2018/11/05 11:59:05 mestre Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -120,6 +120,10 @@ snmpe_init(struct privsep *ps, struct privsep_proc *p, void *arg)
event_add(&so->s_ev, NULL);
}
+ if (unveil("/", "") == -1)
+ fatal("unveil");
+ if (unveil(NULL, NULL) == -1)
+ fatal("unveil");
#if 0
/*
* XXX Refactoring required to move illegal ioctls and sysctls.