aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2009-02-26 16:02:39 +0000
committerPeter Eisentraut <peter_e@gmx.net>2009-02-26 16:02:39 +0000
commit9de59fd191dc86e7a49a5d7726ef09041549fc88 (patch)
tree9edc44560aa7beca92b7bc6c8e889c78655172c0 /src/bin/psql/command.c
parenteea49769d415b00ea36e2ee64774cb4d1313d991 (diff)
downloadpostgresql-9de59fd191dc86e7a49a5d7726ef09041549fc88.tar.gz
postgresql-9de59fd191dc86e7a49a5d7726ef09041549fc88.zip
Add a -w/--no-password option that prevents all password prompts to all
programs that have a -W/--password option. In passing, remove the ancient PSQL_ALWAYS_GET_PASSWORDS compile option.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 41888666de1..24c5b4d53ce 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.202 2009/01/20 02:13:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.203 2009/02/26 16:02:38 petere Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -1212,7 +1212,7 @@ do_connect(char *dbname, char *user, char *host, char *port)
* the postmaster's log. But libpq offers no API that would let us obtain
* a password and then continue with the first connection attempt.
*/
- if (pset.getPassword)
+ if (pset.getPassword == TRI_YES)
{
password = prompt_for_password(user);
}
@@ -1237,7 +1237,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 && PQconnectionNeedsPassword(n_conn))
+ if (!password && PQconnectionNeedsPassword(n_conn) && pset.getPassword != TRI_NO)
{
PQfinish(n_conn);
password = prompt_for_password(user);