opendoas

A portable version of the OpenBSD `doas` command
git clone https://pi.duncano.de/git/opendoas.git
Log | Files | Refs | README | LICENSE

commit a2614ebbd28ea611e48596589f90c87ab60bf4d2
parent fec01c17ec1cde1df449f76e5bda10e7afae2e05
Author: Vadim Zhukov <zhuk@openbsd.org>
Date:   Wed, 22 Jul 2015 16:35:03 +0000

Small tweaks:

 - whitespace on empty line;
 - use getuid() consistently.

okay tedu@

Diffstat:
doas.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/doas.c b/doas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doas.c,v 1.18 2015/07/21 17:49:33 jmc Exp $ */ +/* $OpenBSD: doas.c,v 1.19 2015/07/22 05:37:23 deraadt Exp $ */ /* * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> * @@ -214,7 +214,7 @@ copyenv(const char **oldenvp, struct rule *rule) int ei; int nsafe, nbad; int nextras = 0; - + nbad = arraylen(badset); if ((rule->options & KEEPENV) && !rule->envlist) { size_t i, ii; @@ -294,11 +294,11 @@ main(int argc, char **argv, char **envp) int i, ch; int sflag = 0; + uid = getuid(); while ((ch = getopt(argc, argv, "C:su:")) != -1) { switch (ch) { case 'C': - target = getuid(); - setresuid(target, target, target); + setresuid(uid, uid, uid); parseconfig(optarg); exit(0); case 'u': @@ -321,7 +321,6 @@ main(int argc, char **argv, char **envp) parseconfig("/etc/doas.conf"); - uid = getuid(); pw = getpwuid(uid); if (!pw) err(1, "getpwuid failed");