summaryrefslogtreecommitdiff
path: root/usr.sbin/unwindctl/unwindctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/unwindctl/unwindctl.c')
-rw-r--r--usr.sbin/unwindctl/unwindctl.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/unwindctl/unwindctl.c b/usr.sbin/unwindctl/unwindctl.c
index 7ffc86f42fe..21146b84767 100644
--- a/usr.sbin/unwindctl/unwindctl.c
+++ b/usr.sbin/unwindctl/unwindctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwindctl.c,v 1.2 2019/01/27 12:41:39 florian Exp $ */
+/* $OpenBSD: unwindctl.c,v 1.3 2019/01/31 13:36:42 solene Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -108,6 +108,19 @@ main(int argc, char *argv[])
imsg_init(ibuf, ctl_sock);
done = 0;
+ /* Check for root-only actions */
+ switch (res->action) {
+ case LOG_DEBUG:
+ case LOG_VERBOSE:
+ case LOG_BRIEF:
+ case RELOAD:
+ if (geteuid() != 0)
+ errx(1, "need root privileges");
+ break;
+ default:
+ break;
+ }
+
/* Process user request. */
switch (res->action) {
case LOG_DEBUG: