From 6f4110a06663dc772d228566a8795de395366d38 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Wed, 10 May 2006 18:11:40 -0700 Subject: [PATCH] [project @ robey@lag.net-20060511011140-ab3550c28121f900] fix a few bugs found by pycheck --- paramiko/channel.py | 5 +++-- paramiko/client.py | 5 +++-- paramiko/sftp_file.py | 1 + paramiko/ssh_exception.py | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/paramiko/channel.py b/paramiko/channel.py index a4376e4..b700a1b 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -838,8 +838,9 @@ class Channel (object): self._log(ERROR, 'unknown extended_data type %d; discarding' % code) return if self.combine_stderr: - return self._feed(s) - self.in_stderr_buffer.feed(s) + self._feed(s) + else: + self.in_stderr_buffer.feed(s) def _window_adjust(self, m): nbytes = m.get_int() diff --git a/paramiko/client.py b/paramiko/client.py index b7ffbee..b97445b 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -28,7 +28,7 @@ from paramiko.common import * from paramiko.dsskey import DSSKey from paramiko.hostkeys import HostKeys from paramiko.rsakey import RSAKey -from paramiko.ssh_exception import SSHException +from paramiko.ssh_exception import SSHException, BadHostKeyException from paramiko.transport import Transport from paramiko.util import hexify @@ -107,6 +107,7 @@ class SSHClient (object): self._host_keys_filename = None self._log_channel = None self._policy = RejectPolicy() + self._transport = None def load_system_host_keys(self, filename=None): """ @@ -378,7 +379,7 @@ class SSHClient (object): filename = os.path.expanduser('~/.ssh/' + filename) try: key = pkey_class.from_private_key_file(filename, password) - self._log(DEBUG, 'Trying discovered key %s in %s' % (hexify(key.get_fingerprint(), filename))) + self._log(DEBUG, 'Trying discovered key %s in %s' % (hexify(key.get_fingerprint()), filename)) self._transport.auth_publickey(username, key) return except SSHException, e: diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index 2887986..05c1045 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -22,6 +22,7 @@ L{SFTPFile} import socket import threading +import time from paramiko.common import * from paramiko.sftp import * from paramiko.file import BufferedFile diff --git a/paramiko/ssh_exception.py b/paramiko/ssh_exception.py index 55b0197..1275963 100644 --- a/paramiko/ssh_exception.py +++ b/paramiko/ssh_exception.py @@ -62,7 +62,7 @@ class BadAuthenticationType (AuthenticationException): allowed_types = [] def __init__(self, explanation, types): - SSHException.__init__(self, explanation) + AuthenticationException.__init__(self, explanation) self.allowed_types = types def __str__(self): @@ -76,7 +76,7 @@ class PartialAuthentication (AuthenticationException): allowed_types = [] def __init__(self, types): - SSHException.__init__(self, 'partial authentication') + AuthenticationException.__init__(self, 'partial authentication') self.allowed_types = types