TLSProxy/Proxy.pm: refine NewSessionTicket detection.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5975)
This commit is contained in:
Andy Polyakov 2018-04-16 14:13:07 +02:00
parent 3f473b936a
commit 17cde9c2e4

View File

@ -369,13 +369,14 @@ sub clientstart
$fdset = IO::Select->new($server_sock, $client_sock);
my @ready;
my $ctr = 0;
my $sessionfile = $self->{sessionfile};
local $SIG{PIPE} = "IGNORE";
$self->{saw_session_ticket} = undef;
while($fdset->count && $ctr < 10) {
if (defined($sessionfile)) {
if (defined($self->{sessionfile})) {
# s_client got -ign_eof and won't be exiting voluntarily, so we
# look for data *and* check on session file...
last if TLSProxy::Message->success() && -s $sessionfile;
# look for data *and* session ticket...
last if TLSProxy::Message->success()
&& $self->{saw_session_ticket};
}
if (!(@ready = $fdset->can_read(1))) {
$ctr++;
@ -449,7 +450,7 @@ sub clientstart
$self->connect_to_server();
}
$pid = $self->{clientpid};
print "Waiting for client process to close: $pid...\n";
print "Waiting for s_client process to close: $pid...\n";
waitpid($pid, 0);
return 1;
@ -496,6 +497,14 @@ sub process_packet
$self->filter->($self);
}
#Take a note on NewSessionTicket
foreach my $message (reverse @{$self->{message_list}}) {
if ($message->{mt} == TLSProxy::Message::MT_NEW_SESSION_TICKET) {
$self->{saw_session_ticket} = 1;
last;
}
}
#Reconstruct the packet
$packet = "";
foreach my $record (@{$self->record_list}) {