|
42 | 42 | # This changes to using keys stored in a temporary path for the rest of
|
43 | 43 | # the tests. To get the full path for inclusion in connection strings, the
|
44 | 44 | # %key hash can be interrogated.
|
| 45 | +my $cert_tempdir = PostgreSQL::Test::Utils::tempdir(); |
45 | 46 | my %key;
|
46 | 47 | my @keys = (
|
47 | 48 | "client.key", "client-revoked.key",
|
48 | 49 | "client-der.key", "client-encrypted-pem.key",
|
49 | 50 | "client-encrypted-der.key", "client-dn.key");
|
50 | 51 | foreach my $keyfile (@keys)
|
51 | 52 | {
|
52 |
| - copy("ssl/${keyfile}", "${PostgreSQL::Test::Utils::tmp_check}/${keyfile}") |
| 53 | + copy("ssl/$keyfile", "$cert_tempdir/$keyfile") |
53 | 54 | or die
|
54 |
| - "couldn't copy ssl/${keyfile} to ${PostgreSQL::Test::Utils::tmp_check}/${keyfile} for permissions change: $!"; |
55 |
| - chmod 0600, "${PostgreSQL::Test::Utils::tmp_check}/${keyfile}" |
56 |
| - or die "failed to change permissions on ${PostgreSQL::Test::Utils::tmp_check}/${keyfile}: $!"; |
57 |
| - |
58 |
| - $key{$keyfile} = "${PostgreSQL::Test::Utils::tmp_check}/$keyfile"; |
| 55 | + "couldn't copy ssl/$keyfile to $cert_tempdir/$keyfile for permissions change: $!"; |
| 56 | + chmod 0600, "$cert_tempdir/$keyfile" |
| 57 | + or die "failed to change permissions on $cert_tempdir/$keyfile: $!"; |
| 58 | + $key{$keyfile} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/$keyfile"); |
59 | 59 | }
|
60 | 60 |
|
61 | 61 | # Also make a copy of that explicitly world-readable. We can't
|
62 | 62 | # necessarily rely on the file in the source tree having those
|
63 | 63 | # permissions.
|
64 |
| -copy("ssl/client.key", "${PostgreSQL::Test::Utils::tmp_check}/client_wrongperms.key"); |
65 |
| -chmod 0644, "${PostgreSQL::Test::Utils::tmp_check}/client_wrongperms.key"; |
66 |
| -$key{'client_wrongperms.key'} = "${PostgreSQL::Test::Utils::tmp_check}/client_wrongperms.key"; |
| 64 | +copy("ssl/client.key", "$cert_tempdir/client_wrongperms.key") |
| 65 | + or die |
| 66 | + "couldn't copy ssl/client_key to $cert_tempdir/client_wrongperms.key for permission change: $!"; |
| 67 | +chmod 0644, "$cert_tempdir/client_wrongperms.key" |
| 68 | + or die "failed to change permissions on $cert_tempdir/client_wrongperms.key: $!"; |
| 69 | +$key{'client_wrongperms.key'} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_wrongperms.key"); |
67 | 70 |
|
68 | 71 | #### Set up the server.
|
69 | 72 |
|
|
0 commit comments