With gssencmode='require', check credential cache before connecting
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sun, 7 Apr 2024 23:49:35 +0000 (02:49 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sun, 7 Apr 2024 23:49:35 +0000 (02:49 +0300)
commit20f9b61cc1926775b1ceb25196df942efaf8bdd2
treefdcdf981222b5516f2b1c52a05bb4f4bd9979007
parent1169920ff77025550718b90a5cafc6849875f43f
With gssencmode='require', check credential cache before connecting

Previously, libpq would establish the TCP connection, and then
immediately disconnect if the credentials were not available.  The
same thing happened if you tried to use a Unix domain socket with
gssencmode=require. Check those conditions before establishing the TCP
connection.

This is a very minor issue, but my motivation to do this now is that
I'm about to add more detail to the tests for encryption negotiation.
This makes the case of gssencmode=require but no credentials
configured fail at the same stage as with gssencmode=require and
GSSAPI support not compiled at all. That avoids having to deal with
variations in expected output depending on build options.

Discussion: https://www.postgresql.org/message-id/CAEze2Wja8VUoZygCepwUeiCrWa4jP316k0mvJrOW4PFmWP0Tcw@mail.gmail.com
src/interfaces/libpq/fe-connect.c