diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-09-12 13:01:26 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-09-12 13:01:26 -0700 |
commit | 2023a083888c1b4c1e7ef9f0595436630ba37f8e (patch) | |
tree | f8935aafabed6cd5896231841ad47ee1d78318fb /paramiko/client.py | |
parent | 7fb1bf13a1173de679a1c1fea1533c471c84f610 (diff) | |
parent | d446cf23c2a7765e3f4b3202f3dc3cba4c3b5c45 (diff) | |
download | paramiko-2023a083888c1b4c1e7ef9f0595436630ba37f8e.tar.gz |
Merge branch '2.2'
Diffstat (limited to 'paramiko/client.py')
-rw-r--r-- | paramiko/client.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/paramiko/client.py b/paramiko/client.py index bff223ea..6e2e80ae 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -364,22 +364,21 @@ class SSHClient (ClosingContextManager): server_hostkey_name = "[%s]:%d" % (hostname, port) our_server_keys = None - # If GSS-API Key Exchange is performed we are not required to check the - # host key, because the host is authenticated via GSS-API / SSPI as - # well as our client. - if not self._transport.use_gss_kex: - our_server_keys = self._system_host_keys.get(server_hostkey_name) - if our_server_keys is None: - our_server_keys = self._host_keys.get(server_hostkey_name) - if our_server_keys is not None: - keytype = our_server_keys.keys()[0] - sec_opts = t.get_security_options() - other_types = [x for x in sec_opts.key_types if x != keytype] - sec_opts.key_types = [keytype] + other_types + our_server_keys = self._system_host_keys.get(server_hostkey_name) + if our_server_keys is None: + our_server_keys = self._host_keys.get(server_hostkey_name) + if our_server_keys is not None: + keytype = our_server_keys.keys()[0] + sec_opts = t.get_security_options() + other_types = [x for x in sec_opts.key_types if x != keytype] + sec_opts.key_types = [keytype] + other_types t.start_client(timeout=timeout) - if not self._transport.use_gss_kex: + # If GSS-API Key Exchange is performed we are not required to check the + # host key, because the host is authenticated via GSS-API / SSPI as + # well as our client. + if not self._transport.gss_kex_used: server_key = t.get_remote_server_key() if our_server_keys is None: # will raise exception if the key is rejected |