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