line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Perl::Util; |
2
|
5
|
|
|
5
|
|
33
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
144
|
|
3
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
133
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
24
|
use vars qw( %FUNC_TO_MOD %EXPORT_TAGS ); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1229
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
%FUNC_TO_MOD = ( |
8
|
|
|
|
|
|
|
_crc32 => 'SSH1Misc', |
9
|
|
|
|
|
|
|
_compute_session_id => 'SSH1MP', |
10
|
|
|
|
|
|
|
_mp_linearize => 'SSH1MP', |
11
|
|
|
|
|
|
|
_check_host_in_hostfile => 'Hosts', |
12
|
|
|
|
|
|
|
_all_keys_for_host => 'Hosts', |
13
|
|
|
|
|
|
|
_add_host_to_hostfile => 'Hosts', |
14
|
|
|
|
|
|
|
_remove_host_from_hostfile=> 'Hosts', |
15
|
|
|
|
|
|
|
_load_private_key => 'Authfile', |
16
|
|
|
|
|
|
|
_load_public_key => 'Authfile', |
17
|
|
|
|
|
|
|
_save_private_key => 'Authfile', |
18
|
|
|
|
|
|
|
_respond_to_rsa_challenge => 'RSA', |
19
|
|
|
|
|
|
|
_rsa_public_encrypt => 'RSA', |
20
|
|
|
|
|
|
|
_rsa_private_decrypt => 'RSA', |
21
|
|
|
|
|
|
|
_prompt => 'Term', |
22
|
|
|
|
|
|
|
_read_passphrase => 'Term', |
23
|
|
|
|
|
|
|
_read_yes_or_no => 'Term', |
24
|
|
|
|
|
|
|
_current_user_win32 => 'Win32', |
25
|
|
|
|
|
|
|
_socketpair => 'Win32', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
%EXPORT_TAGS = ( |
29
|
|
|
|
|
|
|
hosts => [ qw( _check_host_in_hostfile _all_keys_for_host |
30
|
|
|
|
|
|
|
_add_host_to_hostfile _remove_host_from_hostfile ) ], |
31
|
|
|
|
|
|
|
rsa => [ qw( _rsa_public_encrypt _rsa_private_decrypt |
32
|
|
|
|
|
|
|
_respond_to_rsa_challenge ) ], |
33
|
|
|
|
|
|
|
ssh1mp => [ qw( _compute_session_id _mp_linearize ) ], |
34
|
|
|
|
|
|
|
authfile => [ qw( _load_public_key _load_private_key _save_private_key ) ], |
35
|
|
|
|
|
|
|
win32 => [ qw( _current_user_win32 _socketpair ) ], |
36
|
|
|
|
|
|
|
all => [ keys %FUNC_TO_MOD ], |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub import { |
40
|
9
|
|
|
9
|
|
22
|
my $class = shift; |
41
|
9
|
|
|
|
|
26
|
my $callpack = caller; |
42
|
|
|
|
|
|
|
|
43
|
9
|
|
|
|
|
13
|
my @to_export; |
44
|
9
|
|
|
|
|
25
|
my @args = @_; |
45
|
9
|
|
|
|
|
23
|
for my $item (@args) { |
46
|
|
|
|
|
|
|
push @to_export, |
47
|
22
|
50
|
|
|
|
97
|
$item =~ s/^:// ? @{ $EXPORT_TAGS{$item} || [] } : $item; |
|
9
|
100
|
|
|
|
69
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
9
|
|
|
|
|
17
|
my %loaded; |
51
|
5
|
|
|
5
|
|
37
|
no strict 'refs'; ## no critic |
|
5
|
|
|
|
|
30
|
|
|
5
|
|
|
|
|
854
|
|
52
|
9
|
|
|
|
|
17
|
for my $func (@to_export) { |
53
|
44
|
|
|
|
|
133
|
my $mod = join '::', __PACKAGE__, $FUNC_TO_MOD{$func}; |
54
|
44
|
50
|
|
|
|
98
|
unless ($loaded{$mod}) { |
55
|
44
|
|
|
|
|
197
|
(my $lib = $mod . ".pm") =~ s!::!/!g; |
56
|
44
|
|
|
|
|
8677
|
require $lib; |
57
|
|
|
|
|
|
|
} |
58
|
44
|
|
|
|
|
87
|
*{"${callpack}::$func"} = \&{"${mod}::$func"}; |
|
44
|
|
|
|
|
418
|
|
|
44
|
|
|
|
|
176
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
__END__ |