summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/control.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2017-05-04 16:54:42 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2017-05-04 16:54:42 +0000
commit8f30999a489969e5c15663adf9d1c3f83f7ae21c (patch)
tree3e68e885736e8e1ea4764286371fe34074eab33b /usr.sbin/vmd/control.c
parent0205ae46fbf09e7a391640d5124f603b367aaf11 (diff)
Report error for vmctl commands that need root privileges.
specifically: vmctl (load|reload|reset|log) Reported by Christian Barthel
Diffstat (limited to 'usr.sbin/vmd/control.c')
-rw-r--r--usr.sbin/vmd/control.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/vmd/control.c b/usr.sbin/vmd/control.c
index cb890ca6826..d67b19001ed 100644
--- a/usr.sbin/vmd/control.c
+++ b/usr.sbin/vmd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.17 2017/04/21 07:03:26 reyk Exp $ */
+/* $OpenBSD: control.c,v 1.18 2017/05/04 16:54:41 reyk Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
@@ -363,7 +363,15 @@ control_dispatch_imsg(int fd, short event, void *arg)
memcpy(&v, imsg.data, sizeof(v));
log_setverbose(v);
+ /* FALLTHROUGH */
+ case IMSG_VMDOP_LOAD:
+ case IMSG_VMDOP_RELOAD:
+ case IMSG_CTL_RESET:
proc_forward_imsg(ps, &imsg, PROC_PARENT, -1);
+
+ /* Report success to the control client */
+ imsg_compose_event(&c->iev, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
break;
case IMSG_VMDOP_START_VM_REQUEST:
if (IMSG_DATA_SIZE(&imsg) < sizeof(vmc))
@@ -399,11 +407,6 @@ control_dispatch_imsg(int fd, short event, void *arg)
return;
}
break;
- case IMSG_VMDOP_LOAD:
- case IMSG_VMDOP_RELOAD:
- case IMSG_CTL_RESET:
- proc_forward_imsg(ps, &imsg, PROC_PARENT, -1);
- break;
default:
log_debug("%s: error handling imsg %d",
__func__, imsg.hdr.type);