summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobey Pointer <robey@master-shake.local>2006-01-26 12:49:25 -0800
committerRobey Pointer <robey@master-shake.local>2006-01-26 12:49:25 -0800
commitd44035e71626c63fd72e9c4c8ace9e6281587f0b (patch)
tree8d4a896ef37563ef8c5d14f2717fb1372c38e14c
parentf5421e76001bb2a2e4308e70d87801629b67a0db (diff)
[project @ robey@master-shake.local-20060126204925-3cc14de36a8c5c1f]
winscp doesn't like it if the server sends version info before the client does
-rw-r--r--paramiko/sftp.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/paramiko/sftp.py b/paramiko/sftp.py
index 58d71030..8726eec4 100644
--- a/paramiko/sftp.py
+++ b/paramiko/sftp.py
@@ -113,16 +113,18 @@ class BaseSFTP (object):
return version
def _send_server_version(self):
+ # winscp will freak out if the server sends version info before the
+ # client finishes sending INIT.
+ t, data = self._read_packet()
+ if t != CMD_INIT:
+ raise SFTPError('Incompatible sftp protocol')
+ version = struct.unpack('>I', data[:4])[0]
# advertise that we support "check-file"
extension_pairs = [ 'check-file', 'md5,sha1' ]
msg = Message()
msg.add_int(_VERSION)
msg.add(*extension_pairs)
self._send_packet(CMD_VERSION, str(msg))
- t, data = self._read_packet()
- if t != CMD_INIT:
- raise SFTPError('Incompatible sftp protocol')
- version = struct.unpack('>I', data[:4])[0]
return version
def _log(self, level, msg):