| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::SSH::W32Perl; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
10026
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
33
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
53
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
774
|
use IO::Socket; |
|
|
1
|
|
|
|
|
31469
|
|
|
|
1
|
|
|
|
|
4
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2082
|
use Net::SSH::Perl; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Net::SSH::Perl::Constants qw( :protocol ); |
|
10
|
|
|
|
|
|
|
use constant DEFAULT_SSH_PORT => '22'; |
|
11
|
|
|
|
|
|
|
use constant IS_WIN32 => ($^O =~ /MSWin32/i); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use vars qw/ $VERSION @ISA/; |
|
14
|
|
|
|
|
|
|
$VERSION = '0.05'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
@ISA = qw/Net::SSH::Perl/; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _init { |
|
19
|
|
|
|
|
|
|
my $ssh = shift; |
|
20
|
|
|
|
|
|
|
my %arg = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$arg{protocol} = 2 unless exists $arg{protocol}; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$ssh->SUPER::_init(%arg); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _connect { |
|
28
|
|
|
|
|
|
|
my $ssh = shift; |
|
29
|
|
|
|
|
|
|
return $ssh->SUPER::_connect(@_) unless IS_WIN32; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $rport = $ssh->{config}->get('port') || DEFAULT_SSH_PORT; |
|
32
|
|
|
|
|
|
|
my $rhost = $ssh->{host}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$ssh->debug("Connecting to $ssh->{host}, port $rport."); |
|
35
|
|
|
|
|
|
|
my $sock = IO::Socket::INET->new( |
|
36
|
|
|
|
|
|
|
PeerAddr => $rhost, |
|
37
|
|
|
|
|
|
|
PeerPort => $rport, |
|
38
|
|
|
|
|
|
|
Proto => 'tcp' |
|
39
|
|
|
|
|
|
|
) || die "Can't connect to $rhost: $!\n"; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$ssh->{session}{sock} = $sock; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $t = $|; |
|
44
|
|
|
|
|
|
|
$| = 0; |
|
45
|
|
|
|
|
|
|
$ssh->debug("Socket created, turning on blocking..."); |
|
46
|
|
|
|
|
|
|
$sock->blocking(1); |
|
47
|
|
|
|
|
|
|
$ssh->_exchange_identification; |
|
48
|
|
|
|
|
|
|
$sock->blocking(0); |
|
49
|
|
|
|
|
|
|
$| = $t; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$ssh->debug("Connection established."); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub protocol_class { |
|
55
|
|
|
|
|
|
|
return shift->SUPER::protocol_class(@_) unless IS_WIN32; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
die "SSH2 is the only supported protocol under MSWin32!" |
|
58
|
|
|
|
|
|
|
unless (PROTOCOL_SSH2 == $_[1]); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
return 'Net::SSH::W32Perl::SSH2'; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub Close {} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
|
66
|
|
|
|
|
|
|
__END__ |