mirror of
https://github.com/openssl/openssl.git
synced 2024-12-14 04:24:23 +08:00
TLSProxy/Record.pm: add is_fatal_alert method.
(resolve uninitialized variable warning and harmonize output). Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5975)
This commit is contained in:
parent
17cde9c2e4
commit
3f1f62b97b
@ -67,17 +67,13 @@ sub get_records
|
||||
|
||||
my $recnum = 1;
|
||||
while (length ($packet) > 0) {
|
||||
print " Record $recnum";
|
||||
if ($server) {
|
||||
print " (server -> client)\n";
|
||||
} else {
|
||||
print " (client -> server)\n";
|
||||
}
|
||||
print " Record $recnum ", $server ? "(server -> client)\n"
|
||||
: "(client -> server)\n";
|
||||
|
||||
#Get the record header (unpack can't fail if $packet is too short)
|
||||
my ($content_type, $version, $len) = unpack('Cnn', $packet);
|
||||
|
||||
if (length($packet) < TLS_RECORD_HEADER_LENGTH + $len) {
|
||||
if (length($packet) < TLS_RECORD_HEADER_LENGTH + ($len // 0)) {
|
||||
print "Partial data : ".length($packet)." bytes\n";
|
||||
$partial = $packet;
|
||||
last;
|
||||
@ -389,4 +385,16 @@ sub outer_content_type
|
||||
}
|
||||
return $self->{outer_content_type};
|
||||
}
|
||||
sub is_fatal_alert
|
||||
{
|
||||
my $self = shift;
|
||||
my $server = shift;
|
||||
|
||||
if (($self->{flight} & 1) == $server
|
||||
&& $self->{content_type} == TLSProxy::Record::RT_ALERT) {
|
||||
my ($level, $alert) = unpack('CC', $self->decrypt_data);
|
||||
return $alert if ($level == 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user