Closed jmaslak closed 7 years ago
I don't think we want to die if it is an unknown key type. This would cause the ssh connection to abort whenever a server sent a key that was not supported.
Simply changing:
my $type = $KEY_TYPES{$ssh_name};
to
my $type = $KEY_TYPES{$ssh_name} or return;
should suffice.
I will put this change into the queue for 2.10 release.
If a server sends a key blob (for instance in a SSH2_MSG_KEX_DH_GEX_REPLY) where the key blob has a key that belongs to a type not known to Net::SSH::Perl, Net::SSH::Perl will attempt to load a module named Net::SSH::Perl::Key::.pm. This replaces that behavior with a more user-friendly message and removes the attempt to load the invalid module. It also ensures that even if the user is catching some exceptions, that %NET::SSH::Perl::Key::KEY_TYPES doesn't get the invalid key type added to itself.
I also added a simple test for this bug.