diff options
-rw-r--r-- | paramiko/client.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/paramiko/client.py b/paramiko/client.py index 0e556608..e9099851 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -350,11 +350,12 @@ class SSHClient (ClosingContextManager): t = self._transport = Transport( sock, gss_kex=gss_kex, gss_deleg_creds=gss_deleg_creds) t.use_compression(compress=compress) - if gss_host is None: - t.set_gss_host(hostname, gss_trust_dns) - elif gss_host is not None: - # Don't canonicalize gss_host - t.set_gss_host(gss_host, False) + if gss_kex: + if gss_host is None: + t.set_gss_host(hostname, gss_trust_dns) + elif gss_host is not None: + # Don't canonicalize gss_host + t.set_gss_host(gss_host, False) if self._log_channel is not None: t.set_log_channel(self._log_channel) if banner_timeout is not None: |