summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/vmd.c
diff options
context:
space:
mode:
authorpd <pd@cvs.openbsd.org>2018-05-13 22:48:12 +0000
committerpd <pd@cvs.openbsd.org>2018-05-13 22:48:12 +0000
commit6088021ac5721746a8d7806269dbc61ef51fa852 (patch)
treedc8f8c6b53d5a0541379e57f1ff7aba9f9b61866 /usr.sbin/vmd/vmd.c
parent4f451b5516ec6be556dc3a675ba509b867cf661d (diff)
vmd(8): enable pause / unpause for vm owners
Patch from Mohamed Aslan. Thanks! ok kn@
Diffstat (limited to 'usr.sbin/vmd/vmd.c')
-rw-r--r--usr.sbin/vmd/vmd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 0eea5d8e4d5..0aa3424208d 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.84 2018/04/25 15:49:48 mlarkin Exp $ */
+/* $OpenBSD: vmd.c,v 1.85 2018/05/13 22:48:11 pd Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -186,11 +186,16 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
} else {
vid.vid_id = vm->vm_vmid;
}
- } else if (vm_getbyid(vid.vid_id) == NULL) {
+ } else if ((vm = vm_getbyid(vid.vid_id)) == NULL) {
res = ENOENT;
cmd = IMSG_VMDOP_PAUSE_VM_RESPONSE;
break;
}
+ if (vm_checkperm(vm, vid.vid_uid) != 0) {
+ res = EPERM;
+ cmd = IMSG_VMDOP_PAUSE_VM_RESPONSE;
+ break;
+ }
proc_compose_imsg(ps, PROC_VMM, -1, imsg->hdr.type,
imsg->hdr.peerid, -1, &vid, sizeof(vid));
break;