postgresql/src/include/libpq
Tom Lane 0a4b340312 Fix unportable use of getnameinfo() in pg_hba_file_rules view.
fill_hba_line() thought it could get away with passing sizeof(struct
sockaddr_storage) rather than the actual addrlen previously returned
by getaddrinfo().  While that appears to work on many platforms,
it does not work on FreeBSD 11: you get back a failure, which leads
to the view showing NULL for the address and netmask columns in all
rows.  The POSIX spec for getnameinfo() is pretty clearly on
FreeBSD's side here: you should pass the actual address length.
So it seems plausible that there are other platforms where this
coding also fails, and we just hadn't noticed.

Also, IMO the fact that getnameinfo() failure leads to a NULL output
is pretty bogus in itself.  Our pg_getnameinfo_all() wrapper is
careful to emit "???" on failure, and we should use that in such
cases.  NULL should only be emitted in rows that don't have IP
addresses.

Per bug #16695 from Peter Vandivier.  Back-patch to v10 where this
code was added.

Discussion: https://postgr.es/m/16695-a665558e2f630be7@postgresql.org
2020-11-02 21:11:50 -05:00
..
auth.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
be-fsstubs.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
be-gssapi-common.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
crypt.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
hba.h Fix unportable use of getnameinfo() in pg_hba_file_rules view. 2020-11-02 21:11:50 -05:00
ifaddr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
libpq-be.h Fix postmaster's behavior during smart shutdown. 2020-08-14 13:26:57 -04:00
libpq-fs.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
libpq.h Fix assorted portability issues in commit 896fcdb23. 2020-03-25 19:37:30 -04:00
pqcomm.h Allow building without default socket directory 2020-01-31 16:28:43 +01:00
pqformat.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pqmq.h code: replace 'master' with 'leader' where appropriate. 2020-07-08 12:58:32 -07:00
pqsignal.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
scram.h Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00