[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-49]
dumb tiny tweaks
This commit is contained in:
parent
eb60811594
commit
7b4cd51b76
|
@ -321,7 +321,7 @@ class BufferedFile (object):
|
||||||
return
|
return
|
||||||
# even if we're line buffering, if the buffer has grown past the
|
# even if we're line buffering, if the buffer has grown past the
|
||||||
# buffer size, force a flush.
|
# buffer size, force a flush.
|
||||||
if len(self._wbuffer.getvalue()) >= self._bufsize:
|
if self._wbuffer.tell() >= self._bufsize:
|
||||||
self.flush()
|
self.flush()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,7 @@ class KexGex (object):
|
||||||
pack = self.transport._get_modulus_pack()
|
pack = self.transport._get_modulus_pack()
|
||||||
if pack is None:
|
if pack is None:
|
||||||
raise SSHException('Can\'t do server-side gex with no modulus pack')
|
raise SSHException('Can\'t do server-side gex with no modulus pack')
|
||||||
|
self.transport._log(DEBUG, 'Picking p (%d <= %d <= %d bits)' % (minbits, preferredbits, maxbits))
|
||||||
self.g, self.p = pack.get_modulus(minbits, preferredbits, maxbits)
|
self.g, self.p = pack.get_modulus(minbits, preferredbits, maxbits)
|
||||||
m = Message()
|
m = Message()
|
||||||
m.add_byte(chr(_MSG_KEXDH_GEX_GROUP))
|
m.add_byte(chr(_MSG_KEXDH_GEX_GROUP))
|
||||||
|
@ -201,6 +202,3 @@ class KexGex (object):
|
||||||
self.transport._set_K_H(K, SHA.new(str(hm)).digest())
|
self.transport._set_K_H(K, SHA.new(str(hm)).digest())
|
||||||
self.transport._verify_key(host_key, sig)
|
self.transport._verify_key(host_key, sig)
|
||||||
self.transport._activate_outbound()
|
self.transport._activate_outbound()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ class RSAKey (PKey):
|
||||||
if msg.get_string() != 'ssh-rsa':
|
if msg.get_string() != 'ssh-rsa':
|
||||||
return False
|
return False
|
||||||
sig = util.inflate_long(msg.get_string(), True)
|
sig = util.inflate_long(msg.get_string(), True)
|
||||||
# verify the signature by SHA'ing the data and encrypting it using theŒ
|
# verify the signature by SHA'ing the data and encrypting it using the
|
||||||
# public key. some wackiness ensues where we "pkcs1imify" the 20-byte
|
# public key. some wackiness ensues where we "pkcs1imify" the 20-byte
|
||||||
# hash into a string as long as the RSA key.
|
# hash into a string as long as the RSA key.
|
||||||
hash = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), True)
|
hash = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), True)
|
||||||
|
|
|
@ -433,14 +433,13 @@ class SFTPTest (unittest.TestCase):
|
||||||
def test_E_big_file(self):
|
def test_E_big_file(self):
|
||||||
"""
|
"""
|
||||||
write a 1MB file, with no linefeeds, using line buffering.
|
write a 1MB file, with no linefeeds, using line buffering.
|
||||||
FIXME: this is slow! what causes the slowness?
|
|
||||||
"""
|
"""
|
||||||
global g_big_file_test
|
global g_big_file_test
|
||||||
if not g_big_file_test:
|
if not g_big_file_test:
|
||||||
return
|
return
|
||||||
kblob = (1024 * 'x')
|
kblob = (1024 * 'x')
|
||||||
try:
|
try:
|
||||||
f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 1)
|
f = sftp.open('%s/hongry.txt' % FOLDER, 'w')
|
||||||
for n in range(1024):
|
for n in range(1024):
|
||||||
f.write(kblob)
|
f.write(kblob)
|
||||||
if n % 128 == 0:
|
if n % 128 == 0:
|
||||||
|
|
Loading…
Reference in New Issue