From 17cde9c2e404a0ada05601fb726dbaed6c532112 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 16 Apr 2018 14:13:07 +0200 Subject: [PATCH] TLSProxy/Proxy.pm: refine NewSessionTicket detection. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/5975) --- util/perl/TLSProxy/Proxy.pm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/util/perl/TLSProxy/Proxy.pm b/util/perl/TLSProxy/Proxy.pm index 9e9764d401..df17731b2d 100644 --- a/util/perl/TLSProxy/Proxy.pm +++ b/util/perl/TLSProxy/Proxy.pm @@ -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}) { -- 2.25.1