[type/__postgres_role] Fix state explorer when stored password is empty

This commit is contained in:
Dennis Camera 2021-01-18 13:09:29 +01:00
parent 2954347771
commit 35cde3e666

View file

@ -95,13 +95,20 @@ then
) )
passwd_stored=${passwd_stored%?.} passwd_stored=${passwd_stored%?.}
passwd_should=$(cat "${__object}/parameter/password"; printf .) if test -f "${__object:?}/parameter/password"
then
passwd_should=$(cat "${__object:?}/parameter/password"; printf .)
fi
passwd_should=${passwd_should%?.} passwd_should=${passwd_should%?.}
if expr "${passwd_stored}" : 'SCRAM-SHA-256\$.*$' >/dev/null if test -z "${passwd_stored}"
then
test -z "${passwd_should}" || state="${state:-different} password"
elif expr "${passwd_stored}" : 'SCRAM-SHA-256\$.*$' >/dev/null
then then
# SCRAM-SHA-256 "encrypted" password # SCRAM-SHA-256 "encrypted" password
# NOTE: There is currently no easy way to check SCRAM passwords # NOTE: There is currently no easy way to check SCRAM passwords without
# logging in
password_check_login || state="${state:-different} password" password_check_login || state="${state:-different} password"
elif expr "${passwd_stored}" : 'md5[0-9a-f]\{32\}$' >/dev/null elif expr "${passwd_stored}" : 'md5[0-9a-f]\{32\}$' >/dev/null
then then