summaryrefslogtreecommitdiff
path: root/src/test/ssl
diff options
context:
space:
mode:
authorPeter Eisentraut2018-01-09 17:28:49 +0000
committerPeter Eisentraut2018-01-09 17:28:49 +0000
commitc3d41ccf5931a2e587d114d9886717df76459a9d (patch)
tree6943b6e921b1dce5b7023b715dc8da29ed50ad63 /src/test/ssl
parent8a906204aec44de6d8a1514082870f25085d9431 (diff)
Fix ssl tests for when tls-server-end-point is not supported
Add a function to TestLib that allows us to check pg_config.h and then decide the expected test outcome based on that. Author: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src/test/ssl')
-rw-r--r--src/test/ssl/t/002_scram.pl21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index 3f425e00f0a..67c1409a6ed 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -11,6 +11,10 @@ use File::Copy;
# This is the hostname used to connect to the server.
my $SERVERHOSTADDR = '127.0.0.1';
+# Determine whether build supports tls-server-end-point.
+my $supports_tls_server_end_point =
+ check_pg_config("#define HAVE_X509_GET_SIGNATURE_NID 1");
+
# Allocation of base connection string shared among multiple tests.
my $common_connstr;
@@ -44,10 +48,19 @@ test_connect_ok($common_connstr,
"SCRAM authentication with tls-unique as channel binding");
test_connect_ok($common_connstr,
"scram_channel_binding=''",
- "SCRAM authentication without channel binding");
-test_connect_ok($common_connstr,
- "scram_channel_binding=tls-server-end-point",
- "SCRAM authentication with tls-server-end-point as channel binding");
+ "SCRAM authentication without channel binding");
+if ($supports_tls_server_end_point)
+{
+ test_connect_ok($common_connstr,
+ "scram_channel_binding=tls-server-end-point",
+ "SCRAM authentication with tls-server-end-point as channel binding");
+}
+else
+{
+ test_connect_fails($common_connstr,
+ "scram_channel_binding=tls-server-end-point",
+ "SCRAM authentication with tls-server-end-point as channel binding");
+}
test_connect_fails($common_connstr,
"scram_channel_binding=not-exists",
"SCRAM authentication with invalid channel binding");