[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-51]

fix utf8, raise packet size, log exceptions, be more lax with sfp servers
explicitly import utf8 encodings for "freezing" (and also because not all
platforms come with utf8, apparently).  raise the max acceptable packet size
to 8kB, cuz 2kB was too low.  log exceptions at error level instead of debug
level.  and don't reject older sftp servers.
This commit is contained in:
Robey Pointer 2004-05-17 00:43:43 +00:00
parent 4d774d62a5
commit 36a867a017
3 changed files with 10 additions and 7 deletions

View File

@ -23,6 +23,9 @@ L{Transport} is a subclass of L{BaseTransport} that handles authentication.
This separation keeps either class file from being too unwieldy. This separation keeps either class file from being too unwieldy.
""" """
# this helps freezing utils
import encodings.utf_8
from common import * from common import *
import util import util
from transport import BaseTransport from transport import BaseTransport

View File

@ -194,8 +194,8 @@ class SFTP (object):
if t != CMD_VERSION: if t != CMD_VERSION:
raise SFTPError('Incompatible sftp protocol') raise SFTPError('Incompatible sftp protocol')
version = struct.unpack('>I', data[:4])[0] version = struct.unpack('>I', data[:4])[0]
if version != VERSION: # if version != VERSION:
raise SFTPError('Incompatible sftp protocol') # raise SFTPError('Incompatible sftp protocol')
def from_transport(selfclass, t): def from_transport(selfclass, t):
chan = t.open_session() chan = t.open_session()

View File

@ -162,7 +162,7 @@ class BaseTransport (threading.Thread):
self.channel_counter = 1 self.channel_counter = 1
self.logger = logging.getLogger('paramiko.transport') self.logger = logging.getLogger('paramiko.transport')
self.window_size = 65536 self.window_size = 65536
self.max_packet_size = 2048 self.max_packet_size = 8192
self.ultra_debug = 0 self.ultra_debug = 0
self.saved_exception = None self.saved_exception = None
# used for noticing when to re-key: # used for noticing when to re-key:
@ -943,16 +943,16 @@ class BaseTransport (threading.Thread):
msg.add_int(m.seqno) msg.add_int(m.seqno)
self._send_message(msg) self._send_message(msg)
except SSHException, e: except SSHException, e:
self._log(DEBUG, 'Exception: ' + str(e)) self._log(ERROR, 'Exception: ' + str(e))
self._log(DEBUG, util.tb_strings()) self._log(ERROR, util.tb_strings())
self.saved_exception = e self.saved_exception = e
except EOFError, e: except EOFError, e:
self._log(DEBUG, 'EOF') self._log(DEBUG, 'EOF')
self._log(DEBUG, util.tb_strings()) self._log(DEBUG, util.tb_strings())
self.saved_exception = e self.saved_exception = e
except Exception, e: except Exception, e:
self._log(DEBUG, 'Unknown exception: ' + str(e)) self._log(ERROR, 'Unknown exception: ' + str(e))
self._log(DEBUG, util.tb_strings()) self._log(ERROR, util.tb_strings())
self.saved_exception = e self.saved_exception = e
_active_threads.remove(self) _active_threads.remove(self)
for chan in self.channels.values(): for chan in self.channels.values():