postgresql/src/include
Tom Lane fc752505a9 Fix assorted issues in client host name lookup.
The code for matching clients to pg_hba.conf lines that specify host names
(instead of IP address ranges) failed to complain if reverse DNS lookup
failed; instead it silently didn't match, so that you might end up getting
a surprising "no pg_hba.conf entry for ..." error, as seen in bug #9518
from Mike Blackwell.  Since we don't want to make this a fatal error in
situations where pg_hba.conf contains a mixture of host names and IP
addresses (clients matching one of the numeric entries should not have to
have rDNS data), remember the lookup failure and mention it as DETAIL if
we get to "no pg_hba.conf entry".  Apply the same approach to forward-DNS
lookup failures, too, rather than treating them as immediate hard errors.

Along the way, fix a couple of bugs that prevented us from detecting an
rDNS lookup error reliably, and make sure that we make only one rDNS lookup
attempt; formerly, if the lookup attempt failed, the code would try again
for each host name entry in pg_hba.conf.  Since more or less the whole
point of this design is to ensure there's only one lookup attempt not one
per entry, the latter point represents a performance bug that seems
sufficient justification for back-patching.

Also, adjust src/port/getaddrinfo.c so that it plays as well as it can
with this code.  Which is not all that well, since it does not have actual
support for rDNS lookup, but at least it should return the expected (and
required by spec) error codes so that the main code correctly perceives the
lack of functionality as a lookup failure.  It's unlikely that PG is still
being used in production on any machines that require our getaddrinfo.c,
so I'm not excited about working harder than this.

To keep the code in the various branches similar, this includes
back-patching commits c424d0d105 and
1997f34db4 into 9.2 and earlier.

Back-patch to 9.1 where the facility for hostnames in pg_hba.conf was
introduced.
2014-04-02 17:11:24 -04:00
..
access Move SizeOfHeapNewCid next to xl_heap_new_cid struct. 2014-04-01 16:23:16 +03:00
bootstrap Update copyright for 2014 2014-01-07 16:05:30 -05:00
catalog Cleanup around json_to_record/json_to_recordset 2014-03-26 10:18:24 -04:00
commands Offer triggers on foreign tables. 2014-03-23 02:16:34 -04:00
common Make various variables const (read-only). 2014-01-18 16:04:32 -05:00
datatype Update copyright for 2014 2014-01-07 16:05:30 -05:00
executor Update copyright for 2014 2014-01-07 16:05:30 -05:00
foreign Update copyright for 2014 2014-01-07 16:05:30 -05:00
lib Update copyright for 2014 2014-01-07 16:05:30 -05:00
libpq Fix assorted issues in client host name lookup. 2014-04-02 17:11:24 -04:00
mb Fix typo 2014-02-13 21:50:43 -05:00
nodes Add comment that ec_relids excludes "child" EquivalenceClass members. 2014-03-05 16:00:33 -05:00
optimizer Code review for auto-tuned effective_cache_size. 2014-01-27 00:05:56 -05:00
parser Avoid repeated name lookups during table and index DDL. 2014-02-17 09:33:31 -05:00
port Enable building with Visual Studion 2013. 2014-01-26 09:49:10 -05:00
portability Update copyright for 2014 2014-01-07 16:05:30 -05:00
postmaster Separate multixact freezing parameters from xid's 2014-02-13 19:36:31 -03:00
regex Allow regex operations to be terminated early by query cancel requests. 2014-03-01 15:20:56 -05:00
replication Allow logical decoding via the walsender interface. 2014-03-10 13:50:28 -04:00
rewrite Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:05 -05:00
snowball Update copyright for 2014 2014-01-07 16:05:30 -05:00
storage Replace the XLogInsert slots with regular LWLocks. 2014-03-21 15:10:48 +01:00
tcop Avoid repeated name lookups during table and index DDL. 2014-02-17 09:33:31 -05:00
tsearch Allow opclasses to provide tri-valued GIN consistent functions. 2014-03-12 17:51:30 +02:00
utils De-anonymize the union in JsonbValue. 2014-04-02 14:30:08 -04:00
.gitignore Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
c.h Prevent double macro definition of WIN32. 2014-01-17 11:49:44 -05:00
fmgr.h Further code review for pg_lsn data type. 2014-02-19 10:06:59 -05:00
funcapi.h Introduce jsonb, a structured format for storing json. 2014-03-23 16:40:19 -04:00
getaddrinfo.h Fix assorted issues in client host name lookup. 2014-04-02 17:11:24 -04:00
getopt_long.h Centralize getopt-related declarations in a new header file pg_getopt.h. 2014-02-15 14:31:30 -05:00
Makefile Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
miscadmin.h PGDLLIMPORT-ify MainLWLockArray, ProcDiePending, proc_exit_inprogress. 2014-02-16 20:12:43 -05:00
pg_config.h.in Allow use of "z" flag in our printf calls, and use it where appropriate. 2014-01-23 17:18:33 -05:00
pg_config.h.win32 Enable building with Visual Studion 2013. 2014-01-26 09:49:10 -05:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Fix typos in comments for ALTER SYSTEM. 2014-01-27 12:23:20 +09:00
pg_getopt.h Centralize getopt-related declarations in a new header file pg_getopt.h. 2014-02-15 14:31:30 -05:00
pg_trace.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
pgstat.h Show xid and xmin in pg_stat_activity and pg_stat_replication. 2014-02-25 12:34:04 -05:00
pgtar.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
pgtime.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
port.h Centralize getopt-related declarations in a new header file pg_getopt.h. 2014-02-15 14:31:30 -05:00
postgres.h Further code review for pg_lsn data type. 2014-02-19 10:06:59 -05:00
postgres_ext.h Provide database object names as separate fields in error messages. 2013-01-29 17:08:26 -05:00
postgres_fe.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
rusagestub.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
windowapi.h Update copyright for 2014 2014-01-07 16:05:30 -05:00