Re: Warning about invalid .pgpass passwords

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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: Re: Warning about invalid .pgpass passwords
Date: 2010-03-12 16:54:29
Message-ID: 201003121654.o2CGsTf11093@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
>
> Bruce Momjian wrote:
> > + /* If it was 'invalid authorization', add .pgpass mention */
> > + if (conn->dot_pgpass_used && conn->password_needed && conn->result &&
> > + /* only works with >= 9.0 servers */
> > + strcmp(PQresultErrorField(conn->result, PG_DIAG_SQLSTATE),
> > + ERRCODE_INVALID_PASSWORD_SPECIFICATION) == 0)
> > + appendPQExpBufferStr(&conn->errorMessage,
> > + libpq_gettext("password retrieved from .pgpass\n"));
> >
>
> Surely we should use the name of the actual file from which the password
> was retrieved here, which could be quite different from ".pgpass" (see
> PGPASSFILE environment setting) and is different by default on Windows
> anyway. Using a hardcoded ".pgpass" in those situations could be quite
> confusing.

Agreed, very good idea. Update patch attached.

--
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.sqlstate text/x-diff 8.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2010-03-12 16:54:56 Re: Dyamic updates of NEW with pl/pgsql
Previous Message Andrew Dunstan 2010-03-12 16:47:48 Re: buildfarm logging versus embedded nulls