Skip to content

Commit 49422ad

Browse files
Fix path delimiters in connection string on Windows
The temporary path generated in commit c113d8a cannot be passed as-is in the connection string on Windows since the path delimiting backslashes will be treated as escape characters. Fix by converting backslash to slash as in similar path usecases in other tests. Reported-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20211202195130.e7pprpsx4ell22sp@alap3.anarazel.de
1 parent 557c39b commit 49422ad

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
chmod 0600, "$cert_tempdir/$keyfile"
5757
or die "failed to change permissions on $cert_tempdir/$keyfile: $!";
5858
$key{$keyfile} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/$keyfile");
59+
$key{$keyfile} =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
5960
}
6061

6162
# Also make a copy of that explicitly world-readable. We can't
@@ -67,7 +68,7 @@
6768
chmod 0644, "$cert_tempdir/client_wrongperms.key"
6869
or die "failed to change permissions on $cert_tempdir/client_wrongperms.key: $!";
6970
$key{'client_wrongperms.key'} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_wrongperms.key");
70-
71+
$key{'client_wrongperms.key'} =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
7172
#### Set up the server.
7273

7374
note "setting up data directory";

src/test/ssl/t/002_scram.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"couldn't copy ssl/client_key to $cert_tempdir/client_scram.key for permission change: $!";
103103
chmod 0600, "$cert_tempdir/client_scram.key"
104104
or die "failed to change permissions on $cert_tempdir/client_scram.key: $!";
105+
$client_tmp_key =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
105106
$node->connect_fails(
106107
"sslcert=ssl/client.crt sslkey=$client_tmp_key sslrootcert=invalid hostaddr=$SERVERHOSTADDR dbname=certdb user=ssltestuser channel_binding=require",
107108
"Cert authentication and channel_binding=require",

src/test/ssl/t/003_sslinfo.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"couldn't copy ssl/client_ext.key to $cert_tempdir/client_ext.key for permissions change: $!";
4545
chmod 0600, "$cert_tempdir/client_ext.key"
4646
or die "failed to change permissions on $cert_tempdir/client_ext.key: $!";
47+
$client_tmp_key =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
4748

4849
#### Set up the server.
4950

0 commit comments

Comments
 (0)