pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll()

The error cases for TLS and GSS encryption were inconsistent.  After TLS
fails, the connection is marked as dead and follow-up calls of
PQconnectPoll() would return immediately, but GSS encryption was not
doing that, so the connection would still have been allowed to enter the
GSS handling code.  This was handled incorrectly when gssencmode was set
to "require".  "prefer" was working correctly, and this could not happen
under "disable" as GSS encryption would not be attempted.

This commit makes the error handling of GSS encryption on par with TLS
portion, fixing the case of gssencmode=require.

Reported-by: Jacob Champion
Author: Michael Paquier
Reviewed-by: Jacob Champion, Stephen Frost
Discussion: 
https://postgr.es/m/23787477-5fe1-a161-6d2a-e459f74c4...@timescale.com
Backpatch-through: 12

Branch
--
master

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

Modified Files
--
src/interfaces/libpq/fe-connect.c | 23 ++-
1 file changed, 14 insertions(+), 9 deletions(-)



pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll()

The error cases for TLS and GSS encryption were inconsistent.  After TLS
fails, the connection is marked as dead and follow-up calls of
PQconnectPoll() would return immediately, but GSS encryption was not
doing that, so the connection would still have been allowed to enter the
GSS handling code.  This was handled incorrectly when gssencmode was set
to "require".  "prefer" was working correctly, and this could not happen
under "disable" as GSS encryption would not be attempted.

This commit makes the error handling of GSS encryption on par with TLS
portion, fixing the case of gssencmode=require.

Reported-by: Jacob Champion
Author: Michael Paquier
Reviewed-by: Jacob Champion, Stephen Frost
Discussion: 
https://postgr.es/m/23787477-5fe1-a161-6d2a-e459f74c4...@timescale.com
Backpatch-through: 12

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/4493256c5c0b0dace8cec76d5c3962f50ea28144

Modified Files
--
src/interfaces/libpq/fe-connect.c | 23 ++-
1 file changed, 14 insertions(+), 9 deletions(-)



pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll()

The error cases for TLS and GSS encryption were inconsistent.  After TLS
fails, the connection is marked as dead and follow-up calls of
PQconnectPoll() would return immediately, but GSS encryption was not
doing that, so the connection would still have been allowed to enter the
GSS handling code.  This was handled incorrectly when gssencmode was set
to "require".  "prefer" was working correctly, and this could not happen
under "disable" as GSS encryption would not be attempted.

This commit makes the error handling of GSS encryption on par with TLS
portion, fixing the case of gssencmode=require.

Reported-by: Jacob Champion
Author: Michael Paquier
Reviewed-by: Jacob Champion, Stephen Frost
Discussion: 
https://postgr.es/m/23787477-5fe1-a161-6d2a-e459f74c4...@timescale.com
Backpatch-through: 12

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/7e319231c6bba7bad4a71a47ed0aefadf71e1103

Modified Files
--
src/interfaces/libpq/fe-connect.c | 23 ++-
1 file changed, 14 insertions(+), 9 deletions(-)



pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll()

The error cases for TLS and GSS encryption were inconsistent.  After TLS
fails, the connection is marked as dead and follow-up calls of
PQconnectPoll() would return immediately, but GSS encryption was not
doing that, so the connection would still have been allowed to enter the
GSS handling code.  This was handled incorrectly when gssencmode was set
to "require".  "prefer" was working correctly, and this could not happen
under "disable" as GSS encryption would not be attempted.

This commit makes the error handling of GSS encryption on par with TLS
portion, fixing the case of gssencmode=require.

Reported-by: Jacob Champion
Author: Michael Paquier
Reviewed-by: Jacob Champion, Stephen Frost
Discussion: 
https://postgr.es/m/23787477-5fe1-a161-6d2a-e459f74c4...@timescale.com
Backpatch-through: 12

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2bc36a56cbd15415f85f3364044b778b21b0504c

Modified Files
--
src/interfaces/libpq/fe-connect.c | 23 ++-
1 file changed, 14 insertions(+), 9 deletions(-)



pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll()

The error cases for TLS and GSS encryption were inconsistent.  After TLS
fails, the connection is marked as dead and follow-up calls of
PQconnectPoll() would return immediately, but GSS encryption was not
doing that, so the connection would still have been allowed to enter the
GSS handling code.  This was handled incorrectly when gssencmode was set
to "require".  "prefer" was working correctly, and this could not happen
under "disable" as GSS encryption would not be attempted.

This commit makes the error handling of GSS encryption on par with TLS
portion, fixing the case of gssencmode=require.

Reported-by: Jacob Champion
Author: Michael Paquier
Reviewed-by: Jacob Champion, Stephen Frost
Discussion: 
https://postgr.es/m/23787477-5fe1-a161-6d2a-e459f74c4...@timescale.com
Backpatch-through: 12

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/96bef4374e450b2bd387cbfaad9371db3ac0669a

Modified Files
--
src/interfaces/libpq/fe-connect.c | 23 ++-
1 file changed, 14 insertions(+), 9 deletions(-)