8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fed6df4 commit bdac983Copy full SHA for bdac983
src/interfaces/libpq/fe-connect.c
@@ -978,9 +978,18 @@ connectOptions2(PGconn *conn)
978
979
for (i = 0; i < conn->nconnhost; i++)
980
{
981
- /* Try to get a password for this host from pgpassfile */
+ /*
982
+ * Try to get a password for this host from pgpassfile. We use host
983
+ * name rather than host address in the same manner to PQhost().
984
+ */
985
+ char *pwhost = conn->connhost[i].host;
986
+
987
+ if (conn->connhost[i].type == CHT_HOST_ADDRESS &&
988
+ conn->pghost != NULL && conn->pghost[0] != '\0')
989
+ pwhost = conn->pghost;
990
991
conn->connhost[i].password =
- passwordFromFile(conn->connhost[i].host,
992
+ passwordFromFile(pwhost,
993
conn->connhost[i].port,
994
conn->dbName,
995
conn->pguser,
0 commit comments