fix a few bugs found by pycheck
This commit is contained in:
Robey Pointer 2006-05-10 18:11:40 -07:00
parent 8843feb633
commit 6f4110a066
4 changed files with 9 additions and 6 deletions

View File

@ -838,8 +838,9 @@ class Channel (object):
self._log(ERROR, 'unknown extended_data type %d; discarding' % code) self._log(ERROR, 'unknown extended_data type %d; discarding' % code)
return return
if self.combine_stderr: if self.combine_stderr:
return self._feed(s) self._feed(s)
self.in_stderr_buffer.feed(s) else:
self.in_stderr_buffer.feed(s)
def _window_adjust(self, m): def _window_adjust(self, m):
nbytes = m.get_int() nbytes = m.get_int()

View File

@ -28,7 +28,7 @@ from paramiko.common import *
from paramiko.dsskey import DSSKey from paramiko.dsskey import DSSKey
from paramiko.hostkeys import HostKeys from paramiko.hostkeys import HostKeys
from paramiko.rsakey import RSAKey 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.transport import Transport
from paramiko.util import hexify from paramiko.util import hexify
@ -107,6 +107,7 @@ class SSHClient (object):
self._host_keys_filename = None self._host_keys_filename = None
self._log_channel = None self._log_channel = None
self._policy = RejectPolicy() self._policy = RejectPolicy()
self._transport = None
def load_system_host_keys(self, filename=None): def load_system_host_keys(self, filename=None):
""" """
@ -378,7 +379,7 @@ class SSHClient (object):
filename = os.path.expanduser('~/.ssh/' + filename) filename = os.path.expanduser('~/.ssh/' + filename)
try: try:
key = pkey_class.from_private_key_file(filename, password) 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) self._transport.auth_publickey(username, key)
return return
except SSHException, e: except SSHException, e:

View File

@ -22,6 +22,7 @@ L{SFTPFile}
import socket import socket
import threading import threading
import time
from paramiko.common import * from paramiko.common import *
from paramiko.sftp import * from paramiko.sftp import *
from paramiko.file import BufferedFile from paramiko.file import BufferedFile

View File

@ -62,7 +62,7 @@ class BadAuthenticationType (AuthenticationException):
allowed_types = [] allowed_types = []
def __init__(self, explanation, types): def __init__(self, explanation, types):
SSHException.__init__(self, explanation) AuthenticationException.__init__(self, explanation)
self.allowed_types = types self.allowed_types = types
def __str__(self): def __str__(self):
@ -76,7 +76,7 @@ class PartialAuthentication (AuthenticationException):
allowed_types = [] allowed_types = []
def __init__(self, types): def __init__(self, types):
SSHException.__init__(self, 'partial authentication') AuthenticationException.__init__(self, 'partial authentication')
self.allowed_types = types self.allowed_types = types