#7 Jsch fails if known_hosts contains SSH1 entries

open
nobody
None
5
2004-05-20
2004-05-20
Anonymous
No

esa@netman.lt

If known_hosts is used both for ssh2 and ssh1 then some
problems appear if ("StrictHostKeyChecking", "yes") is set.

known_hosts check should be more strict, for now there
are two types of valid host strings SSHDSS and SSHRSA.
Condition check assumes that if it is not first one
(“ssh-dss”) then it is “ssh-rsa” and ssh1 host string
(“1024”) is taken as valid one. It should be ignored
instead.

The problem could be fixed using this patch:
------------------------------------------------------------
--- KnownHosts.java 2004-01-21 13:11:12.000000000 +0200
+++ fixed/KnownHosts.java 2004-05-20 11:22:18.662990200
+0300
@@ -72,7 +72,8 @@
if(i==-1) break loop;
if(i==0x20){
if(sb.toString().equals("ssh-dss"))
type=SSHDSS;
- else type=SSHRSA;
+ else if(sb.toString().equals("ssh-rsa")) type=SSHRSA;
+ else type=-1;
break;
}
sb.append((char)i);
@@ -93,10 +94,12 @@
//System.out.println(host);
//System.out.println("|"+key+"|");

- HostKey hk = new HostKey(host, type,
+ if (type != -1) {
+ HostKey hk = new HostKey(host, type,
Util.fromBase64(key.getBytes(), 0,
key.length()));
- pool.addElement(hk);
+ pool.addElement(hk);
+ }
}
fis.close();
}
------------------------------------------------------------

It would be nice to get some response from you on this
issue.

Discussion