Re: [PATCHES] sslmode patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Jon Jensen <jon(at)endpoint(dot)com>
Subject: Re: [PATCHES] sslmode patch
Date: 2003-07-26 15:14:46
Message-ID: 9688.1059232486@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> I had a little problem apply this patch because it had an #ifdef for
> elog() parameter passing. Because ereport() is now a macro, you can't
> do #ifdef inside a macro _call_, so I did it this way:

I don't think a non-SSL-enabled build need be pointing that out in every
error message --- the SSL phrase shouldn't even be there in the message.
Accordingly, I'd be inclined to do this:

#ifdef USE_SSL
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\", %s",
hostinfo, port->user_name, port->database_name,
(port->ssl ? gettext("SSL on") : gettext("SSL off")))));
#else
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\"",
hostinfo, port->user_name, port->database_name)));
#endif

This approach is also more localizable.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-07-26 15:16:25 Re: parallel regression test failure
Previous Message Bruce Momjian 2003-07-26 15:13:13 Re: parallel regression test failure

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-07-26 15:17:40 Re: timestamp date_trunc('quarter',...)
Previous Message Bruce Momjian 2003-07-26 14:41:38 Re: [PATCHES] sslmode patch