include host names in hba error messages

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: include host names in hba error messages
Date: 2011-07-19 06:18:19
Message-ID: 1311056299.30180.13.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Since we are accepting host names in pg_hba.conf now, I figured it could
be useful to also show the host names in error message, e.g.,

no pg_hba.conf entry for host "localhost" (127.0.0.1), user "x", database "y"

Attached is an example patch. The question might be what criterion to
use for when to show the host name. It could be

if (port->remote_hostname_resolv == +1)

that is, we have done the reverse and forward lookup, or

if (port->remote_hostname_resolv >= 0)

that is, we have only done the reverse lookup (which is consistent with
log_hostname).

Although this whole thing could be quite weird, because the message that
a host name was rejected because the forward lookup didn't match the IP
address is at DEBUG2, so it's usually never shown. So if we tell
someone that there is 'no pg_hba.conf entry for host "foo"', even though
there is clearly a line saying "foo" in the file, it would be confusing.

Ideas?

Attachment Content-Type Size
hba-error-show-hostname.patch text/x-patch 3.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2011-07-19 06:31:30 Re: [COMMITTERS] pgsql: Cascading replication feature for streaming log-based replicatio
Previous Message Peter Eisentraut 2011-07-19 06:06:50 Re: about EDITOR_LINENUMBER_SWITCH