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/interfaces/libpq/fe-auth.c | |
parent | cb1ab30fdc3b44a7d34ccf9cdaa82d46dd6427c1 (diff) | |
download | postgresql-4f9bf7fc5a1fcc3b1beac9b2e1d2e693ae7bd796.tar.gz postgresql-4f9bf7fc5a1fcc3b1beac9b2e1d2e693ae7bd796.zip |
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/interfaces/libpq/fe-auth.c')
-rw-r--r-- | src/interfaces/libpq/fe-auth.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index f3a177c985e..0c0fc1c4908 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.134 2007/12/04 13:02:53 mha Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.135 2007/12/09 19:01:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -954,7 +954,8 @@ pg_fe_sendauth(AuthRequest areq, PGconn *conn) case AUTH_REQ_MD5: case AUTH_REQ_CRYPT: case AUTH_REQ_PASSWORD: - if (conn->pgpass == NULL || *conn->pgpass == '\0') + conn->password_needed = true; + if (conn->pgpass == NULL || conn->pgpass[0] == '\0') { printfPQExpBuffer(&conn->errorMessage, PQnoPasswordSupplied); |