Re: BUG #16695: pg_hba_file_rules NULL address and netmask
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: petervandivier@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2020-11-03T01:27:38Z
Lists: pgsql-bugs
Attachments
- fix-bogus-addrlen-in-hba-view.patch (text/x-diff) patch
I wrote: > PG Bug reporting form <noreply@postgresql.org> writes: >> pg_hba_file_rules reports NULL address and netmask values incorrectly on >> FreeBSD 11 for tested postgres versions 10-13 (at least). e.g. > So for the archives' sake: what I suppose Peter means is that the addr > and netmask come out as NULL on every line, even where they should not. > At least, that's what I've reproduced here on FreeBSD 11.0. > I traced through this, and the proximate cause seems to be that > getnameinfo(3) is failing because it is expecting the passed "salen" > to be exactly the length it is expecting for the given sa_family. > Which it is not, because alone among our callers of pg_getnameinfo_all(), > fill_hba_line() thinks it can get away with passing sizeof(struct > sockaddr_storage) rather than the actual addrlen previously returned by > getaddrinfo(). The attached seems to fix it for me. (This is against HEAD, but a quick check suggests it will apply cleanly down to v10.) As I mentioned, I'm planning to put the new fields at the end of struct HbaLine in the back branches. regards, tom lane
Commits
-
Fix unportable use of getnameinfo() in pg_hba_file_rules view.
- f28b089cbd35 11.10 landed
- d3befe9b98d5 12.5 landed
- a58a631b4af0 13.1 landed
- 7827497ba2e6 10.15 landed
- 0a4b34031279 14.0 landed