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

Commit c4342c9

Browse files
committed
Fix removal of files generated by TAP tests for SSL
001_ssltests.pl and 002_scram.pl both generated an extra file for a client key used in the tests that were not removed. In Debian, this causes repeated builds to fail. The code refactoring done in 4dc6355 broke the cleanup done in 001_ssltests.pl, and the new tests added in 002_scram.pl via d6e612f forgot the removal of one file. While on it, fix a second issue introduced in 002_scram.pl where we use the same file name in 001 and 002 for the temporary client key whose permissions are changed in the test, as using the same file name in both tests could cause failures with parallel jobs of src/test/ssl/ if one test removes a file still needed by the second test. Reported-by: Felix Lechner Author: Daniel Gustafsson, Felix Lechner Reviewed-by: Tom Lane, Michael Paquier Discussion: https://postgr.es/m/CAFHYt543sjX=Cm_aEeoejStyP47C+Y3+Wh6WbirLXsgUMaw7iw@mail.gmail.com Backpatch-through: 13
1 parent 40efbf8 commit c4342c9

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@
5252

5353
# Also make a copy of that explicitly world-readable. We can't
5454
# necessarily rely on the file in the source tree having those
55-
# permissions.
55+
# permissions. Add it to @keys to include it in the final clean
56+
# up phase.
5657
copy("ssl/client.key", "ssl/client_wrongperms_tmp.key");
5758
chmod 0644, "ssl/client_wrongperms_tmp.key";
59+
push @keys, 'client_wrongperms';
5860

5961
#### Set up the server.
6062

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,20 @@
8989
qr/channel binding required but not supported by server's authentication request/,
9090
"MD5 with SSL and channel_binding=require");
9191

92-
# Now test with auth method 'cert' by connecting to 'certdb'. Should
93-
# fail, because channel binding is not performed.
94-
copy("ssl/client.key", "ssl/client_tmp.key");
95-
chmod 0600, "ssl/client_tmp.key";
92+
# Now test with auth method 'cert' by connecting to 'certdb'. Should fail,
93+
# because channel binding is not performed. Note that ssl/client.key may
94+
# be used in a different test, so the name of this temporary client key
95+
# is chosen here to be unique.
96+
my $client_tmp_key = "ssl/client_scram_tmp.key";
97+
copy("ssl/client.key", $client_tmp_key);
98+
chmod 0600, $client_tmp_key;
9699
test_connect_fails(
97-
"sslcert=ssl/client.crt sslkey=ssl/client_tmp.key hostaddr=$SERVERHOSTADDR",
100+
"sslcert=ssl/client.crt sslkey=$client_tmp_key hostaddr=$SERVERHOSTADDR",
98101
"dbname=certdb user=ssltestuser channel_binding=require",
99102
qr/channel binding required, but server authenticated client without channel binding/,
100103
"Cert authentication and channel_binding=require");
101104

105+
# clean up
106+
unlink($client_tmp_key);
107+
102108
done_testing($number_of_tests);

0 commit comments

Comments
 (0)