Ticket #4428: 4428.patch

File 4428.patch, 2.0 KB (added by alanfranzoni, 7 years ago)
  • twisted/conch/ssh/transport.py

    diff -x '*.pyc' -x '*.swp' -x '*.egg-info' -x dropin.cache -urN twisted-90-release-tag.orig/twisted/conch/ssh/transport.py twisted-90-release-tag/twisted/conch/ssh/transport.py
    old new  
    6767    @ivar supportedLanguages: A list of strings representing languages
    6868        supported, from most-preferred to least.
    6969
     70    @ivar supportedVersions: A container of strings representing supported ssh
     71        protcol version numbers.
     72
    7073    @ivar isClient: A boolean indicating whether this is a client or server.
    7174
    7275    @ivar gotVersion: A boolean indicating whether we have receieved the
     
    149152    supportedPublicKeys = ['ssh-rsa', 'ssh-dss']
    150153    supportedCompressions = ['none', 'zlib']
    151154    supportedLanguages = ()
     155    supportedVersions = ('1.99', '2.0')
    152156    isClient = False
    153157    gotVersion = False
    154158    buf = ''
     
    300304                if p.startswith('SSH-'):
    301305                    self.gotVersion = True
    302306                    self.otherVersionString = p.strip()
    303                     if p.split('-')[1] not in ('1.99', '2.0'): # bad version
     307                    if p.split('-')[1] not in self.supportedVersions:
    304308                        self.sendDisconnect(
    305309                            DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED,
    306310                            'bad version ' + p.split('-')[1])
  • twisted/conch/topfiles/4428.feature

    diff -x '*.pyc' -x '*.swp' -x '*.egg-info' -x dropin.cache -urN twisted-90-release-tag.orig/twisted/conch/topfiles/4428.feature twisted-90-release-tag/twisted/conch/topfiles/4428.feature
    old new  
     1twisted.conch.ssh.transport.SSHTransportBase now allows supported ssh protocol versions to be overriden.