Skip to content

Commit

Permalink
Ignore unknown host key type.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Feb 3, 2022
1 parent 78e810f commit 2244b03
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,14 @@ public void allow(final Host host, final PublicKey key, final boolean persist) {
else {
try {
// Add the host key to the in-memory database
final KeyType type = KeyType.fromKey(key);
switch(type) {
case UNKNOWN:
log.warn(String.format("Unknown key type %s", key));
return;
}
final OpenSSHKnownHosts.HostEntry entry
= new OpenSSHKnownHosts.HostEntry(null, format(host), KeyType.fromKey(key), key);
= new OpenSSHKnownHosts.HostEntry(null, format(host), type, key);
database.entries().add(entry);
if(persist) {
if(file.attributes().getPermission().isWritable()) {
Expand Down

0 comments on commit 2244b03

Please sign in to comment.