Fix bugs in libpq's management of GSS encryption state.
authorTom Lane
Mon, 13 Jul 2020 15:57:55 +0000 (11:57 -0400)
committerTom Lane
Mon, 13 Jul 2020 15:57:55 +0000 (11:57 -0400)
commite8b22a8a2b65a678d38a120bf7b8cadc144cad17
tree0c88df8d98d1d6872aaad7a206cc02aa813453c8
parent5fea14f4b2c5ca4e4d9def92b17e50fcfbaf3468
Fix bugs in libpq's management of GSS encryption state.

GSS-related resources should be cleaned up in pqDropConnection,
not freePGconn, else the wrong things happen when resetting
a connection or trying to switch to a different server.
It's also critical to reset conn->gssenc there.

During connection setup, initialize conn->try_gss at the correct
place, else switching to a different server won't work right.

Remove now-redundant cleanup of GSS resources around one (and, for
some reason, only one) pqDropConnection call in connectDBStart.

Per report from Kyotaro Horiguchi that psql would freeze up,
rather than successfully resetting a GSS-encrypted connection
after a server restart.

This is YA oversight in commit b0b39f72b, so back-patch to v12.

Discussion: https://postgr.es/m/20200710.173803.435804731896516388[email protected]
src/interfaces/libpq/fe-connect.c