Sort out getpeereid() and peer auth handling on Windows
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 30 Oct 2019 11:58:32 +0000 (12:58 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 16 Dec 2019 08:36:08 +0000 (09:36 +0100)
commitf14413b684d57211068ee56ee04695efcc87a23a
treee6fe1471c6cb4c44e52e5ac5c5762125b00b6507
parent956ef5875341c22a602fb825e6c98eaabb1ecce7
Sort out getpeereid() and peer auth handling on Windows

The getpeereid() uses have so far been protected by HAVE_UNIX_SOCKETS,
so they didn't ever care about Windows support.  But in anticipation
of Unix-domain socket support on Windows, that needs to be handled
differently.

Windows doesn't support getpeereid() at this time, so we use the
existing not-supported code path.  We let configure do its usual thing
of picking up the replacement from libpgport, instead of the custom
overrides that it was doing before.

But then Windows doesn't have struct passwd, so this patch sprinkles
some additional #ifdef WIN32 around to make it work.  This is similar
to existing code that deals with this issue.

Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/5974caea-1267-7708-40f2-6009a9d653b0@2ndquadrant.com
configure
configure.in
src/backend/libpq/auth.c
src/include/port.h
src/interfaces/libpq/fe-connect.c
src/tools/msvc/Mkvcbuild.pm