From 31dc2ae40cbcc7583542152343b2ba1aff1595c7 Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Sun, 15 Jan 2017 20:52:42 -0500 Subject: Update channel.py --- paramiko/channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramiko/channel.py b/paramiko/channel.py index 3a05bdc4..64c645d0 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -155,7 +155,7 @@ class Channel (ClosingContextManager): after creating a client channel, to ask the server to provide some basic terminal semantics for a shell invoked with `invoke_shell`. It isn't necessary (or desirable) to call this method if you're going - to exectue a single command with `exec_command`. + to execute a single command with `exec_command`. :param str term: the terminal type to emulate (for example, ``'vt100'``) :param int width: width (in characters) of the terminal screen -- cgit v1.2.3 From 3ed75f66a19eea3d8812423c1617d1d362e96d6d Mon Sep 17 00:00:00 2001 From: james mike dupont Date: Thu, 19 Jan 2017 03:59:30 -0500 Subject: untie agian! --- paramiko/agent.py | 2 +- paramiko/kex_gss.py | 4 ++-- paramiko/server.py | 2 +- paramiko/sftp_client.py | 4 ++-- paramiko/sftp_handle.py | 2 +- paramiko/sftp_si.py | 2 +- paramiko/transport.py | 4 ++-- tests/stub_sftp.py | 2 +- tests/test_client.py | 2 +- tests/test_sftp.py | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/paramiko/agent.py b/paramiko/agent.py index 6a8e7fb4..c13810bb 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -331,7 +331,7 @@ class Agent(AgentSSH): """ Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to - connect to it and retreive `.PKey` objects which can be used when + connect to it and retrieve `.PKey` objects which can be used when attempting to authenticate to remote SSH servers. Upon initialization, a session with the local machine's SSH agent is diff --git a/paramiko/kex_gss.py b/paramiko/kex_gss.py index 69969f8a..e21d55b9 100644 --- a/paramiko/kex_gss.py +++ b/paramiko/kex_gss.py @@ -104,7 +104,7 @@ class KexGSSGroup1(object): """ Parse the next packet. - :param char ptype: The type of the incomming packet + :param char ptype: The type of the incoming packet :param `.Message` m: The paket content """ if self.transport.server_mode and (ptype == MSG_KEXGSS_INIT): @@ -335,7 +335,7 @@ class KexGSSGex(object): """ Parse the next packet. - :param char ptype: The type of the incomming packet + :param char ptype: The type of the incoming packet :param `.Message` m: The paket content """ if ptype == MSG_KEXGSS_GROUPREQ: diff --git a/paramiko/server.py b/paramiko/server.py index f79a1748..bc4ac071 100644 --- a/paramiko/server.py +++ b/paramiko/server.py @@ -385,7 +385,7 @@ class ServerInterface (object): :param int pixelheight: height of screen in pixels, if known (may be ``0`` if unknown). :return: - ``True`` if the psuedo-terminal has been allocated; ``False`` + ``True`` if the pseudo-terminal has been allocated; ``False`` otherwise. """ return False diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index 0df94389..12a9506f 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -223,7 +223,7 @@ class SFTPClient(BaseSFTP, ClosingContextManager): ``read_aheads``, an integer controlling how many ``SSH_FXP_READDIR`` requests are made to the server. The default of 50 should suffice for most file listings as each request/response cycle - may contain multiple files (dependant on server implementation.) + may contain multiple files (dependent on server implementation.) .. versionadded:: 1.15 """ @@ -828,6 +828,6 @@ class SFTPClient(BaseSFTP, ClosingContextManager): class SFTP(SFTPClient): """ - An alias for `.SFTPClient` for backwards compatability. + An alias for `.SFTPClient` for backwards compatibility. """ pass diff --git a/paramiko/sftp_handle.py b/paramiko/sftp_handle.py index edceb5ad..05b5e904 100644 --- a/paramiko/sftp_handle.py +++ b/paramiko/sftp_handle.py @@ -179,7 +179,7 @@ class SFTPHandle (ClosingContextManager): def _get_next_files(self): """ - Used by the SFTP server code to retreive a cached directory + Used by the SFTP server code to retrieve a cached directory listing. """ fnlist = self.__files[:16] diff --git a/paramiko/sftp_si.py b/paramiko/sftp_si.py index 61db956c..7ab00ad7 100644 --- a/paramiko/sftp_si.py +++ b/paramiko/sftp_si.py @@ -208,7 +208,7 @@ class SFTPServerInterface (object): The ``attr`` object will contain only those fields provided by the client in its request, so you should use ``hasattr`` to check for - the presense of fields before using them. In some cases, the ``attr`` + the presence of fields before using them. In some cases, the ``attr`` object may be completely empty. :param str path: diff --git a/paramiko/transport.py b/paramiko/transport.py index c352246c..120f9e84 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -506,7 +506,7 @@ class Transport (threading.Thread, ClosingContextManager): be triggered. On failure, `is_active` will return ``False``. (Since 1.4) If ``event`` is ``None``, this method will not return until - negotation is done. On success, the method returns normally. + negotiation is done. On success, the method returns normally. Otherwise an SSHException is raised. After a successful negotiation, the client will need to authenticate. @@ -2278,7 +2278,7 @@ class Transport (threading.Thread, ClosingContextManager): finally: self.lock.release() if kind == 'direct-tcpip': - # handle direct-tcpip requests comming from the client + # handle direct-tcpip requests coming from the client dest_addr = m.get_text() dest_port = m.get_int() origin_addr = m.get_text() diff --git a/tests/stub_sftp.py b/tests/stub_sftp.py index 24380ba1..5fcca386 100644 --- a/tests/stub_sftp.py +++ b/tests/stub_sftp.py @@ -55,7 +55,7 @@ class StubSFTPHandle (SFTPHandle): class StubSFTPServer (SFTPServerInterface): # assume current folder is a fine root - # (the tests always create and eventualy delete a subfolder, so there shouldn't be any mess) + # (the tests always create and eventually delete a subfolder, so there shouldn't be any mess) ROOT = os.getcwd() def _realpath(self, path): diff --git a/tests/test_client.py b/tests/test_client.py index d39febac..f775532e 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -361,7 +361,7 @@ class SSHClientTest (unittest.TestCase): # NOTE: re #387, re #394 # If pkey module used within Client._auth isn't correctly handling auth # errors (e.g. if it allows things like ValueError to bubble up as per - # midway thru #394) client.connect() will fail (at key load step) + # midway through #394) client.connect() will fail (at key load step) # instead of succeeding (at password step) kwargs = dict( # Password-protected key whose passphrase is not 'pygmalion' (it's diff --git a/tests/test_sftp.py b/tests/test_sftp.py index e4c2c3a3..d3064fff 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -413,7 +413,7 @@ class SFTPTest (unittest.TestCase): def test_A_readline_seek(self): """ create a text file and write a bunch of text into it. then count the lines - in the file, and seek around to retreive particular lines. this should + in the file, and seek around to retrieve particular lines. this should verify that read buffering and 'tell' work well together, and that read buffering is reset on 'seek'. """ -- cgit v1.2.3 From d224eec126acb1f003f5a2c8b2449313fee0cdad Mon Sep 17 00:00:00 2001 From: Kalle Møller Date: Mon, 16 Jan 2017 00:04:40 +0100 Subject: Added bytes as type to write Small change so that my IDE stops telling me, that this function doesn't understand bytes :) --- paramiko/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramiko/file.py b/paramiko/file.py index 05f2d6e6..5b57dfd6 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -370,7 +370,7 @@ class BufferedFile (ClosingContextManager): written yet. (Use `flush` or `close` to force buffered data to be written out.) - :param str data: data to write + :param str/bytes data: data to write """ data = b(data) if self._closed: -- cgit v1.2.3 From 7a9d633486991b11e4c212e6937ceea42c1e539f Mon Sep 17 00:00:00 2001 From: Kalle Møller Date: Wed, 1 Feb 2017 23:10:42 +0100 Subject: Update .travis.yml 3.6 is now released --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index af32ba7e..53b9dcf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ python: - "3.3" - "3.4" - "3.5" + - "3.6" - "pypy-5.4.1" install: # Self-install for setup.py-driven deps -- cgit v1.2.3 From c978a6bff03e2c2b620ff485c987ff5311dad97d Mon Sep 17 00:00:00 2001 From: jhall150 Date: Thu, 31 Mar 2016 10:15:47 -0400 Subject: Don't pass IV to pycrypto when using MODE_CTR * Fixes #713 --- paramiko/transport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramiko/transport.py b/paramiko/transport.py index 120f9e84..1de6ff09 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -1662,7 +1662,7 @@ class Transport (threading.Thread, ClosingContextManager): elif name.endswith("-ctr"): # CTR modes, we need a counter counter = Counter.new(nbits=self._cipher_info[name]['block-size'] * 8, initial_value=util.inflate_long(iv, True)) - return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv, counter) + return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], '', counter) else: return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv) -- cgit v1.2.3 From bbe98132c7e16f51c44e65138584430238734372 Mon Sep 17 00:00:00 2001 From: Dennis Kaarsemaker Date: Wed, 15 Feb 2017 18:05:50 +0100 Subject: Fix bug in handling multiple interactive queries If repeated interaction is needed, check_auth_interactive_response returns an InteractiveQuery object. Unfortunately a bug caused it not to be recognized, causing autheintication to fail. This fixes said bug by properly looking at the type of the returned object. --- paramiko/auth_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py index 38b23729..cab27a88 100644 --- a/paramiko/auth_handler.py +++ b/paramiko/auth_handler.py @@ -597,7 +597,7 @@ class AuthHandler (object): for i in range(n): responses.append(m.get_text()) result = self.transport.server_object.check_auth_interactive_response(responses) - if isinstance(type(result), InteractiveQuery): + if isinstance(result, InteractiveQuery): # make interactive query instead of response self._interactive_query(result) return -- cgit v1.2.3 From c798ef5dd3b2647f765716b943fe42615d5508dd Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Sun, 19 Feb 2017 11:38:57 -0800 Subject: Changelog re #895, closes #895 --- sites/www/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index a64ef608..36ef443f 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,9 @@ Changelog ========= +* :bug:`895` Fix a bug in server-mode concerning multiple interactive auth + steps (which were incorrectly responded to). Thanks to Dennis Kaarsemaker for + catch & patch. * :support:`866 backported` (also :issue:`838`) Remove an old test-related file we don't support, and add PyPy to Travis-CI config. Thanks to Pierce Lopez for the final patch and Pedro Rodrigues for an earlier edition. -- cgit v1.2.3 From 56c09ba0be8db847598646674d2068ab4c64c050 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 10:32:44 -0800 Subject: Nuke old commented out line --- paramiko/message.py | 1 - 1 file changed, 1 deletion(-) diff --git a/paramiko/message.py b/paramiko/message.py index bf4c6b95..9cc23712 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -184,7 +184,6 @@ class Message (object): @rtype: string """ return u(self.get_bytes(self.get_int())) - #return self.get_bytes(self.get_size()) def get_binary(self): """ -- cgit v1.2.3 From 1d8f803f8d4d860c968682a527273760bec04778 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 11:03:29 -0800 Subject: Not sure how these snuck back in --- paramiko/message.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/paramiko/message.py b/paramiko/message.py index 9cc23712..36d0cbcd 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -144,9 +144,6 @@ class Message (object): def get_int(self): """ Fetch an int from the stream. - - @return: a 32-bit unsigned integer. - @rtype: int """ return struct.unpack('>I', self.get_bytes(4))[0] @@ -179,9 +176,6 @@ class Message (object): Fetch a string from the stream. This could be a byte string and may contain unprintable characters. (It's not unheard of for a string to contain another byte-stream Message.) - - @return: a string. - @rtype: string """ return u(self.get_bytes(self.get_int())) @@ -190,9 +184,6 @@ class Message (object): Fetch a string from the stream. This could be a byte string and may contain unprintable characters. (It's not unheard of for a string to contain another byte-stream Message.) - - @return: a string. - @rtype: string """ return self.get_bytes(self.get_int()) -- cgit v1.2.3 From d6c5edf810a35e0441892c12161a3aeffe7eb1b4 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 11:03:45 -0800 Subject: Correct get_text() docstring --- paramiko/message.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/paramiko/message.py b/paramiko/message.py index 36d0cbcd..c69916aa 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -173,9 +173,7 @@ class Message (object): def get_text(self): """ - Fetch a string from the stream. This could be a byte string and may - contain unprintable characters. (It's not unheard of for a string to - contain another byte-stream Message.) + Fetch a Unicode string from the stream. """ return u(self.get_bytes(self.get_int())) -- cgit v1.2.3 From a54326cae2bc837d496fadcaf7957531f11ff6f7 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 11:04:22 -0800 Subject: Also make this self-referential because jeez --- paramiko/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramiko/message.py b/paramiko/message.py index c69916aa..05c1dd4c 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -175,7 +175,7 @@ class Message (object): """ Fetch a Unicode string from the stream. """ - return u(self.get_bytes(self.get_int())) + return u(self.get_string()) def get_binary(self): """ -- cgit v1.2.3 From 2914030fcf5216bc5a548ff4dca5c623e99f1e0e Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 13:49:35 -0800 Subject: Changelog re #713, re #714, re #889 --- sites/www/changelog.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 36ef443f..339e436e 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,11 @@ Changelog ========= +* :bug:`713 (<2.0)` (via :issue:`714` and :issue:`889`) Don't pass + initialization vectors to PyCrypto when dealing with counter-mode ciphers; + newer PyCrypto versions throw an exception otherwise (older ones simply + ignored this parameter altogether). Thanks to ``@jmh045000`` for report & + patches. * :bug:`895` Fix a bug in server-mode concerning multiple interactive auth steps (which were incorrectly responded to). Thanks to Dennis Kaarsemaker for catch & patch. -- cgit v1.2.3 From 4c43c08cdd33cb802007e1c314915432048d0c96 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 14:00:07 -0800 Subject: Correctly mark #859 as being in 1.18 on up --- sites/www/changelog.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 22695a85..077ba159 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -14,8 +14,8 @@ Changelog we don't support, and add PyPy to Travis-CI config. Thanks to Pierce Lopez for the final patch and Pedro Rodrigues for an earlier edition. * :release:`1.18.1 <2016-12-12>` -* :bug:`859` (via :issue:`860`) A tweak to the original patch implementing - :issue:`398` was not fully applied, causing calls to +* :bug:`859 (1.18+)` (via :issue:`860`) A tweak to the original patch + implementing :issue:`398` was not fully applied, causing calls to `~paramiko.client.SSHClient.invoke_shell` to fail with ``AttributeError``. This has been fixed. Patch credit: Kirk Byers. * :release:`1.18.0 <2016-12-09>` -- cgit v1.2.3 From 87c9ae72e210c6b7f492099801f6bafc81893e69 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 14:04:37 -0800 Subject: Update a whole bunch of changelog entries lacking proper version statements =/ Grump, for now support types need both 'backported' and version spec? --- sites/www/changelog.rst | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 339e436e..8e1607c5 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -7,40 +7,41 @@ Changelog newer PyCrypto versions throw an exception otherwise (older ones simply ignored this parameter altogether). Thanks to ``@jmh045000`` for report & patches. -* :bug:`895` Fix a bug in server-mode concerning multiple interactive auth - steps (which were incorrectly responded to). Thanks to Dennis Kaarsemaker for - catch & patch. -* :support:`866 backported` (also :issue:`838`) Remove an old test-related file - we don't support, and add PyPy to Travis-CI config. Thanks to Pierce Lopez - for the final patch and Pedro Rodrigues for an earlier edition. +* :bug:`895 (1.17+)` Fix a bug in server-mode concerning multiple interactive + auth steps (which were incorrectly responded to). Thanks to Dennis + Kaarsemaker for catch & patch. +* :support:`866 backported (1.17+)` (also :issue:`838`) Remove an old + test-related file we don't support, and add PyPy to Travis-CI config. Thanks + to Pierce Lopez for the final patch and Pedro Rodrigues for an earlier + edition. * :release:`1.17.3 <2016-12-09>` * :bug:`802 (1.17+)` (via :issue:`804`) Update our vendored Windows API module to address errors of the form ``AttributeError: 'module' object has no attribute 'c_ssize_t'``. Credit to Jason R. Coombs. -* :bug:`824` Fix the implementation of ``PKey.write_private_key_file`` (this - method is only publicly defined on subclasses; the fix was in the private - real implementation) so it passes the correct params to ``open()``. This bug - apparently went unnoticed and unfixed for 12 entire years. Congrats to John - Villalovos for noticing & submitting the patch! -* :support:`801 (1.17+)` Skip a Unix-only test when on Windows; thanks to - Gabi Davar. -* :support:`792 (1.17+)` Minor updates to the README and demos; thanks to Alan - Yee. -* :bug:`789` Add a missing ``.closed`` attribute (plus ``._closed`` because - reasons) to `ProxyCommand ` so the earlier - partial fix for :issue:`520` works in situations where one is gatewaying via - ``ProxyCommand``. -* :bug:`334` Make the ``subprocess`` import in ``proxy.py`` lazy so users on - platforms without it (such as Google App Engine) can import Paramiko +* :bug:`824 (1.17+)` Fix the implementation of ``PKey.write_private_key_file`` + (this method is only publicly defined on subclasses; the fix was in the + private real implementation) so it passes the correct params to ``open()``. + This bug apparently went unnoticed and unfixed for 12 entire years. Congrats + to John Villalovos for noticing & submitting the patch! +* :support:`801 backported (1.17+)` Skip a Unix-only test when on Windows; + thanks to Gabi Davar. +* :support:`792 backported (1.17+)` Minor updates to the README and demos; + thanks to Alan Yee. +* :bug:`789 (1.17+)` Add a missing ``.closed`` attribute (plus ``._closed`` + because reasons) to `ProxyCommand ` so the + earlier partial fix for :issue:`520` works in situations where one is + gatewaying via ``ProxyCommand``. +* :bug:`334 (1.17+)` Make the ``subprocess`` import in ``proxy.py`` lazy so + users on platforms without it (such as Google App Engine) can import Paramiko successfully. (Relatedly, make it easier to tweak an active socket check timeout [in `Transport `] which was previously hardcoded.) Credit: Shinya Okano. -* :support:`854 backported` Fix incorrect docstring/param-list for +* :support:`854 backported (1.17+)` Fix incorrect docstring/param-list for `Transport.auth_gssapi_keyex ` so it matches the real signature. Caught by ``@Score_Under``. -* :bug:`681` Fix a Python3-specific bug re: the handling of read buffers when - using ``ProxyCommand``. Thanks to Paul Kapp for catch & patch. +* :bug:`681 (1.17+)` Fix a Python3-specific bug re: the handling of read + buffers when using ``ProxyCommand``. Thanks to Paul Kapp for catch & patch. * :support:`819 backported (>=1.15,<2.0)` Document how lacking ``gmp`` headers at install time can cause a significant performance hit if you build PyCrypto from source. (Most system-distributed packages already have this enabled.) -- cgit v1.2.3 From 6b6ff0fb33ca2e0e3b014cbca595cbc50d137e42 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 14:29:56 -0800 Subject: let's be consistent --- sites/www/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 8e1607c5..0f203586 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,7 +2,7 @@ Changelog ========= -* :bug:`713 (<2.0)` (via :issue:`714` and :issue:`889`) Don't pass +* :bug:`713 (1.17+)` (via :issue:`714` and :issue:`889`) Don't pass initialization vectors to PyCrypto when dealing with counter-mode ciphers; newer PyCrypto versions throw an exception otherwise (older ones simply ignored this parameter altogether). Thanks to ``@jmh045000`` for report & -- cgit v1.2.3 From e58df62ef5e7339e5895f9f5ffdaa3452d45a69c Mon Sep 17 00:00:00 2001 From: Omer Anson Date: Thu, 9 Feb 2017 18:59:03 +0200 Subject: Add back-reference from Transport to the SSHClient that created it In some cases, the SSH client is created, the command is executed, the streams are extracted, and the explicit reference to SSHClient is then discarded (since it was e.g. created in a function that only returns the streams). In this case, the SHSClient may be garbage collected, and the connection's state is undefined. This fix adds a reference from Transport to the SSHClient that created it. The streams have a reference to the Channel, which references the Transport. Now that the Transport references the SSHClient, it won't be garbage collected until it is closed. Closes-Bug: #44 Related-Bug: #344 --- paramiko/client.py | 1 + paramiko/transport.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/paramiko/client.py b/paramiko/client.py index ebf21b08..18139416 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -336,6 +336,7 @@ class SSHClient (ClosingContextManager): if banner_timeout is not None: t.banner_timeout = banner_timeout t.start_client() + t.set_sshclient(self) ResourceManager.register(self, t) server_key = t.get_remote_server_key() diff --git a/paramiko/transport.py b/paramiko/transport.py index 1de6ff09..21565673 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -281,6 +281,7 @@ class Transport (threading.Thread, ClosingContextManager): arguments. """ self.active = False + self._sshclient = None if isinstance(sock, string_types): # convert "host:port" into (host, port) @@ -636,6 +637,9 @@ class Transport (threading.Thread, ClosingContextManager): Transport._modulus_pack = None return False + def set_sshclient(self, sshclient): + self._sshclient = sshclient + def close(self): """ Close this session, and any open channels that are tied to it. @@ -646,6 +650,7 @@ class Transport (threading.Thread, ClosingContextManager): for chan in list(self._channels.values()): chan._unlink() self.sock.close() + self._sshclient = None def get_remote_server_key(self): """ -- cgit v1.2.3 From a39a1eeed691b9c4e191dbe4b8716fb7682971fa Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 14:38:38 -0800 Subject: Changelog closes #44, closes #891 --- sites/www/changelog.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 0f203586..a4808510 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,13 @@ Changelog ========= +* :bug:`44` (via :issue:`891`) `SSHClient ` now + gives its internal `Transport ` a handle on + itself, preventing garbage collection of the client until the session is + closed. Without this, some code which returns stream or transport objects + without the client that generated them, would result in premature session + closure when the client was GCd. Credit: ``@w31rd0`` for original report, + Omer Anson for the patch. * :bug:`713 (1.17+)` (via :issue:`714` and :issue:`889`) Don't pass initialization vectors to PyCrypto when dealing with counter-mode ciphers; newer PyCrypto versions throw an exception otherwise (older ones simply -- cgit v1.2.3 From c0c6bd8aadf579ff72c14e631cf92a4bdd6e2531 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 14:40:38 -0800 Subject: Sigh --- sites/www/changelog.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index a4808510..2f80cdb7 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,8 +2,8 @@ Changelog ========= -* :bug:`44` (via :issue:`891`) `SSHClient ` now - gives its internal `Transport ` a handle on +* :bug:`44 (1.17+)` (via :issue:`891`) `SSHClient ` + now gives its internal `Transport ` a handle on itself, preventing garbage collection of the client until the session is closed. Without this, some code which returns stream or transport objects without the client that generated them, would result in premature session -- cgit v1.2.3 From a4db55c07cf4924c04ec402c16c0eae7de98e4e8 Mon Sep 17 00:00:00 2001 From: Sofian Brabez Date: Wed, 14 Dec 2016 20:57:55 +0100 Subject: Avoid PacketizerTest.test_closed_3 to fail on platforms where errno.ETIME is not defined This changes define the proper Timer expired error message instead of raising AttributeError when errno.ETIME is not available on the platform. fixes #862 --- tests/test_packetizer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_packetizer.py b/tests/test_packetizer.py index 15a7c93f..a7cac6de 100644 --- a/tests/test_packetizer.py +++ b/tests/test_packetizer.py @@ -101,9 +101,13 @@ class PacketizerTest (unittest.TestCase): import signal class TimeoutError(Exception): - pass + def __init__(self, error_message): + if hasattr(errno, 'ETIME'): + self.message = os.sterror(errno.ETIME) + else: + self.messaage = error_message - def timeout(seconds=1, error_message=os.strerror(errno.ETIME)): + def timeout(seconds=1, error_message='Timer expired'): def decorator(func): def _handle_timeout(signum, frame): raise TimeoutError(error_message) -- cgit v1.2.3 From d09ca08d628ade6e04d708a6b7010801eeda4503 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 14:46:27 -0800 Subject: Changelog closes #863 --- sites/www/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 2f80cdb7..5153965f 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,9 @@ Changelog ========= +* :bug:`862 (1.17+)` (via :issue:`863`) Avoid test suite exceptions on + platforms lacking ``errno.ETIME`` (which seems to be some FreeBSD and some + Windows environments.) Thanks to Sofian Brabez. * :bug:`44 (1.17+)` (via :issue:`891`) `SSHClient ` now gives its internal `Transport ` a handle on itself, preventing garbage collection of the client until the session is -- cgit v1.2.3 From ec365ac3a7020466d2713187ec42b20575e6ef05 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 20 Feb 2017 14:54:18 -0800 Subject: Pretty sure adding PyPy test cell to pre-2.0 was unintentional. Certainly, it breaks, and I think I'd rather revert this for the time being than cherry-pick b16f91ee1d6475036235ee7224ea4be5d58a65bf for example --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 53b9dcf9..ddff5e58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ python: - "3.4" - "3.5" - "3.6" - - "pypy-5.4.1" install: # Self-install for setup.py-driven deps - pip install -e . -- cgit v1.2.3