From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-11 21:35:40 |
Message-ID: | 201003112135.o2BLZeS12773@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Alvaro Herrera wrote:
> Bruce Momjian wrote:
>
> > + static void
> > + dot_pg_pass_warning(PGconn *conn)
> > + {
> > + /* If it was 'invalid authorization', add .pgpass mention */
> > + if (conn->dot_pgpass_used && conn->password_needed && conn->result &&
> > + /* only works with >= 9.0 servers */
> > + atoi(PQresultErrorField(conn->result, PG_DIAG_SQLSTATE)) ==
> > + SQLSTATE_TO_BASE10(ERRCODE_INVALID_PASSWORD_SPECIFICATION))
> > + appendPQExpBufferStr(&conn->errorMessage,
> > + libpq_gettext("password retrieved from .pgpass\n"));
> > + }
>
> This bit seems strange ... I think we just do strcmp() to compare sqlstates?
Uh, the PQresultErrorField is a string, while
ERRCODE_INVALID_PASSWORD_SPECIFICATI is a 4-byte value in base-64.
Yea, it's true. For excitement, see the MAKE_SQLSTATE macro.
--
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
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2010-03-11 21:52:08 | Re: HeapTupleData.t_self garbage values |
Previous Message | Steve Atkins | 2010-03-11 21:34:34 | Re: [patch] build issues on Win32 |