summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2017-11-07 07:37:43 +0000
committermlarkin <mlarkin@openbsd.org>2017-11-07 07:37:43 +0000
commit60e6641db039884244a794afba93ceed93062751 (patch)
tree560d14d694886a906f874e325504a146fa54d505
parentdocument how ospfd interacts with carp (diff)
downloadwireguard-openbsd-60e6641db039884244a794afba93ceed93062751.tar.xz
wireguard-openbsd-60e6641db039884244a794afba93ceed93062751.zip
comment function vm_checkperm
-rw-r--r--usr.sbin/vmd/vmd.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 9e90c63cc99..c2b70b99846 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.71 2017/10/24 07:51:46 mlarkin Exp $ */
+/* $OpenBSD: vmd.c,v 1.72 2017/11/07 07:37:43 mlarkin Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1217,6 +1217,21 @@ vm_register(struct privsep *ps, struct vmop_create_params *vmc,
return (-1);
}
+/*
+ * vm_checkperm
+ *
+ * Checks if the user represented by the 'uid' parameter is allowed to
+ * manipulate the VM described by the 'vm' parameter (or connect to said VM's
+ * console.
+ *
+ * Parameters:
+ * vm: the VM whose permission is to be checked
+ * uid: the user ID of the user making the request
+ *
+ * Return values:
+ * 0: the permission should be granted
+ * -1: the permission check failed (also returned if vm == null)
+ */
int
vm_checkperm(struct vmd_vm *vm, uid_t uid)
{