git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cbca6c4)
Fix pgpass to work with PQconnectDB().
Wed, 8 Jan 2003 21:33:27 +0000 (21:33 +0000)
Wed, 8 Jan 2003 21:33:27 +0000 (21:33 +0000)
Backpatch to 7.3.X.

Report from ljb.


diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index b5f566eb4f8283c9dac756d37fd32f48260868cc..57108df1ff8854022ed44dee02c73efc27d46e52 100644 (file)
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -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);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /