aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gustafsson <dgustafsson@postgresql.org>2021-10-21 10:28:50 +0200
committerDaniel Gustafsson <dgustafsson@postgresql.org>2021-10-21 10:28:50 +0200
commit0c04342b1d3dd5b24f795f94874163be8e21710e (patch)
tree66f28d196c5542e3dd3612a61c49df0654ec39d4 /src
parent1607cd0b6c9919bf765198882ea48a98e901e1bc (diff)
downloadpostgresql-0c04342b1d3dd5b24f795f94874163be8e21710e.tar.gz
postgresql-0c04342b1d3dd5b24f795f94874163be8e21710e.zip
Fix SSL tests on 32-bit Perl
The certificate serial number generation was changed in b4c4a00ea to use the current timestamp. The testharness must thus interrogate the cert for the serialnumber using "openssl x509" which emits the serial in hex format. Converting the serial to integer format to match whats in pg_stat_ssl requires a 64-bit capable Perl. This adds a fallback to checking for an integer when the tests with a 32-bit Perl. Per failure on buildfarm member prairiedog. Discussion: https://postgr.es/m/0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se
Diffstat (limited to 'src')
-rw-r--r--src/test/ssl/t/001_ssltests.pl16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index a901077469a..80e318f32e8 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -3,6 +3,7 @@
use strict;
use warnings;
+use Config qw ( %Config );
use PostgresNode;
use TestLib;
use Test::More;
@@ -489,8 +490,19 @@ TODO:
my $serialno = `openssl x509 -serial -noout -in ssl/client.crt`;
if ($? == 0)
{
- $serialno =~ s/^serial=//;
- $serialno = hex($serialno); # OpenSSL prints serial numbers in hexadecimal
+ # OpenSSL prints serial numbers in hexadecimal and converting the serial
+ # from hex requires a 64-bit capable Perl as the serialnumber is based on
+ # the current timestamp. On 32-bit fall back to checking for it being an
+ # integer like how we do when grabbing the serial fails.
+ if ($Config{ivsize} == 8)
+ {
+ $serialno =~ s/^serial=//;
+ $serialno = hex($serialno);
+ }
+ else
+ {
+ $serialno = '\d+';
+ }
}
else
{