line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package Net::SSH::AuthorizedKey::SSH1; |
3
|
|
|
|
|
|
|
########################################### |
4
|
11
|
|
|
11
|
|
116
|
use strict; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
409
|
|
5
|
11
|
|
|
11
|
|
55
|
use warnings; |
|
11
|
|
|
|
|
61
|
|
|
11
|
|
|
|
|
273
|
|
6
|
11
|
|
|
11
|
|
7275
|
use Net::SSH::AuthorizedKey::Base; |
|
11
|
|
|
|
|
31
|
|
|
11
|
|
|
|
|
471
|
|
7
|
11
|
|
|
11
|
|
75
|
use base qw(Net::SSH::AuthorizedKey::Base); |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
1420
|
|
8
|
11
|
|
|
11
|
|
97
|
use Log::Log4perl qw(:easy); |
|
11
|
|
|
|
|
27
|
|
|
11
|
|
|
|
|
83
|
|
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
|
31
|
my($class, %options) = @_; |
23
|
|
|
|
|
|
|
|
24
|
15
|
|
|
|
|
76
|
return $class->SUPER::new( %options, type => "ssh-1" ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
########################################### |
28
|
|
|
|
|
|
|
sub key_read { |
29
|
|
|
|
|
|
|
############################################ |
30
|
122
|
|
|
122
|
0
|
170
|
my($class, $line) = @_; |
31
|
|
|
|
|
|
|
|
32
|
122
|
100
|
|
|
|
370
|
if($line !~ s/^(\d+)\s*//) { |
33
|
104
|
|
|
|
|
231
|
DEBUG "Cannot find ssh-1 keylen"; |
34
|
104
|
|
|
|
|
787
|
return undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
18
|
|
|
|
|
43
|
my $keylen = $1; |
38
|
18
|
|
|
|
|
68
|
DEBUG "Parsed keylen: $keylen"; |
39
|
|
|
|
|
|
|
|
40
|
18
|
100
|
|
|
|
189
|
if($line !~ s/^(\d+)\s*//) { |
41
|
2
|
|
|
|
|
8
|
DEBUG "Cannot find ssh-1 exponent"; |
42
|
2
|
|
|
|
|
17
|
return undef; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
16
|
|
|
|
|
33
|
my $exponent = $1; |
46
|
16
|
|
|
|
|
49
|
DEBUG "Parsed exponent: $exponent"; |
47
|
|
|
|
|
|
|
|
48
|
16
|
100
|
|
|
|
131
|
if($line !~ s/^(\d+)\s*//) { |
49
|
1
|
|
|
|
|
4
|
DEBUG "Cannot find ssh-1 key"; |
50
|
1
|
|
|
|
|
7
|
return undef; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
15
|
|
|
|
|
28
|
my $key = $1; |
54
|
15
|
|
|
|
|
51
|
DEBUG "Parsed key: $key"; |
55
|
|
|
|
|
|
|
|
56
|
15
|
|
|
|
|
99
|
my $obj = __PACKAGE__->new(); |
57
|
15
|
|
|
|
|
528
|
$obj->keylen( $keylen ); |
58
|
15
|
|
|
|
|
684
|
$obj->key( $key ); |
59
|
15
|
|
|
|
|
480
|
$obj->exponent( $exponent ); |
60
|
15
|
|
|
|
|
444
|
$obj->email( $line ); |
61
|
15
|
|
|
|
|
664
|
$obj->comment( $line ); |
62
|
|
|
|
|
|
|
|
63
|
15
|
|
|
|
|
62
|
return $obj; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
########################################### |
67
|
|
|
|
|
|
|
sub as_string { |
68
|
|
|
|
|
|
|
########################################### |
69
|
20
|
|
|
20
|
0
|
150
|
my($self) = @_; |
70
|
|
|
|
|
|
|
|
71
|
20
|
|
|
|
|
75
|
my $string = $self->options_as_string(); |
72
|
20
|
100
|
|
|
|
56
|
$string .= " " if length $string; |
73
|
|
|
|
|
|
|
|
74
|
20
|
|
|
|
|
214
|
$string .= "$self->{keylen} $self->{exponent} $self->{key}"; |
75
|
20
|
100
|
|
|
|
146
|
$string .= " $self->{email}" if length $self->{email}; |
76
|
|
|
|
|
|
|
|
77
|
20
|
|
|
|
|
161
|
return $string; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
########################################### |
81
|
|
|
|
|
|
|
sub sanity_check { |
82
|
|
|
|
|
|
|
########################################### |
83
|
2
|
|
|
2
|
0
|
4
|
my($self) = @_; |
84
|
|
|
|
|
|
|
|
85
|
2
|
|
|
|
|
4
|
for my $field (@REQUIRED_FIELDS) { |
86
|
4
|
50
|
|
|
|
99
|
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
|
|
|
|
|
9
|
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__ |