More type fixups

This commit is contained in:
Scott Maxwell 2013-10-31 11:36:47 -07:00
parent 488d85f981
commit 85ade33ae3
3 changed files with 6 additions and 6 deletions

View File

@ -365,7 +365,7 @@ class HostKeys (MutableMapping):
salt = base64.decodestring(b(salt))
assert len(salt) == SHA.digest_size
hmac = HMAC.HMAC(salt, b(hostname), SHA).digest()
hostkey = '|1|%s|%s' % (base64.encodestring(salt), base64.encodestring(hmac))
hostkey = '|1|%s|%s' % (u(base64.encodestring(salt)), u(base64.encodestring(hmac)))
return hostkey.replace('\n', '')
hash_host = staticmethod(hash_host)

View File

@ -1747,8 +1747,8 @@ class Transport (threading.Thread):
m.add_list(self._preferred_macs)
m.add_list(self._preferred_compression)
m.add_list(self._preferred_compression)
m.add_string('')
m.add_string('')
m.add_string(bytes())
m.add_string(bytes())
m.add_boolean(False)
m.add_int(0)
# save a copy for later (needed to compute a hash)
@ -1948,7 +1948,7 @@ class Transport (threading.Thread):
def _parse_disconnect(self, m):
code = m.get_int()
desc = m.get_string()
desc = m.get_text()
self._log(INFO, 'Disconnect (code %d): %s' % (code, desc))
def _parse_global_request(self, m):

View File

@ -33,7 +33,7 @@ from paramiko import Transport, SecurityOptions, ServerInterface, RSAKey, DSSKey
SSHException, BadAuthenticationType, InteractiveQuery, ChannelException
from paramiko import AUTH_FAILED, AUTH_PARTIALLY_SUCCESSFUL, AUTH_SUCCESSFUL
from paramiko import OPEN_SUCCEEDED, OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
from paramiko.common import MSG_KEXINIT, MSG_CHANNEL_WINDOW_ADJUST
from paramiko.common import MSG_KEXINIT, MSG_CHANNEL_WINDOW_ADJUST, b
from paramiko.message import Message
from tests.loop import LoopSocket
from tests.util import ParamikoTest, test_path
@ -162,7 +162,7 @@ class TransportTest(ParamikoTest):
self.tc.H = unhexlify('0C8307CDE6856FF30BA93684EB0F04C2520E9ED3')
self.tc.session_id = self.tc.H
key = self.tc._compute_key('C', 32)
self.assertEquals('207E66594CA87C44ECCBA3B3CD39FDDB378E6FDB0F97C54B2AA0CFBF900CD995',
self.assertEquals(b('207E66594CA87C44ECCBA3B3CD39FDDB378E6FDB0F97C54B2AA0CFBF900CD995'),
hexlify(key).upper())
def test_3_simple(self):