From dd633006580f525d8bb245ae761226e26ebd5c2a Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Thu, 30 Jan 2020 13:25:46 +0000 Subject: kiss: Don't spawn sh with sudo/doas FossilOrigin-Name: 418ca6dc48304a7ed731bb1d01524d43577fac99e070d71ccd034852a6bcb243 --- kiss | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/kiss b/kiss index 7278a83..912135d 100755 --- a/kiss +++ b/kiss @@ -53,13 +53,9 @@ as_root() { # 'doas' or 'su'. This also handles KISS' environment variables. log "Using '${su:-su}'" - # doas requires these environment variables to be set as they - # aren't brought over from the calling user. - env="HOME='$HOME' KISS_FORCE='$KISS_FORCE' KISS_PATH='$KISS_PATH'" - case $su in - *sudo) sudo -E sh -c "$*" ;; - *doas) doas -- sh -c "$env $*" ;; + *sudo) sudo -E "$@" ;; + *doas) doas -- "$@" ;; *) su -pc "$* <&3" 3<&0