From 5c8ad3666b9bef423e846453c50450b32a3d983d Mon Sep 17 00:00:00 2001 From: Dev & Sec Date: Tue, 3 Nov 2015 22:34:07 +0000 Subject: [PATCH] fix sudo function name scope issue, it is not a local function --- letsencrypt-auto | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index cfc830c9f..c352482a2 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -14,8 +14,10 @@ VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"} VENV_BIN=${VENV_PATH}/bin if test "`id -u`" -ne "0" ; then - if ! type sudo &>/dev/null; then - sudo() { + if type sudo &>/dev/null; then + SUDO=sudo + else + su_sudo() { args="" while [ $# -ne 0 ]; do args="$args'$(printf "%s" "$1" | sed -e "s/'/'\"'\"'/g")' " @@ -23,8 +25,8 @@ if test "`id -u`" -ne "0" ; then done su root -c "$args" } + SUDO=su_sudo fi - SUDO=sudo else SUDO= fi