pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use SOCK_ERRNO[_SET] in fe-secure-gssapi.c.
Date: Sun, 05 Oct 2025 20:28:06 +0000
Message-ID: <E1v5VKw-000E3r-0w@gemulon.postgresql.org> (raw)

Use SOCK_ERRNO[_SET] in fe-secure-gssapi.c.

On Windows, this code did not handle error conditions correctly at
all, since it looked at "errno" which is not used for socket-related
errors on that platform.  This resulted, for example, in failure
to connect to a PostgreSQL server with GSSAPI enabled.

We have a convention for dealing with this within libpq, which is to
use SOCK_ERRNO and SOCK_ERRNO_SET rather than touching errno directly;
but the GSSAPI code is a relative latecomer and did not get that memo.
(The equivalent backend code continues to use errno, because the
backend does this differently.  Maybe libpq's approach should be
rethought someday.)

Apparently nobody tries to build libpq with GSSAPI support on Windows,
or we'd have heard about this before, because it's been broken all
along.  Back-patch to all supported branches.

Author: Ning Wu <ning94803@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFGqpvg-pRw=cdsUpKYfwY6D3d-m9tw8WMcAEE7HHWfm-oYWvw@mail.gmail.com
Backpatch-through: 13

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d83879a32b481f0e23cd8a14f7849cff3f8898b5

Modified Files
--------------
src/interfaces/libpq/fe-secure-gssapi.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1v5VKw-000E3r-0w@gemulon.postgresql.org>
Permalink:  ../E1v5VKw-000E3r-0w@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1v5VKw-000E3r-0w@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use SOCK_ERRNO[_SET] in fe-secure-gssapi.c.
  In-Reply-To: <E1v5VKw-000E3r-0w@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox