pgsql: Fix portability bugs in use of credentials control messages for

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix portability bugs in use of credentials control messages for
Date: 2011-05-30 23:16:59
Message-ID: E1QRBhj-0006yj-0E@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0699d053ba8eede356e59e6e220716891cbee7fe

Modified Files
--------------
src/backend/libpq/auth.c | 60 +++++++++++++++++++++++----------------
src/interfaces/libpq/fe-auth.c | 22 ++++++++------
2 files changed, 47 insertions(+), 35 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-05-31 20:11:01 pgsql: Replace use of credential control messages with getsockopt(LOCAL
Previous Message Tom Lane 2011-05-30 23:16:58 pgsql: Fix portability bugs in use of credentials control messages for