]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix portability bugs in use of credentials control messages for peer auth.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 30 May 2011 23:16:28 +0000 (19:16 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 30 May 2011 23:16:28 +0000 (19:16 -0400)
commitfccef77183aff3c96b92c533a8858122cc46cb3c
treee15f4d6e69a5f1f4b65d008231f6015ad7be40ef
parent6d24189b417dfcedc5815a9f1533555b2dfe891c
Fix portability bugs in use of credentials control messages for peer auth.

Even though our existing code for handling credentials control messages has
been basically unchanged since 2001, it was fundamentally wrong: it did not
ensure proper alignment of the supplied buffer, and it was calculating
buffer sizes and message sizes incorrectly.  This led to failures on
platforms where alignment padding is relevant, for instance FreeBSD on
64-bit platforms, as seen in a recent Debian bug report passed on by
Martin Pitt (http://bugs.debian.org//cgi-bin/bugreport.cgi?bug=612888).

Rewrite to do the message-whacking using the macros specified in RFC 2292,
following a suggestion from Theo de Raadt in that thread.  Tested by me
on Debian/kFreeBSD-amd64; since OpenBSD and NetBSD document the identical
CMSG API, it should work there too.

Back-patch to all supported branches.
src/backend/libpq/hba.c
src/interfaces/libpq/fe-auth.c