]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Corrects flaw in kea-admin util scripts for PostgreSQL
authorAlan <aclegg@isc.org>
Sun, 27 Jan 2019 05:00:14 +0000 (05:00 +0000)
committerTomek Mrugalski <tomek@isc.org>
Tue, 5 Feb 2019 21:15:48 +0000 (16:15 -0500)
Support #14017

src/bin/admin/admin-utils.sh

index 8b24e14d0f76523c9077af4caeb7667305d2f6c2..7ecab1be157b643a4ef041b2737f65f2987ff18f 100644 (file)
@@ -62,11 +62,11 @@ pgsql_execute() {
     QUERY=$1
     shift
     if [ $# -gt 0 ]; then
-        echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q "$@"
+        echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h "${db_host}" -q "$@"
         retcode=$?
     else
         export PGPASSWORD=$db_password
-        echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}"
+        echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h "${db_host}" -q -U "${db_user}" -d "${db_name}"
         retcode=$?
     fi
     return $retcode
@@ -86,11 +86,11 @@ pgsql_execute_script() {
     file=$1
     shift
     if [ $# -gt 0 ]; then
-        psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f "${file}" "$@"
+        psql --set ON_ERROR_STOP=1 -A -t -h "${db_host}" -q -f "${file}" "$@"
         retcode=$?
     else
         export PGPASSWORD=$db_password
-        psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}" -f "${file}"
+        psql --set ON_ERROR_STOP=1 -A -t -h "${db_host}" -q -U "${db_user}" -d "${db_name}" -f "${file}"
         retcode=$?
     fi
     return $retcode