Re: Warning about invalid .pgpass passwords

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Warning about invalid .pgpass passwords
Дата
Msg-id 201003112135.o2BLZeS12773@momjian.us
обсуждение исходный текст
Ответ на Re: Warning about invalid .pgpass passwords  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Warning about invalid .pgpass passwords  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Steve Atkins
Дата:
Сообщение: Re: [patch] build issues on Win32
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: HeapTupleData.t_self garbage values