Avoid ECPG test failures in some GSS-capable environments.

Buildfarm member hamerkop has been reporting that two cases in
connect/test5.pgc show different error messages than the test expects,
because since commit ffa2e4670 libpq's connection failure messages
are exposing the fact that a GSS-encrypted connection was attempted
and failed.  That's pretty interesting information in itself, and
I certainly don't wish to shoot the messenger, but we need to do
something to stabilize the ECPG results.

For the second of these two failure cases, we can add the
gssencmode=disable option to prevent the discrepancy.  However,
that solution is problematic for the first failure, because the only
unique thing about that case is that it's testing a completely-omitted
connection target; there's noplace to add the option without defeating
the point of the test case.  After some thrashing around with
alternative fixes that turned out to have undesirable side-effects,
the most workable answer is just to give up and remove that test case.
Perhaps we can revert this later, if we figure out why the GSS code
is misbehaving in hamerkop's environment.

Thanks to Michael Paquier for exploration of alternatives.

Discussion: https://postgr.es/m/YLRZH6CWs9N6Pusy@paquier.xyz
This commit is contained in:
Tom Lane 2021-06-10 10:45:31 -04:00
parent b29fa951ec
commit 9bb5eecce6
3 changed files with 7 additions and 21 deletions

View File

@ -40,8 +40,8 @@ exec sql end declare section;
exec sql connect to 'ecpg2_regression' as main;
exec sql disconnect main;
exec sql connect to as main user regress_ecpg_user2/insecure;
exec sql disconnect main;
/* exec sql connect to as main user regress_ecpg_user2/insecure;
exec sql disconnect main; */
exec sql connect to ecpg2_regression as main user regress_ecpg_user1/connectpw;
exec sql disconnect main;
@ -61,7 +61,7 @@ exec sql end declare section;
exec sql connect to "unix:postgresql://200.46.204.71/ecpg2_regression" as main user regress_ecpg_user1/connectpw;
exec sql disconnect main;
exec sql connect to unix:postgresql://localhost/ as main user regress_ecpg_user2 IDENTIFIED BY insecure;
exec sql connect to "unix:postgresql://localhost/?gssencmode=disable" as main user regress_ecpg_user2 IDENTIFIED BY insecure;
exec sql disconnect main;
/* connect twice */

View File

@ -86,12 +86,8 @@ main(void)
#line 41 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "" , "regress_ecpg_user2" , "insecure" , "main", 0); }
#line 43 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 44 "test5.pgc"
/* exec sql connect to as main user regress_ecpg_user2/insecure;
exec sql disconnect main; */
{ ECPGconnect(__LINE__, 0, "ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
#line 46 "test5.pgc"
@ -135,7 +131,7 @@ main(void)
#line 62 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "regress_ecpg_user2" , "insecure" , "main", 0); }
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/?gssencmode=disable" , "regress_ecpg_user2" , "insecure" , "main", 0); }
#line 64 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}

View File

@ -34,16 +34,6 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> for user regress_ecpg_user2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -402 on line 43: could not connect to database "<DEFAULT>" on line 43
[NO_PID]: sqlca: code: -402, state: 08001
[NO_PID]: raising sqlcode -220 on line 44: connection "main" does not exist on line 44
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
@ -70,7 +60,7 @@
[NO_PID]: sqlca: code: -402, state: 08001
[NO_PID]: raising sqlcode -220 on line 62: connection "main" does not exist on line 62
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> for user regress_ecpg_user2
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> with options gssencmode=disable for user regress_ecpg_user2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
[NO_PID]: sqlca: code: 0, state: 00000