Merge branch 'luizluca-fix_read_s'
Should "fix" errors related to ash and potentially other non-POSIX shells that don't handle set -o or related options. http://www.austingroupbugs.net/view.php?id=1207 Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
commit
5340fb2dfc
@ -317,7 +317,7 @@ easyrsa_mktemp() {
|
|||||||
# remove temp files and do terminal cleanups
|
# remove temp files and do terminal cleanups
|
||||||
cleanup() {
|
cleanup() {
|
||||||
[ -z "$EASYRSA_TEMP_DIR_session" ] || rm -rf "$EASYRSA_TEMP_DIR_session"
|
[ -z "$EASYRSA_TEMP_DIR_session" ] || rm -rf "$EASYRSA_TEMP_DIR_session"
|
||||||
(stty echo 2>/dev/null) || set -o echo
|
(stty echo 2>/dev/null) || { (set -o echo 2>/dev/null) && set -o echo; }
|
||||||
echo "" # just to get a clean line
|
echo "" # just to get a clean line
|
||||||
} # => cleanup()
|
} # => cleanup()
|
||||||
|
|
||||||
@ -514,9 +514,20 @@ Your newly created PKI dir is: $EASYRSA_PKI
|
|||||||
|
|
||||||
hide_read_pass()
|
hide_read_pass()
|
||||||
{
|
{
|
||||||
(stty -echo 2>/dev/null) || set +o echo
|
# shellcheck disable=SC2039
|
||||||
|
if stty -echo 2>/dev/null; then
|
||||||
read -r "$@"
|
read -r "$@"
|
||||||
(stty echo 2>/dev/null) || set -o echo
|
stty echo
|
||||||
|
elif (set +o echo 2>/dev/null); then
|
||||||
|
set +o echo
|
||||||
|
read -r "$@"
|
||||||
|
set -o echo
|
||||||
|
elif (echo | read -r -s 2>/dev/null) ; then
|
||||||
|
read -r -s "$@"
|
||||||
|
else
|
||||||
|
warn "Could not disable echo. Password will be shown on screen!"
|
||||||
|
read -r "$@"
|
||||||
|
fi
|
||||||
} # => hide_read_pass()
|
} # => hide_read_pass()
|
||||||
|
|
||||||
# build-ca backend:
|
# build-ca backend:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user