DJabberd/Connection/OldSSLClientIn.pm

filter: Statementstmt 62.8% 22 / 35 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 57.6% 30 / 52 CC 5 SCAR 25.7
CC
5
Cov
51%
new
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 13.1
« DJabberd/Component/External.pm ↑ Summary DJabberd/Connection/DialbackVerify.pm »
1 package DJabberd::Connection::OldSSLClientIn;
2 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 17 ▶use base 'DJabberd::Connection::ClientIn';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use DJabberd::Stanza::StartTLS;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 17 ▶use Net::SSLeay;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 17 ▶use constant SSL_MODE_ENABLE_PARTIAL_WRITE => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 17 ▶use constant SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 17 ▶use constant SSL_MODE_AUTO_RETRY => 4;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub new {
13 0 ▶ my ($class, $sock, $server) = @_;
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
14 0 my $self = $class->SUPER::new($sock, $server);
15  
16 0 ▶ my $ctx = Net::SSLeay::CTX_new()
Branch: 1 branch
BranchTrueFalseTotal
my $ctx = &Net::SSLeay::CTX_new() or die "Failed to create SSL_CTX $!" 0 0 0
17 or die("Failed to create SSL_CTX $!");
18  
19 # compared to the StartTLS, we specifically do not insist on TLS here.
20 # let client do SSL 2/3/whatever. TODO: perhaps force SSL v3?
21 # $Net::SSLeay::ssl_version = 10; # Insist on TLSv1
22  
23 0 ▶ Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
Branch: 1 branch
BranchTrueFalseTotal
&Net::SSLeay::CTX_set_options($ctx, scalar &Net::SSLeay::OP_ALL) and Net::SSLeay::die_if_ssl_error("ssl ctx set options") 0 0 0
24 and Net::SSLeay::die_if_ssl_error("ssl ctx set options");
25  
26 0 ▶ Net::SSLeay::CTX_set_mode($ctx, SSL_MODE_ENABLE_PARTIAL_WRITE)
Branch: 1 branch
BranchTrueFalseTotal
&Net::SSLeay::CTX_set_mode($ctx, 1) and Net::SSLeay::die_if_ssl_error("ssl ctx set options") 0 0 0
27 and Net::SSLeay::die_if_ssl_error("ssl ctx set options");
28  
29 # Following will ask password unless private key is not encrypted
30 0 Net::SSLeay::CTX_use_RSAPrivateKey_file ($ctx, $server->ssl_private_key_file, # server-key.pem',
31 &Net::SSLeay::FILETYPE_PEM);
32 0 Net::SSLeay::die_if_ssl_error("private key");
33  
34 0 Net::SSLeay::CTX_use_certificate_file ($ctx, $server->ssl_cert_file, # 'server-cert.pem',
35 &Net::SSLeay::FILETYPE_PEM);
36 0 Net::SSLeay::die_if_ssl_error("certificate");
37  
38  
39 0 ▶ my $ssl = Net::SSLeay::new($ctx) or die_now("Failed to create SSL $!");
Branch: 1 branch
BranchTrueFalseTotal
my $ssl = &Net::SSLeay::new($ctx) or die_now("Failed to create SSL $!") 0 0 0
40 0 $self->{ssl} = $ssl;
41  
42 0 DJabberd::Stanza::StartTLS->finalize_ssl_negotiation($self, $ssl, $ctx);
43  
44 0 return $self;
45 }
46  
47 17 1;
« DJabberd/Component/External.pm ↑ Summary DJabberd/Connection/DialbackVerify.pm »