From 814cff546b2e3c5e6b88dbbce84a1161ad2ec6d8 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 4 Mar 2022 05:37:21 +0000 Subject: [PATCH] Revert previous and add LOGIN_SETENV and LOGIN_SETRTABLE Instead of only adding LOGIN_SETENV and LOGIN_SETRTABLE, LOGIN_SETALL also includes LOGIN_SETLOGIN, which had the unintended side effect of breaking logname(1). ok deraadt tedu --- usr.bin/doas/doas.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr.bin/doas/doas.c b/usr.bin/doas/doas.c index 0e0cea18dd7..f84e54f09e0 100644 --- a/usr.bin/doas/doas.c +++ b/usr.bin/doas/doas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doas.c,v 1.95 2022/02/25 18:29:32 tedu Exp $ */ +/* $OpenBSD: doas.c,v 1.96 2022/03/04 05:37:21 tb Exp $ */ /* * Copyright (c) 2015 Ted Unangst * @@ -452,7 +452,10 @@ main(int argc, char **argv) if (targpw == NULL) errx(1, "no passwd entry for target"); - if (setusercontext(NULL, targpw, target, LOGIN_SETALL) == -1) + if (setusercontext(NULL, targpw, target, LOGIN_SETGROUP | + LOGIN_SETPATH | + LOGIN_SETPRIORITY | LOGIN_SETRESOURCES | LOGIN_SETUMASK | + LOGIN_SETUSER | LOGIN_SETENV | LOGIN_SETRTABLE) != 0) errx(1, "failed to set user context for target"); if (pledge("stdio rpath exec", NULL) == -1) -- 2.20.1