summaryrefslogtreecommitdiff
path: root/src/bin/scripts/common.c
diff options
context:
space:
mode:
authorTom Lane2007-12-09 19:01:40 +0000
committerTom Lane2007-12-09 19:01:40 +0000
commit4f9bf7fc5a1fcc3b1beac9b2e1d2e693ae7bd796 (patch)
treedbc4b337965401ee7fd8c9598f98e4e7e5ba2f8f /src/bin/scripts/common.c
parentcb1ab30fdc3b44a7d34ccf9cdaa82d46dd6427c1 (diff)
Fix up the PQconnectionUsedPassword mess: create a separate
PQconnectionNeedsPassword function that tells the right thing for whether to prompt for a password, and improve PQconnectionUsedPassword so that it checks whether the password used by the connection was actually supplied as a connection argument, instead of coming from environment or a password file. Per bug report from Mark Cave-Ayland and subsequent discussion.
Diffstat (limited to 'src/bin/scripts/common.c')
-rw-r--r--src/bin/scripts/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c
index 5e815e57f4b..6e20f659a39 100644
--- a/src/bin/scripts/common.c
+++ b/src/bin/scripts/common.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.29 2007/11/15 21:14:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.30 2007/12/09 19:01:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -123,7 +123,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
}
if (PQstatus(conn) == CONNECTION_BAD &&
- PQconnectionUsedPassword(conn) &&
+ PQconnectionNeedsPassword(conn) &&
password == NULL &&
!feof(stdin))
{