From: Andy Polyakov Date: Mon, 16 Apr 2018 12:13:07 +0000 (+0200) Subject: TLSProxy/Proxy.pm: refine NewSessionTicket detection. X-Git-Tag: OpenSSL_1_1_1-pre6~90 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=17cde9c2e404a0ada05601fb726dbaed6c532112;p=oweals%2Fopenssl.git TLSProxy/Proxy.pm: refine NewSessionTicket detection. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/5975) --- 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}) {