From 7b4cd51b7693f401e926b5e25dcfd1b014e9815f Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Wed, 3 Aug 2005 06:57:51 +0000 Subject: [PATCH] [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-49] dumb tiny tweaks --- paramiko/file.py | 2 +- paramiko/kex_gex.py | 4 +--- paramiko/rsakey.py | 2 +- tests/test_sftp.py | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/paramiko/file.py b/paramiko/file.py index 13d36ac..f066c4a 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -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 diff --git a/paramiko/kex_gex.py b/paramiko/kex_gex.py index 902677d..e0974c1 100644 --- a/paramiko/kex_gex.py +++ b/paramiko/kex_gex.py @@ -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() - - - diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py index 3e9fb41..7751b49 100644 --- a/paramiko/rsakey.py +++ b/paramiko/rsakey.py @@ -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) diff --git a/tests/test_sftp.py b/tests/test_sftp.py index d5de063..fdbbe1a 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -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: