[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-49]

dumb tiny tweaks
This commit is contained in:
Robey Pointer 2005-08-03 06:57:51 +00:00
parent eb60811594
commit 7b4cd51b76
4 changed files with 4 additions and 7 deletions

View File

@ -321,7 +321,7 @@ class BufferedFile (object):
return
# even if we're line buffering, if the buffer has grown past the
# buffer size, force a flush.
if len(self._wbuffer.getvalue()) >= self._bufsize:
if self._wbuffer.tell() >= self._bufsize:
self.flush()
return

View File

@ -119,6 +119,7 @@ class KexGex (object):
pack = self.transport._get_modulus_pack()
if pack is None:
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)
m = Message()
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._verify_key(host_key, sig)
self.transport._activate_outbound()

View File

@ -89,7 +89,7 @@ class RSAKey (PKey):
if msg.get_string() != 'ssh-rsa':
return False
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
# hash into a string as long as the RSA key.
hash = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), True)

View File

@ -433,14 +433,13 @@ class SFTPTest (unittest.TestCase):
def test_E_big_file(self):
"""
write a 1MB file, with no linefeeds, using line buffering.
FIXME: this is slow! what causes the slowness?
"""
global g_big_file_test
if not g_big_file_test:
return
kblob = (1024 * 'x')
try:
f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 1)
f = sftp.open('%s/hongry.txt' % FOLDER, 'w')
for n in range(1024):
f.write(kblob)
if n % 128 == 0: