1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Add tests for errors during SSL or GSSAPI handshake

These test that libpq correctly falls back to a plaintext connection
on handshake error, in the "prefer" modes.

Reviewed-by: Michael Paquier
Discussion: https://www.postgresql.org/message-id/CAOYmi%2Bnwvu21mJ4DYKUa98HdfM_KZJi7B1MhyXtnsyOO-PB6Ww%40mail.gmail.com
This commit is contained in:
Heikki Linnakangas
2024-07-26 15:12:23 +03:00
parent 20e0e7da9b
commit ef7fa900fb
3 changed files with 26 additions and 0 deletions

View File

@@ -339,6 +339,16 @@ nossluser . disable postgres connect, authok
"user=testuser sslmode=prefer",
'connect, v2error -> fail');
$node->restart;
$node->safe_psql(
'postgres',
"SELECT injection_points_attach('backend-ssl-startup', 'error');",
connstr => "user=localuser host=$unixdir");
connect_test(
$node,
"user=testuser sslmode=prefer",
'connect, sslaccept, backenderror, reconnect, authok -> plain');
$node->restart;
}
# Disable SSL again
@@ -444,6 +454,16 @@ nogssuser disable disable postgres connect, authok
"user=testuser gssencmode=prefer sslmode=disable",
'connect, v2error -> fail');
$node->restart;
$node->safe_psql(
'postgres',
"SELECT injection_points_attach('backend-gssapi-startup', 'error');",
connstr => "user=localuser host=$unixdir");
connect_test(
$node,
"user=testuser gssencmode=prefer sslmode=disable",
'connect, gssaccept, backenderror, reconnect, authok -> plain');
$node->restart;
}
}