line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package Net::SSH::AuthorizedKey::SSH1; |
3
|
|
|
|
|
|
|
########################################### |
4
|
11
|
|
|
11
|
|
55
|
use strict; |
|
11
|
|
|
|
|
14
|
|
|
11
|
|
|
|
|
398
|
|
5
|
11
|
|
|
11
|
|
57
|
use warnings; |
|
11
|
|
|
|
|
60
|
|
|
11
|
|
|
|
|
285
|
|
6
|
11
|
|
|
11
|
|
4866
|
use Net::SSH::AuthorizedKey::Base; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
389
|
|
7
|
11
|
|
|
11
|
|
64
|
use base qw(Net::SSH::AuthorizedKey::Base); |
|
11
|
|
|
|
|
14
|
|
|
11
|
|
|
|
|
1310
|
|
8
|
11
|
|
|
11
|
|
62
|
use Log::Log4perl qw(:easy); |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
76
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @REQUIRED_FIELDS = qw( |
11
|
|
|
|
|
|
|
keylen exponent |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->make_accessor( $_ ) for @REQUIRED_FIELDS; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# No additional options, only global ones |
17
|
|
|
|
|
|
|
our %VALID_OPTIONS = (); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
########################################### |
20
|
|
|
|
|
|
|
sub new { |
21
|
|
|
|
|
|
|
########################################### |
22
|
15
|
|
|
15
|
0
|
33
|
my($class, %options) = @_; |
23
|
|
|
|
|
|
|
|
24
|
15
|
|
|
|
|
77
|
return $class->SUPER::new( %options, type => "ssh-1" ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
########################################### |
28
|
|
|
|
|
|
|
sub key_read { |
29
|
|
|
|
|
|
|
############################################ |
30
|
124
|
|
|
124
|
0
|
132
|
my($class, $line) = @_; |
31
|
|
|
|
|
|
|
|
32
|
124
|
100
|
|
|
|
353
|
if($line !~ s/^(\d+)\s*//) { |
33
|
106
|
|
|
|
|
222
|
DEBUG "Cannot find ssh-1 keylen"; |
34
|
106
|
|
|
|
|
689
|
return undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
18
|
|
|
|
|
37
|
my $keylen = $1; |
38
|
18
|
|
|
|
|
55
|
DEBUG "Parsed keylen: $keylen"; |
39
|
|
|
|
|
|
|
|
40
|
18
|
100
|
|
|
|
120
|
if($line !~ s/^(\d+)\s*//) { |
41
|
2
|
|
|
|
|
6
|
DEBUG "Cannot find ssh-1 exponent"; |
42
|
2
|
|
|
|
|
11
|
return undef; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
16
|
|
|
|
|
26
|
my $exponent = $1; |
46
|
16
|
|
|
|
|
33
|
DEBUG "Parsed exponent: $exponent"; |
47
|
|
|
|
|
|
|
|
48
|
16
|
100
|
|
|
|
97
|
if($line !~ s/^(\d+)\s*//) { |
49
|
1
|
|
|
|
|
3
|
DEBUG "Cannot find ssh-1 key"; |
50
|
1
|
|
|
|
|
6
|
return undef; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
15
|
|
|
|
|
21
|
my $key = $1; |
54
|
15
|
|
|
|
|
34
|
DEBUG "Parsed key: $key"; |
55
|
|
|
|
|
|
|
|
56
|
15
|
|
|
|
|
76
|
my $obj = __PACKAGE__->new(); |
57
|
15
|
|
|
|
|
477
|
$obj->keylen( $keylen ); |
58
|
15
|
|
|
|
|
346
|
$obj->key( $key ); |
59
|
15
|
|
|
|
|
322
|
$obj->exponent( $exponent ); |
60
|
15
|
|
|
|
|
332
|
$obj->email( $line ); |
61
|
15
|
|
|
|
|
328
|
$obj->comment( $line ); |
62
|
|
|
|
|
|
|
|
63
|
15
|
|
|
|
|
51
|
return $obj; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
########################################### |
67
|
|
|
|
|
|
|
sub as_string { |
68
|
|
|
|
|
|
|
########################################### |
69
|
20
|
|
|
20
|
0
|
20
|
my($self) = @_; |
70
|
|
|
|
|
|
|
|
71
|
20
|
|
|
|
|
54
|
my $string = $self->options_as_string(); |
72
|
20
|
100
|
|
|
|
47
|
$string .= " " if length $string; |
73
|
|
|
|
|
|
|
|
74
|
20
|
|
|
|
|
46
|
$string .= "$self->{keylen} $self->{exponent} $self->{key}"; |
75
|
20
|
100
|
|
|
|
58
|
$string .= " $self->{email}" if length $self->{email}; |
76
|
|
|
|
|
|
|
|
77
|
20
|
|
|
|
|
58
|
return $string; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
########################################### |
81
|
|
|
|
|
|
|
sub sanity_check { |
82
|
|
|
|
|
|
|
########################################### |
83
|
2
|
|
|
2
|
0
|
3
|
my($self) = @_; |
84
|
|
|
|
|
|
|
|
85
|
2
|
|
|
|
|
6
|
for my $field (@REQUIRED_FIELDS) { |
86
|
4
|
50
|
|
|
|
105
|
if(! length $self->$field()) { |
87
|
0
|
|
|
|
|
0
|
WARN "ssh-1 sanity check failed '$field' requirement"; |
88
|
0
|
|
|
|
|
0
|
return undef; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
|
|
10
|
return 1; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
########################################### |
96
|
|
|
|
|
|
|
sub option_type { |
97
|
|
|
|
|
|
|
########################################### |
98
|
0
|
|
|
0
|
0
|
|
my($self, $option) = @_; |
99
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
if(exists $VALID_OPTIONS{ $option }) { |
101
|
0
|
|
|
|
|
|
return $VALID_OPTIONS{ $option }; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return undef; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__END__ |