[Ssh-sftp-perl-users] Problems Reading Received Data?
Brought to you by:
dbrobins
|
From: Lazar, A. <al...@md...> - 2005-05-19 18:32:35
|
Hello,
I am having problems reading received SSH data on Win32. I don't understand=
why this works in Linux but not on Windows. The command (uname -a; echo a =
> test) is sent successfully to the server. However, it looks like the code=
gets stuck in SSH2::client_loop and no input from the server is received. =
Did anybody encounter this problem?=20
The only difference between this code and the one that I run on Linux is th=
at I use Net::SSH::W32Perl on Windows instead of Net::SSH::Perl.
Here's the code and what happens:
test.pl:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
use Net::SSH::W32Perl;
my $host =3D '<IP_ADDR>';
my $ssh =3D new Net::SSH::W32Perl($host, port=3D>22, debug=3D>1);
$ssh->login('<USER>', '<PASS>');
my ($out, $err, $exit) =3D $ssh->cmd('uname -a; echo a > test');
print("Out: $out\n");
print("Err: $err\n");
print("Exit: $exit\n");
Output on Win32
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
PC1593: Reading configuration data C:\CVS/.ssh/config
PC1593: Reading configuration data /etc/ssh_config
PC1593: Connecting to <IP_ADDR>, port 22.
PC1593: Socket created, turning on blocking...
PC1593: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
PC1593: Net::SSH::Perl Version 1.23, protocol version 2.0.
PC1593: No compat match: OpenSSH_3.9p1.
PC1593: Connection established.
PC1593: Sent key-exchange init (KEXINIT), wait response.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x3443b94)->get_str
PC1593: Algorithms, c->s: 3des-cbc hmac-sha1 none
PC1593: Algorithms, s->c: 3des-cbc hmac-sha1 none
PC1593: Entering Diffie-Hellman Group 1 key exchange.
PC1593: Sent DH public key, waiting for reply.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x321ad3c)->get_str
PC1593: Received host key, type 'ssh-dss'.
PC1593: Host '<IP_ADDR>' is known and matches the host key.
PC1593: Computing shared secret key.
PC1593: Verifying server signature.
PC1593: Waiting for NEWKEYS message.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x351162c)->get_str
PC1593: Enabling incoming encryption/MAC/compression.
PC1593: Send NEWKEYS, enable outgoing encryption/MAC/compression.
PC1593: Sending request for user-authentication service.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x3443cfc)->get_str
PC1593: Service accepted: ssh-userauth.
PC1593: Trying empty user-authentication request.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x34b3314)->get_str
PC1593: Authentication methods that can continue: publickey,password,keyboa=
rd-interactive.
PC1593: Next method to try is publickey.
PC1593: Next method to try is password.
PC1593: Trying password authentication.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x321ac1c)->get_str
PC1593: Login completed, opening dummy shell channel.
PC1593: channel 0: new [client-session]
PC1593: Requesting channel_open for channel 0.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x353ac50)->get_str
PC1593: channel 0: open confirm rwindow 0 rmax 32768
PC1593: Got channel open confirmation, requesting shell.
PC1593: Requesting service shell on channel 0.
PC1593: channel 1: new [client-session]
PC1593: Requesting channel_open for channel 1.
PC1593: Entering interactive session.
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x353fb30)->get_str
SSH2::client_loop: GOT A PACKET?
SSH2::client_loop: Packet Type: Net::SSH::Perl::Packet=3DHASH(0x353fb30)->=
type
SSH2::client_loop second while
SSH2::client_loop buf: =F2T?=C5{9?,?V?r??=F1?=E1D=A3??=DC?=D6?=F9?=DC6Qf=
=E5?=A2=B5=AA?u=BF)?=EE???????=F3?a
Remote Packet: Net::SSH::Perl::Packet=3DHASH(0x353fb18)->get_str
SSH2::client_loop: GOT A PACKET?
SSH2::client_loop: Packet Type: Net::SSH::Perl::Packet=3DHASH(0x353fb18)->=
type
PC1593: Sending command: uname -a; echo a > test
PC1593: Requesting service exec on channel 1.
PC1593: channel 1: open confirm rwindow 0 rmax 32768
SSH2::client_loop second while
SSH2::client_loop buf: oj???=F3u2=B1?=F4?Z??\??n1(=E4??!???J?????,RW??=EB)=
=E7=E0)
SSH2::client_loop: GOT A PACKET?
SSH2::client_loop: Packet Type: Net::SSH::Perl::Packet=3DHASH(0x1beed18)->=
type
SSH2::client_loop second while
Terminating on signal SIGINT(2)
On Linux the program executes and terminates as expected. The command is se=
nt to the server and the server's input is received (uname -a data). Does a=
nybody know what's happening and how this can be fixed?
I'm using perl 5.8.6.
Thanks,
Adrian
|