| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lim::RPC::TLS; |
|
2
|
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
46
|
use common::sense; |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
70
|
|
|
4
|
7
|
|
|
7
|
|
371
|
use Carp; |
|
|
7
|
|
|
|
|
19
|
|
|
|
7
|
|
|
|
|
573
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
46
|
use Log::Log4perl (); |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
118
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
8836
|
use AnyEvent::TLS (); |
|
|
7
|
|
|
|
|
151664
|
|
|
|
7
|
|
|
|
|
230
|
|
|
9
|
7
|
|
|
7
|
|
90
|
use Net::SSLeay (); |
|
|
7
|
|
|
|
|
18
|
|
|
|
7
|
|
|
|
|
124
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
7
|
|
|
7
|
|
45
|
use Lim (); |
|
|
7
|
|
|
|
|
17
|
|
|
|
7
|
|
|
|
|
8455
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=encoding utf8 |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
... |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 VERSION |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
See L for version. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = $Lim::VERSION; |
|
26
|
|
|
|
|
|
|
our $INSTANCE; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
... |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 new |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
|
39
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
|
40
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
|
41
|
0
|
|
|
|
|
|
my $self = { |
|
42
|
|
|
|
|
|
|
logger => Log::Log4perl->get_logger, |
|
43
|
|
|
|
|
|
|
}; |
|
44
|
0
|
|
|
|
|
|
bless $self, $class; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
eval { |
|
47
|
0
|
0
|
|
|
|
|
if (!defined Lim::Config->{rpc}->{tls}->{key_file}) { |
|
|
|
0
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$@ = 'No key_file set'; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
elsif (!defined Lim::Config->{rpc}->{tls}->{cert_file}) { |
|
51
|
0
|
|
|
|
|
|
$@ = 'No cert_file set'; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
else { |
|
54
|
0
|
|
|
|
|
|
$self->{tls_ctx} = AnyEvent::TLS->new(%{Lim::Config->{rpc}->{tls}}); |
|
|
0
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
}; |
|
57
|
0
|
0
|
|
|
|
|
if ($@) { |
|
58
|
0
|
0
|
|
|
|
|
Lim::OBJ_DEBUG and $self->{logger}->debug('Unable to initialize TLS context, will not use TLS/SSL: ', $@); |
|
59
|
0
|
|
|
|
|
|
$self->{tls_ctx} = undef; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
Lim::OBJ_DEBUG and $self->{logger}->debug('new ', __PACKAGE__, ' ', $self); |
|
63
|
0
|
|
|
|
|
|
$self; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub DESTROY { |
|
67
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
68
|
0
|
0
|
|
|
|
|
Lim::OBJ_DEBUG and $self->{logger}->debug('destroy ', __PACKAGE__, ' ', $self); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
END { |
|
72
|
7
|
|
|
7
|
|
999055
|
undef($INSTANCE); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 instance |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub instance { |
|
80
|
0
|
|
0
|
0
|
1
|
|
$INSTANCE ||= Lim::RPC::TLS->new; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 tls_ctx |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub tls_ctx { |
|
88
|
0
|
|
|
0
|
1
|
|
$_[0]->{tls_ctx}; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Jerry Lundström, C<< >> |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Please report any bugs or feature requests to L. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SUPPORT |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
perldoc Lim |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
You can also look for information at: |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=over 4 |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * Lim issue tracker (report bugs here) |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
L |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Copyright 2012-2013 Jerry Lundström. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
122
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
123
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; # End of Lim::RPC::TLS |