diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-12-09 19:01:40 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-12-09 19:01:40 +0000 |
commit | 4f9bf7fc5a1fcc3b1beac9b2e1d2e693ae7bd796 (patch) | |
tree | dbc4b337965401ee7fd8c9598f98e4e7e5ba2f8f /src/bin/psql/command.c | |
parent | cb1ab30fdc3b44a7d34ccf9cdaa82d46dd6427c1 (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/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 2fa68972ff3..19d9d5141e7 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.183 2007/11/15 21:14:42 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.184 2007/12/09 19:01:40 tgl Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -1164,7 +1164,7 @@ do_connect(char *dbname, char *user, char *host, char *port) * Connection attempt failed; either retry the connection attempt with * a new password, or give up. */ - if (!password && PQconnectionUsedPassword(n_conn)) + if (!password && PQconnectionNeedsPassword(n_conn)) { PQfinish(n_conn); password = prompt_for_password(user); |