View | Details | Raw Unified | Return to bug 216533
Collapse All | Expand All

(-)Makefile (-1 / +1 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	paramiko
4
PORTNAME=	paramiko
5
PORTVERSION=	2.0.5
5
PORTVERSION=	2.2.1
6
CATEGORIES=	security python
6
CATEGORIES=	security python
7
MASTER_SITES=	CHEESESHOP
7
MASTER_SITES=	CHEESESHOP
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1487797591
1
TIMESTAMP = 1501425369
2
SHA256 (paramiko-2.0.5.tar.gz) = 9fd9381326465ede02b5447d7d3b77332e7719e2ee82f39eb4cd342b8437bfe8
2
SHA256 (paramiko-2.2.1.tar.gz) = ff94ae65379914ec3c960de731381f49092057b6dd1d24d18842ead5a2eb2277
3
SIZE (paramiko-2.0.5.tar.gz) = 1191546
3
SIZE (paramiko-2.2.1.tar.gz) = 1205818
(-)files/patch-paramiko_client.py (+44 lines)
Line 0 Link Here
1
--- paramiko/client.py.orig	2017-07-30 14:38:18 UTC
2
+++ paramiko/client.py
3
@@ -331,6 +331,30 @@ class SSHClient (ClosingContextManager):
4
         t = self._transport = Transport(
5
             sock, gss_kex=gss_kex, gss_deleg_creds=gss_deleg_creds)
6
         t.use_compression(compress=compress)
7
+
8
+        if port == SSH_PORT:
9
+            server_hostkey_name = hostname
10
+        else:
11
+            server_hostkey_name = "[%s]:%d" % (hostname, port)
12
+
13
+        # if we already have a host key stored, change our key preference
14
+        known_host_keys = {}
15
+        known_host_keys.update(
16
+            self._system_host_keys.get(server_hostkey_name, {})
17
+        )
18
+        known_host_keys.update(
19
+            self.get_host_keys().get(server_hostkey_name, {})
20
+        )
21
+
22
+        if known_host_keys:
23
+            # order the keys as follows: known keys in preferred-keys order,
24
+            # then unknown keys in preferred-keys order
25
+            valid_known_keys = [k for k in t._preferred_keys
26
+                                if k in known_host_keys]
27
+            t._preferred_keys = (valid_known_keys
28
+                                 + [k for k in t._preferred_keys
29
+                                    if k not in valid_known_keys])
30
+
31
         if gss_kex and gss_host is None:
32
             t.set_gss_host(hostname)
33
         elif gss_kex and gss_host is not None:
34
@@ -344,10 +368,6 @@ class SSHClient (ClosingContextManager):
35
         if auth_timeout is not None:
36
             t.auth_timeout = auth_timeout
37
 
38
-        if port == SSH_PORT:
39
-            server_hostkey_name = hostname
40
-        else:
41
-            server_hostkey_name = "[%s]:%d" % (hostname, port)
42
         our_server_keys = None
43
 
44
         # If GSS-API Key Exchange is performed we are not required to check the

Return to bug 216533