Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c04342

Browse files
Fix SSL tests on 32-bit Perl
The certificate serial number generation was changed in b4c4a00 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
1 parent 1607cd0 commit 0c04342

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/test/ssl/t/001_ssltests.pl

+14-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use strict;
55
use warnings;
6+
use Config qw ( %Config );
67
use PostgresNode;
78
use TestLib;
89
use Test::More;
@@ -489,8 +490,19 @@
489490
my $serialno = `openssl x509 -serial -noout -in ssl/client.crt`;
490491
if ($? == 0)
491492
{
492-
$serialno =~ s/^serial=//;
493-
$serialno = hex($serialno); # OpenSSL prints serial numbers in hexadecimal
493+
# OpenSSL prints serial numbers in hexadecimal and converting the serial
494+
# from hex requires a 64-bit capable Perl as the serialnumber is based on
495+
# the current timestamp. On 32-bit fall back to checking for it being an
496+
# integer like how we do when grabbing the serial fails.
497+
if ($Config{ivsize} == 8)
498+
{
499+
$serialno =~ s/^serial=//;
500+
$serialno = hex($serialno);
501+
}
502+
else
503+
{
504+
$serialno = '\d+';
505+
}
494506
}
495507
else
496508
{

0 commit comments

Comments
 (0)