line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::SSH::Backend::Remote; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
159
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Test::SSH::Backend::Base; |
7
|
|
|
|
|
|
|
our @ISA = qw(Test::SSH::Backend::Base); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
2
|
|
|
2
|
0
|
9
|
my ($class, %opts) = @_; |
11
|
2
|
|
|
|
|
11
|
my $sshd = $class->SUPER::new(%opts); |
12
|
|
|
|
|
|
|
|
13
|
2
|
50
|
|
|
|
8
|
if (defined $sshd->{password}) { |
14
|
0
|
|
|
|
|
0
|
$sshd->_log("trying to authenticate using given password"); |
15
|
0
|
|
|
|
|
0
|
$sshd->{auth_method} = 'password'; |
16
|
0
|
0
|
|
|
|
0
|
if ($sshd->_test_server) { |
17
|
0
|
|
|
|
|
0
|
$sshd->_log("the given password can be used to connect to host"); |
18
|
0
|
|
|
|
|
0
|
return $sshd; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
5
|
$sshd->_log("trying to authenticate using keys"); |
23
|
2
|
|
|
|
|
222
|
$sshd->{auth_method} = 'publickey'; |
24
|
2
|
|
|
|
|
2
|
for my $key (@{$sshd->{user_keys}}) { |
|
2
|
|
|
|
|
8
|
|
25
|
0
|
|
|
|
|
0
|
$sshd->_log("trying user key '$key'"); |
26
|
0
|
|
|
|
|
0
|
$sshd->{key_path} = $key; |
27
|
0
|
0
|
|
|
|
0
|
if ($sshd->_test_server) { |
28
|
0
|
|
|
|
|
0
|
$sshd->_log("key '$key' can be used to connect to host"); |
29
|
0
|
|
|
|
|
0
|
return $sshd; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
() |
33
|
2
|
|
|
|
|
11
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |