Warning about invalid .pgpass passwords

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Eamonn Martin <mas01em(at)gold(dot)ac(dot)uk>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Warning about invalid .pgpass passwords
Date: 2010-03-10 02:52:39
Message-ID: 201003100252.o2A2qdJ03357@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > > It had to do with me having a bogus password in .pgpass (so psql was
> > > first trying empty password, then the one in .pgpass, and both failing).
> > > Pilot error. However, I'd say that we ought to give a notice if the
> > > password in .pgpass fails.
> >
> > Can we do something like
> > ERROR: password authentication failed (using password from .pgpass)
> > ie, just tack on a comment to the error message?
>
> I looked into that but found it difficult to implement because only
> libpq knows about pgpass, while the message is printed by psql.

I just got confused for +10 minutes by an incorrect .pgpass password, so
I found new interest in improving this reported behavior. ;-)

The attached patch reports the fact that .pgpass was used if the libpq
connection fails:

$ psql -h localhost test
psql: FATAL: password authentication failed for user "postgres"
(password retrieved from .pgpass)

I am not sure if I like the parentheses or not. Ideally I would report
this only for password failures but that information is not passed back
from the server except as an error string.

I am thinking this could be in 9.0.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do

Attachment Content-Type Size
/pgpatches/pgpass text/x-diff 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-03-10 03:31:56 Re: Warning about invalid .pgpass passwords
Previous Message Takahiro Itagaki 2010-03-10 02:09:40 Re: lock mode for ControlFileLock which pg_start_backup uses