This commit is contained in:
garnier-quentin 2016-01-20 14:27:46 +01:00
commit a8f60018b3
1 changed files with 12 additions and 14 deletions

View File

@ -79,27 +79,25 @@ sub run {
my ($self, %options) = @_;
# Global variables
my ($cert, $client);
eval { $client = IO::Socket::SSL->new(
my $client = IO::Socket::SSL->new(
PeerHost => $self->{option_results}->{hostname},
PeerPort => $self->{option_results}->{port},
$self->{option_results}->{servername} ? ( SSL_hostname => $self->{option_results}->{servername} ):(),
) };
if ($@) {
);
if (!defined($client)) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf ("%s", $!));
short_msg => "failed to accept or ssl handshake: $!,$SSL_ERROR");
$self->{output}->display();
$self->{output}->exit()
}
#Retrieve Certificat
my $cert;
eval { $cert = $client->peer_certificate() };
if ($@) {
$self->{output}->output_add(severity => 'CRITICAL',
short_msg => sprintf("%s", $!));
short_msg => sprintf("%s", $@));
$self->{output}->display();
$self->{output}->exit()
}