summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-11-12 13:57:16 -0800
committerJeff Forcier <jeff@bitprophet.org>2014-11-12 13:57:16 -0800
commit14fdeae3b0f5c250fa2aac1ba729e0c6749a2be5 (patch)
treedb317dd27f4f5a2322e07bd87167249d009df730
parent7ebbabef50bd8b75d9865e76a9534fc7e47273d4 (diff)
parente57e4ba1c44b05d0d4ce5f50be4b8676d9df79ed (diff)
Merge branch '1.14' into 1.15
Conflicts: tests/test_util.py
-rw-r--r--paramiko/transport.py2
-rw-r--r--paramiko/util.py9
-rw-r--r--sites/www/changelog.rst4
-rw-r--r--tests/test_util.py15
4 files changed, 23 insertions, 7 deletions
diff --git a/paramiko/transport.py b/paramiko/transport.py
index bf30c784..f80aaba5 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -2149,7 +2149,7 @@ class Transport (threading.Thread, ClosingContextManager):
always_display = m.get_boolean()
msg = m.get_string()
lang = m.get_string()
- self._log(DEBUG, 'Debug msg: ' + util.safe_string(msg))
+ self._log(DEBUG, 'Debug msg: {0}'.format(util.safe_string(msg)))
def _get_subsystem_handler(self, name):
try:
diff --git a/paramiko/util.py b/paramiko/util.py
index 88ca2bc4..3ac64a00 100644
--- a/paramiko/util.py
+++ b/paramiko/util.py
@@ -115,12 +115,13 @@ def unhexify(s):
def safe_string(s):
- out = ''
+ out = b('')
for c in s:
- if (byte_ord(c) >= 32) and (byte_ord(c) <= 127):
- out += c
+ i = byte_ord(c)
+ if 32 <= i <= 127:
+ out += byte_chr(i)
else:
- out += '%%%02X' % byte_ord(c)
+ out += b('%%%02X' % i)
return out
diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst
index b954a230..d26250a0 100644
--- a/sites/www/changelog.rst
+++ b/sites/www/changelog.rst
@@ -2,6 +2,10 @@
Changelog
=========
+* :bug:`429` Server-level debug message logging was overlooked during the
+ Python 3 compatibility update; Python 3 clients attempting to log SSH debug
+ packets encountered type errors. This is now fixed. Thanks to ``@mjmaenpaa``
+ for the catch.
* :bug:`320` Update our win_pageant module to be Python 3 compatible. Thanks to
``@sherbang`` and ``@adamkerz`` for the patches.
* :release:`1.15.1 <2014-09-22>`
diff --git a/tests/test_util.py b/tests/test_util.py
index 35e15765..da7f6f34 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -27,8 +27,8 @@ from hashlib import sha1
import unittest
import paramiko.util
-from paramiko.util import lookup_ssh_host_config as host_config
-from paramiko.py3compat import StringIO, byte_ord
+from paramiko.util import lookup_ssh_host_config as host_config, safe_string
+from paramiko.py3compat import StringIO, byte_ord, b
test_config_file = """\
Host *
@@ -448,3 +448,14 @@ Host param3 parara
)
for host in incorrect_data:
self.assertRaises(Exception, conf._get_hosts, host)
+
+ def test_safe_string(self):
+ vanilla = b("vanilla")
+ has_bytes = b("has \7\3 bytes")
+ safe_vanilla = safe_string(vanilla)
+ safe_has_bytes = safe_string(has_bytes)
+ expected_bytes = b("has %07%03 bytes")
+ err = "{0!r} != {1!r}"
+ assert safe_vanilla == vanilla, err.format(safe_vanilla, vanilla)
+ assert safe_has_bytes == expected_bytes, \
+ err.format(safe_has_bytes, expected_bytes)