summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAnselm Kruis <a.kruis@science-computing.de>2015-03-20 11:52:23 +0100
committerAnselm Kruis <a.kruis@science-computing.de>2015-03-20 12:31:41 +0100
commit838e02ab4287b40c6ea043abcd5a0065ef9554c8 (patch)
tree17bd15d6304b7751b9604a86700dc8041ab041c7
parentfac347718a69179ba9404d5f5e825798f4ee9379 (diff)
According to RFC 4254 sec 6.5 the "command" string of an "exec" channel
request is a byte-string. Previously paramiko assumed "command" to be UTF-8 encoded. Invalid UTF-8 sequences caused an UnicodeDecodeError. This commit changes a test case to uses a non UTF-8 string and fixes the bug.
-rw-r--r--paramiko/channel.py2
-rw-r--r--tests/test_transport.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py
index 23323650..0acd85ef 100644
--- a/paramiko/channel.py
+++ b/paramiko/channel.py
@@ -989,7 +989,7 @@ class Channel (object):
else:
ok = server.check_channel_env_request(self, name, value)
elif key == 'exec':
- cmd = m.get_text()
+ cmd = m.get_string()
if server is None:
ok = False
else:
diff --git a/tests/test_transport.py b/tests/test_transport.py
index 485a18e8..fb83fd2f 100644
--- a/tests/test_transport.py
+++ b/tests/test_transport.py
@@ -246,7 +246,7 @@ class TransportTest(ParamikoTest):
chan = self.tc.open_session()
schan = self.ts.accept(1.0)
try:
- chan.exec_command('no')
+ chan.exec_command(b'command contains \xfc and is not a valid UTF-8 string')
self.assertTrue(False)
except SSHException:
pass