[type/__postgres_role] Treat --password '' like no --password
This commit is contained in:
parent
0d33407b18
commit
0f05f38384
2 changed files with 5 additions and 8 deletions
|
@ -43,8 +43,7 @@ role_properties=$(
|
||||||
BEGIN { RS = "\036"; FS = "\034" }
|
BEGIN { RS = "\036"; FS = "\034" }
|
||||||
/^\([0-9]+ rows?\)/ { exit }
|
/^\([0-9]+ rows?\)/ { exit }
|
||||||
NR == 1 { for (i = 1; i <= NF; i++) cols[i] = $i; next }
|
NR == 1 { for (i = 1; i <= NF; i++) cols[i] = $i; next }
|
||||||
NR == 2 { for (i = 1; i <= NF; i++) printf "%s=%s\n", cols[i], $i }
|
NR == 2 { for (i = 1; i <= NF; i++) printf "%s=%s\n", cols[i], $i }'
|
||||||
'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if test -n "${role_properties}"
|
if test -n "${role_properties}"
|
||||||
|
@ -78,12 +77,10 @@ then
|
||||||
# Check password
|
# Check password
|
||||||
passwd_stored=$(
|
passwd_stored=$(
|
||||||
psql_query "SELECT rolpassword FROM pg_authid WHERE rolname = '${rolename}'" \
|
psql_query "SELECT rolpassword FROM pg_authid WHERE rolname = '${rolename}'" \
|
||||||
| awk 'BEGIN { RS = "\036" } NR == 2'
|
| awk 'BEGIN { RS = "\036" } NR == 2 { printf "%s.", $0 }')
|
||||||
printf .
|
passwd_stored=${passwd_stored%.}
|
||||||
)
|
|
||||||
passwd_stored=${passwd_stored%?.}
|
|
||||||
|
|
||||||
if test -f "${__object:?}/parameter/password"
|
if test -s "${__object:?}/parameter/password"
|
||||||
then
|
then
|
||||||
passwd_should=$(cat "${__object:?}/parameter/password"; printf .)
|
passwd_should=$(cat "${__object:?}/parameter/password"; printf .)
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -46,7 +46,7 @@ psql_query() {
|
||||||
|
|
||||||
psql_set_password() {
|
psql_set_password() {
|
||||||
# NOTE: Always make sure that the password does not end up in psql_history!
|
# NOTE: Always make sure that the password does not end up in psql_history!
|
||||||
# NOTE: Never set an empty string as the password, because they can be
|
# NOTE: Never set an empty string as the password, because it can be
|
||||||
# interpreted differently by different tooling.
|
# interpreted differently by different tooling.
|
||||||
if test -s "${__object:?}/parameter/password"
|
if test -s "${__object:?}/parameter/password"
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in a new issue