mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-26 15:02:03 +00:00
Simplify code
This commit is contained in:
parent
6a5ee72722
commit
79ad0ff56b
17
acme.sh
17
acme.sh
@ -6362,18 +6362,11 @@ _checkSudo() {
|
|||||||
#it's root using sudo, no matter it's using sudo or not, just fine
|
#it's root using sudo, no matter it's using sudo or not, just fine
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
case "$SUDO_COMMAND" in
|
if [ -n "$SUDO_COMMAND" ]; then
|
||||||
*/su)
|
#it's a normal user doing "sudo su", or `sudo -i` or `sudo -s`
|
||||||
#it's a normal user doing `sudo su`, no problem
|
_endswith "$SUDO_COMMAND" /bin/su || grep "^$SUDO_COMMAND\$" /etc/shells >/dev/null 2>&1
|
||||||
return 0
|
return $?
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
for i in $(cat /etc/shells); do
|
|
||||||
if [ "$SUDO_COMMAND" = "$i" ]; then
|
|
||||||
#it's a normal user running `sudo -i` or `sudo -s`, fine
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
#otherwise
|
#otherwise
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user