diff options
-rw-r--r-- | paramiko/channel.py | 2 | ||||
-rw-r--r-- | sites/www/changelog.rst | 2 | ||||
-rw-r--r-- | tests/test_client.py | 2 | ||||
-rw-r--r-- | tests/test_transport.py | 4 |
4 files changed, 6 insertions, 4 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py index 7601a34b..057b417b 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -975,7 +975,7 @@ class Channel (ClosingContextManager): 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/sites/www/changelog.rst b/sites/www/changelog.rst index bd748610..bd890b4e 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,8 @@ Changelog ========= +* :bug:`502` Fix an issue in server mode, when processing an exec request. + A command that is not a valid UTF-8 string, caused an UnicodeDecodeError. * :bug:`401` Fix line number reporting in log output regarding invalid ``known_hosts`` line entries. Thanks to Dylan Thacker-Smith for catch & patch. diff --git a/tests/test_client.py b/tests/test_client.py index 3d2e75c9..04cab439 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -75,7 +75,7 @@ class NullServer (paramiko.ServerInterface): return paramiko.OPEN_SUCCEEDED def check_channel_exec_request(self, channel, command): - if command != 'yes': + if command != b'yes': return False return True diff --git a/tests/test_transport.py b/tests/test_transport.py index 80f5e611..a93d8b63 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -78,7 +78,7 @@ class NullServer (ServerInterface): return OPEN_SUCCEEDED def check_channel_exec_request(self, channel, command): - if command != 'yes': + if command != b'yes': return False return True @@ -252,7 +252,7 @@ class TransportTest(unittest.TestCase): 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 |