diff options
author | 2015-12-08 23:59:39 +0000 | |
---|---|---|
committer | 2015-12-08 23:59:39 +0000 | |
commit | 8ac71cd40ddbca257b3d863738648f388fc56912 (patch) | |
tree | 480c722ff88d48d1ea43593da72fcf2bd37baa04 | |
parent | make the -f option work as intended (diff) | |
download | wireguard-openbsd-8ac71cd40ddbca257b3d863738648f388fc56912.tar.xz wireguard-openbsd-8ac71cd40ddbca257b3d863738648f388fc56912.zip |
when checking the config file with -n don't open /dev/vmm or require root
ok reyk@
-rw-r--r-- | usr.sbin/vmd/vmd.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c index d6a4cef50bc..dff1b659a94 100644 --- a/usr.sbin/vmd/vmd.c +++ b/usr.sbin/vmd/vmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.c,v 1.23 2015/12/08 23:47:59 jsg Exp $ */ +/* $OpenBSD: vmd.c,v 1.24 2015/12/08 23:59:39 jsg Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -299,8 +299,10 @@ main(int argc, char **argv) env->vmd_debug = 1; /* check for root privileges */ - if (geteuid()) - fatalx("need root privileges"); + if (env->vmd_noaction == 0) { + if (geteuid()) + fatalx("need root privileges"); + } ps = &env->vmd_ps; ps->ps_env = env; @@ -316,9 +318,11 @@ main(int argc, char **argv) TAILQ_INIT(&ps->ps_rcsocks); /* Open /dev/vmm */ - env->vmd_fd = open(VMM_NODE, O_RDWR); - if (env->vmd_fd == -1) - fatal("%s", VMM_NODE); + if (env->vmd_noaction == 0) { + env->vmd_fd = open(VMM_NODE, O_RDWR); + if (env->vmd_fd == -1) + fatal("%s", VMM_NODE); + } /* Configuration will be parsed after forking the children */ env->vmd_conffile = conffile; |