Merge pull request #4333 from dokku/3149-respect-tmpdir

Drop tmpdir environment variables when not running as dokku user
This commit is contained in:
Jose Diaz-Gonzalez authored and GitHub committed 2021-01-20 13:20:05 -05:00
commit 3c5a3fdd7c
1 file changed
+7 -4
+7 -4
View File
@@ -88,10 +88,13 @@ if [[ "${args[0]}" =~ ^--.* ]]; then
fi fi
! has_tty && DOKKU_QUIET_OUTPUT=1 ! has_tty && DOKKU_QUIET_OUTPUT=1
if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]] && [[ $1 != "ssh-keys:add" ]] && [[ $1 != "ssh-keys:remove" ]]; then if [[ $(id -un) != "dokku" ]]; then
export SSH_USER=$(id -un) unset TMP TMPDIR TEMP TEMPDIR
sudo -u dokku -E -H "$0" "$@" if [[ ! $1 =~ plugin:* ]] && [[ $1 != "ssh-keys:add" ]] && [[ $1 != "ssh-keys:remove" ]]; then
exit $? export SSH_USER=$(id -un)
sudo -u dokku -E -H "$0" "$@"
exit $?
fi
fi fi
if [[ $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $1 == "ssh-keys:add" ]] || [[ $1 == "ssh-keys:remove" ]]; then if [[ $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $1 == "ssh-keys:add" ]] || [[ $1 == "ssh-keys:remove" ]]; then