line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Perl::Util; |
2
|
5
|
|
|
5
|
|
39
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
151
|
|
3
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
132
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
24
|
use vars qw( %FUNC_TO_MOD %EXPORT_TAGS ); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1301
|
|
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
|
|
29
|
my $class = shift; |
41
|
9
|
|
|
|
|
31
|
my $callpack = caller; |
42
|
|
|
|
|
|
|
|
43
|
9
|
|
|
|
|
16
|
my @to_export; |
44
|
9
|
|
|
|
|
30
|
my @args = @_; |
45
|
9
|
|
|
|
|
21
|
for my $item (@args) { |
46
|
|
|
|
|
|
|
push @to_export, |
47
|
22
|
50
|
|
|
|
93
|
$item =~ s/^:// ? @{ $EXPORT_TAGS{$item} || [] } : $item; |
|
9
|
100
|
|
|
|
85
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
9
|
|
|
|
|
17
|
my %loaded; |
51
|
5
|
|
|
5
|
|
51
|
no strict 'refs'; ## no critic |
|
5
|
|
|
|
|
20
|
|
|
5
|
|
|
|
|
871
|
|
52
|
9
|
|
|
|
|
21
|
for my $func (@to_export) { |
53
|
44
|
|
|
|
|
151
|
my $mod = join '::', __PACKAGE__, $FUNC_TO_MOD{$func}; |
54
|
44
|
50
|
|
|
|
105
|
unless ($loaded{$mod}) { |
55
|
44
|
|
|
|
|
234
|
(my $lib = $mod . ".pm") =~ s!::!/!g; |
56
|
44
|
|
|
|
|
9125
|
require $lib; |
57
|
|
|
|
|
|
|
} |
58
|
44
|
|
|
|
|
94
|
*{"${callpack}::$func"} = \&{"${mod}::$func"}; |
|
44
|
|
|
|
|
417
|
|
|
44
|
|
|
|
|
167
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
__END__ |