Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
79ad0ff5
Commit
79ad0ff5
authored
Jan 15, 2020
by
rewqazxv
Browse files
Simplify code
parent
6a5ee727
Changes
1
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
79ad0ff5
...
@@ -6362,18 +6362,11 @@ _checkSudo() {
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment