diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-07-26 15:12:23 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-07-26 15:12:23 +0300 |
commit | ef7fa900fb587cbaac9f3e943f789155b97aa02b (patch) | |
tree | 89b457703c0ed098019c8a60e867cfd2b60a497c /src/interfaces/libpq/t/005_negotiate_encryption.pl | |
parent | 20e0e7da9bc0089433c70b2b53ddf6a340ab5df3 (diff) |
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
Diffstat (limited to 'src/interfaces/libpq/t/005_negotiate_encryption.pl')
-rw-r--r-- | src/interfaces/libpq/t/005_negotiate_encryption.pl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/interfaces/libpq/t/005_negotiate_encryption.pl b/src/interfaces/libpq/t/005_negotiate_encryption.pl index 5fbab969008..157f23b8e83 100644 --- a/src/interfaces/libpq/t/005_negotiate_encryption.pl +++ b/src/interfaces/libpq/t/005_negotiate_encryption.pl @@ -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; } } |