summaryrefslogtreecommitdiff
path: root/lib/jsch-ruby-14125.pch
blob: 7744443ca43671873d6ff74995e5a9736d2f9eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- src/main/java/com/jcraft/jsch/Session.java	2013-05-08 01:10:10.000000000 +0400
+++ src/main/java/com/jcraft/jsch/Session.java	2013-10-04 16:45:08.489140895 +0400
@@ -798,21 +798,23 @@
       HostKey[] keys =
         hkr.getHostKey(chost,
                        (key_type.equals("DSA") ? "ssh-dss" : "ssh-rsa"));
-      String _key= Util.byte2str(Util.toBase64(K_S, 0, K_S.length));
-      for(int j=0; j< keys.length; j++){
-        if(keys[i].getKey().equals(_key) &&
-           keys[j].getMarker().equals("@revoked")){
-          if(userinfo!=null){
-            userinfo.showMessage(
-"The "+ key_type +" host key for "+ host +" is marked as revoked.\n"+
-"This could mean that a stolen key is being used to "+
-"impersonate this host.");
+      if(keys != null){
+        String _key= Util.byte2str(Util.toBase64(K_S, 0, K_S.length));
+        for(int j=0; j< keys.length; j++){
+          if(keys[i].getKey().equals(_key) &&
+             keys[j].getMarker().equals("@revoked")){
+            if(userinfo!=null){
+              userinfo.showMessage(
+                                   "The "+ key_type +" host key for "+ host +" is marked as revoked.\n"+
+                                   "This could mean that a stolen key is being used to "+
+                                   "impersonate this host.");
+            }
+            if(JSch.getLogger().isEnabled(Logger.INFO)){
+              JSch.getLogger().log(Logger.INFO, 
+                                   "Host '"+host+"' has provided revoked key.");
+            }
+            throw new JSchException("revoked HostKey: "+host);
           }
-          if(JSch.getLogger().isEnabled(Logger.INFO)){
-            JSch.getLogger().log(Logger.INFO, 
-                                 "Host '"+host+"' has provided revoked key.");
-          }
-          throw new JSchException("revoked HostKey: "+host);
         }
       }
     }