summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-01-16 21:53:21 -0500
committerJeff Forcier <jeff@bitprophet.org>2023-01-16 21:53:21 -0500
commitadbe1fbec4a01e497be5cffcfe3f1ad188c98bfc (patch)
tree027147592928b5506e0b9658b666d2ea2d67d4fd
parentfb7c951268175891c4926348e6e2a2976464d4ba (diff)
parent1cd22f097aca2667cbfde6320178e2354d07199b (diff)
Merge branch '2165-int' into 3.0
-rw-r--r--paramiko/packet.py2
-rw-r--r--paramiko/sftp.py6
2 files changed, 5 insertions, 3 deletions
diff --git a/paramiko/packet.py b/paramiko/packet.py
index 211bf946..7b482de5 100644
--- a/paramiko/packet.py
+++ b/paramiko/packet.py
@@ -384,7 +384,7 @@ class Packetizer:
Write a block of data using the current cipher, as an SSH block.
"""
# encrypt this sucka
- data = asbytes(data)
+ data = data.asbytes()
cmd = byte_ord(data[0])
if cmd in MSG_NAMES:
cmd_name = MSG_NAMES[cmd]
diff --git a/paramiko/sftp.py b/paramiko/sftp.py
index 2ce8c477..b3528d4e 100644
--- a/paramiko/sftp.py
+++ b/paramiko/sftp.py
@@ -139,7 +139,9 @@ class BaseSFTP:
# ...internals...
def _send_version(self):
- self._send_packet(CMD_INIT, struct.pack(">I", _VERSION))
+ m = Message()
+ m.add_int(_VERSION)
+ self._send_packet(CMD_INIT, m)
t, data = self._read_packet()
if t != CMD_VERSION:
raise SFTPError("Incompatible sftp protocol")
@@ -200,7 +202,7 @@ class BaseSFTP:
return out
def _send_packet(self, t, packet):
- packet = util.asbytes(packet)
+ packet = packet.asbytes()
out = struct.pack(">I", len(packet) + 1) + byte_chr(t) + packet
if self.ultra_debug:
self._log(DEBUG, util.format_binary(out, "OUT: "))