mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-13 19:57:53 +08:00
Fix pgpass to work with PQconnectDB().
Backpatch to 7.3.X. Report from ljb.
This commit is contained in:
parent
cbca6c4896
commit
fe7f8f2b91
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.220 2003/01/08 16:21:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.221 2003/01/08 21:33:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -314,6 +314,9 @@ PQconnectStart(const char *conninfo)
|
||||
conn->pguser = tmp ? strdup(tmp) : NULL;
|
||||
tmp = conninfo_getval(connOptions, "password");
|
||||
conn->pgpass = tmp ? strdup(tmp) : NULL;
|
||||
if (conn->pgpass == NULL || conn->pgpass[0] == '\0')
|
||||
conn->pgpass = PasswordFromFile(conn->pghost, conn->pgport,
|
||||
conn->dbName, conn->pguser);
|
||||
tmp = conninfo_getval(connOptions, "connect_timeout");
|
||||
conn->connect_timeout = tmp ? strdup(tmp) : NULL;
|
||||
#ifdef USE_SSL
|
||||
@ -511,9 +514,6 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
|
||||
conn->pgpass = strdup(pwd);
|
||||
else if ((tmp = getenv("PGPASSWORD")) != NULL)
|
||||
conn->pgpass = strdup(tmp);
|
||||
else if ((tmp = PasswordFromFile(conn->pghost, conn->pgport,
|
||||
conn->dbName, conn->pguser)))
|
||||
conn->pgpass = tmp;
|
||||
else
|
||||
conn->pgpass = strdup(DefaultPassword);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user