tests: clean up temporary SSL session files.

RT#4557

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Richard Levitte 2016-06-03 13:56:20 +02:00
parent 4a2c4c1ab8
commit b38c43f7bc
2 changed files with 16 additions and 8 deletions

View file

@ -75,7 +75,7 @@ checkmessages(3, "No client support session ticket test", 0, 0, 0, 1);
#Expected result: ClientHello extension seen; ServerHello extension not seen
# NewSessionTicket message not seen; Abbreviated handshake
clearall();
(my $fh, my $session) = tempfile();
(undef, my $session) = tempfile();
$proxy->serverconnects(2);
$proxy->clientflags("-sess_out ".$session);
$proxy->start();
@ -83,12 +83,13 @@ $proxy->clearClient();
$proxy->clientflags("-sess_in ".$session);
$proxy->clientstart();
checkmessages(4, "Session resumption session ticket test", 1, 0, 0, 0);
unlink $session;
#Test 5: Test session resumption with ticket capable client without a ticket
#Expected result: ClientHello extension seen; ServerHello extension seen
# NewSessionTicket message seen; Abbreviated handshake
clearall();
($fh, $session) = tempfile();
(undef, $session) = tempfile();
$proxy->serverconnects(2);
$proxy->clientflags("-sess_out ".$session." -no_ticket");
$proxy->start();
@ -97,6 +98,7 @@ $proxy->clientflags("-sess_in ".$session);
$proxy->clientstart();
checkmessages(5, "Session resumption with ticket capable client without a "
."ticket", 1, 1, 1, 0);
unlink $session;
#Test 6: Client accepts empty ticket.
#Expected result: ClientHello extension seen; ServerHello extension seen;
@ -108,7 +110,7 @@ checkmessages(6, "Empty ticket test", 1, 1, 1, 1);
#Test 7-8: Client keeps existing ticket on empty ticket.
clearall();
($fh, $session) = tempfile();
(undef, $session) = tempfile();
$proxy->serverconnects(3);
$proxy->filter(undef);
$proxy->clientflags("-sess_out ".$session);
@ -127,6 +129,7 @@ $proxy->clientstart();
#Expected result: ClientHello extension seen; ServerHello extension not seen;
# NewSessionTicket message not seen; Abbreviated handshake.
checkmessages(8, "Empty ticket resumption test", 1, 0, 0, 0);
unlink $session;
#Test 9: Bad server sends the ServerHello extension but does not send a
#NewSessionTicket

View file

@ -91,7 +91,7 @@ checkmessages(2, "No ticket, no client extension extended master secret test", 0
clearall();
setrmextms(0, 0);
(my $fh, my $session) = tempfile();
(undef, my $session) = tempfile();
$proxy->serverconnects(2);
$proxy->clientflags("-sess_out ".$session);
$proxy->start();
@ -99,6 +99,7 @@ $proxy->clearClient();
$proxy->clientflags("-sess_in ".$session);
$proxy->clientstart();
checkmessages(5, "Session resumption extended master secret test", 1, 1, 0);
unlink $session;
#Test 6: Session resumption extended master secret test original session
# omits extension. Server must not resume session.
@ -107,7 +108,7 @@ checkmessages(5, "Session resumption extended master secret test", 1, 1, 0);
clearall();
setrmextms(1, 0);
($fh, $session) = tempfile();
(undef, $session) = tempfile();
$proxy->serverconnects(2);
$proxy->clientflags("-sess_out ".$session);
$proxy->start();
@ -116,6 +117,7 @@ $proxy->clientflags("-sess_in ".$session);
setrmextms(0, 0);
$proxy->clientstart();
checkmessages(6, "Session resumption extended master secret test", 1, 1, 1);
unlink $session;
#Test 7: Session resumption extended master secret test resumed session
# omits client extension. Server must abort connection.
@ -123,7 +125,7 @@ checkmessages(6, "Session resumption extended master secret test", 1, 1, 1);
clearall();
setrmextms(0, 0);
($fh, $session) = tempfile();
(undef, $session) = tempfile();
$proxy->serverconnects(2);
$proxy->clientflags("-sess_out ".$session);
$proxy->start();
@ -132,6 +134,7 @@ $proxy->clientflags("-sess_in ".$session);
setrmextms(1, 0);
$proxy->clientstart();
ok(TLSProxy::Message->fail(), "Client inconsistent session resumption");
unlink $session;
#Test 8: Session resumption extended master secret test resumed session
# omits server extension. Client must abort connection.
@ -139,7 +142,7 @@ ok(TLSProxy::Message->fail(), "Client inconsistent session resumption");
clearall();
setrmextms(0, 0);
($fh, $session) = tempfile();
(undef, $session) = tempfile();
$proxy->serverconnects(2);
$proxy->clientflags("-sess_out ".$session);
$proxy->start();
@ -148,6 +151,7 @@ $proxy->clientflags("-sess_in ".$session);
setrmextms(0, 1);
$proxy->clientstart();
ok(TLSProxy::Message->fail(), "Server inconsistent session resumption 1");
unlink $session;
#Test 9: Session resumption extended master secret test initial session
# omits server extension. Client must abort connection.
@ -155,7 +159,7 @@ ok(TLSProxy::Message->fail(), "Server inconsistent session resumption 1");
clearall();
setrmextms(0, 1);
($fh, $session) = tempfile();
(undef, $session) = tempfile();
$proxy->serverconnects(2);
$proxy->clientflags("-sess_out ".$session);
$proxy->start();
@ -164,6 +168,7 @@ $proxy->clientflags("-sess_in ".$session);
setrmextms(0, 0);
$proxy->clientstart();
ok(TLSProxy::Message->fail(), "Server inconsistent session resumption 2");
unlink $session;
sub extms_filter
{