I've decided that I would try out the Net::SSH::Perl module and have
thusly installed it through CPAN
I am just trying to connect to an SSH server and have put in the login
and password in manually but it seems it never get's to that point.
What occurs is is get's to the "Trying empty user-authentication
request." and then it comes back with "Connection closed by remote
host. at /usr/../site_perl/5.8.5/Net/SSH/Perl/AuthMgr.pm line 142"
At that point in the code there are the following variables:
$class: Net::SSH::Perl::Packet
$SSH : Net::SSH::Perl::SSH2=3DHASH(0x12762c)
$Sock: GLOB(0x552914)
$len : 0
Now of course it goes out cause len is 0 but I can't seem to make it
not 0. Is this something on the script side or is the SSH server not
doing something it should be doing?
Any help would be appriciated. Below is the sections of code effected:
sub send_auth_none {
my $amgr =3D shift;
my $ssh =3D $amgr->{ssh};
$ssh->debug("Trying empty user-authentication request.");
my $packet =3D $ssh->packet_start(SSH2_MSG_USERAUTH_REQUEST);
$packet->put_str($ssh->config->get('user'));
$packet->put_str("ssh-connection");
$packet->put_str("none");
$packet->send;
}
sub read {
my $class =3D shift;
my $ssh =3D shift;
my $sock =3D $ssh->sock;
while (1) {
if (my $packet =3D $class->read_poll($ssh)) {
return $packet;
}
my $s =3D IO::Select->new( $sock );
my @ready =3D $s->can_read;
my $buf;
print "----Info----\n$class\n$ssh\n$sock\n";
my $len =3D sysread $sock, $buf, 8192;
print $len, "\n";
croak "Connection closed by remote host." if $len =3D=3D 0;
if (!defined $len) {
next if $! =3D=3D EAGAIN || $! =3D=3D EWOULDBLOCK;
croak "Read from socket failed: $!";
}
## Untaint data read from sshd. This is binary data,
## so there's nothing to taint-check against/for.
($buf) =3D $buf =3D~ /(.*)/s;
$ssh->incoming_data->append($buf);
}
}
|