Re: [PATCHES] sslmode patch - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] sslmode patch
Date
Msg-id 9688.1059232486@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] sslmode patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [PATCHES] sslmode patch
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.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.confentry 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
forhost \"%s\", user \"%s\", database \"%s\"",               hostinfo, port->user_name, port->database_name)));
 
#endif

This approach is also more localizable.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: parallel regression test failure
Next
From: Bruce Momjian
Date:
Subject: Re: parallel regression test failure