From 5efa354ce9fff1217d22e52493d1442866821a7b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 24 Jan 2023 16:45:07 -0500 Subject: RF test to use "12345" and "to" instead of misspelling components to not upset codespell --- tests/test_proxy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/test_proxy.py') diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 83bdc040..64ea5651 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -44,10 +44,10 @@ class TestProxyCommand: select.return_value = [stdout], None, None fileno = stdout.fileno.return_value # Intentionally returning <5 at a time sometimes - os_read.side_effect = [b"was", b"te", b"of ti", b"me"] + os_read.side_effect = [b"123", b"45", b"of to", b"me"] proxy = ProxyCommand("hi") data = proxy.recv(5) - assert data == b"waste" + assert data == b"12345" assert [x[0] for x in os_read.call_args_list] == [ (fileno, 5), (fileno, 2), -- cgit v1.2.3 From 908e7c75f53025a3064e28215da62ffcfdea6daa Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 24 Jan 2023 16:56:08 -0500 Subject: [DATALAD RUNCMD] Run codespell -w === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- NEWS | 2 +- paramiko/agent.py | 4 ++-- paramiko/kex_gss.py | 4 ++-- paramiko/server.py | 8 ++++---- paramiko/sftp_attr.py | 2 +- paramiko/sftp_server.py | 2 +- paramiko/transport.py | 6 +++--- sites/www/changelog.rst | 4 ++-- tests/test_proxy.py | 2 +- tests/test_sftp.py | 2 +- tests/test_transport.py | 2 +- 11 files changed, 19 insertions(+), 19 deletions(-) (limited to 'tests/test_proxy.py') diff --git a/NEWS b/NEWS index 761f8e48..3c9d9abb 100644 --- a/NEWS +++ b/NEWS @@ -165,7 +165,7 @@ v1.7.1 (Amy) 10jun07 * SFTPClient.listdir_attr() now preserves the 'longname' field [patch from wesley augur] * SFTPClient.get_channel() API added - * SSHClient constuctor takes an optional 'timeout' parameter [patch from + * SSHClient constructor takes an optional 'timeout' parameter [patch from james bardin] v1.7 (zubat) 18feb07 diff --git a/paramiko/agent.py b/paramiko/agent.py index c1a07390..73fa1f82 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -314,10 +314,10 @@ class AgentServerProxy(AgentSSH): def get_env(self): """ - Helper for the environnement under unix + Helper for the environment under unix :return: - a dict containing the ``SSH_AUTH_SOCK`` environnement variables + a dict containing the ``SSH_AUTH_SOCK`` environment variables """ return {"SSH_AUTH_SOCK": self._get_filename()} diff --git a/paramiko/kex_gss.py b/paramiko/kex_gss.py index e3fbb36e..2a5f29e3 100644 --- a/paramiko/kex_gss.py +++ b/paramiko/kex_gss.py @@ -125,7 +125,7 @@ class KexGSSGroup1: Parse the next packet. :param ptype: The (string) type of the incoming packet - :param `.Message` m: The paket content + :param `.Message` m: The packet content """ if self.transport.server_mode and (ptype == MSG_KEXGSS_INIT): return self._parse_kexgss_init(m) @@ -380,7 +380,7 @@ class KexGSSGex: Parse the next packet. :param ptype: The (string) type of the incoming packet - :param `.Message` m: The paket content + :param `.Message` m: The packet content """ if ptype == MSG_KEXGSS_GROUPREQ: return self._parse_kexgss_groupreq(m) diff --git a/paramiko/server.py b/paramiko/server.py index a0a01fec..3875b8a2 100644 --- a/paramiko/server.py +++ b/paramiko/server.py @@ -255,7 +255,7 @@ class ServerInterface: We don't check if the krb5 principal is allowed to log in on the server, because there is no way to do that in python. So if you develop your own SSH server with paramiko for a cetain - plattform like Linux, you should call C{krb5_kuserok()} in + platform like Linux, you should call C{krb5_kuserok()} in your local kerberos library to make sure that the krb5_principal has an account on the server and is allowed to log in as a user. @@ -287,7 +287,7 @@ class ServerInterface: We don't check if the krb5 principal is allowed to log in on the server, because there is no way to do that in python. So if you develop your own SSH server with paramiko for a cetain - plattform like Linux, you should call C{krb5_kuserok()} in + platform like Linux, you should call C{krb5_kuserok()} in your local kerberos library to make sure that the krb5_principal has an account on the server and is allowed to log in as a user. @@ -634,7 +634,7 @@ class InteractiveQuery: class SubsystemHandler(threading.Thread): """ - Handler for a subsytem in server mode. If you create a subclass of this + Handler for a subsystem in server mode. If you create a subclass of this class and pass it to `.Transport.set_subsystem_handler`, an object of this class will be created for each request for this subsystem. Each new object will be executed within its own new thread by calling `start_subsystem`. @@ -642,7 +642,7 @@ class SubsystemHandler(threading.Thread): For example, if you made a subclass ``MP3Handler`` and registered it as the handler for subsystem ``"mp3"``, then whenever a client has successfully - authenticated and requests subsytem ``"mp3"``, an object of class + authenticated and requests subsystem ``"mp3"``, an object of class ``MP3Handler`` will be created, and `start_subsystem` will be called on it from a new thread. """ diff --git a/paramiko/sftp_attr.py b/paramiko/sftp_attr.py index eb4dd900..18ffbf86 100644 --- a/paramiko/sftp_attr.py +++ b/paramiko/sftp_attr.py @@ -24,7 +24,7 @@ from paramiko.common import x80000000, o700, o70, xffffffff class SFTPAttributes: """ Representation of the attributes of a file (or proxied file) for SFTP in - client or server mode. It attemps to mirror the object returned by + client or server mode. It attempts to mirror the object returned by `os.stat` as closely as possible, so it may have the following fields, with the same meanings as those returned by an `os.stat` object: diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py index 3bae415d..cd3910dc 100644 --- a/paramiko/sftp_server.py +++ b/paramiko/sftp_server.py @@ -259,7 +259,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler): desc = SFTP_DESC[code] except IndexError: desc = "Unknown" - # some clients expect a "langauge" tag at the end + # some clients expect a "language" tag at the end # (but don't mind it being blank) self._response(request_number, CMD_STATUS, code, desc, "") diff --git a/paramiko/transport.py b/paramiko/transport.py index 9436111b..569c5cdd 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -1008,7 +1008,7 @@ class Transport(threading.Thread, ClosingContextManager): :raises: `.SSHException` -- if the request is rejected, the session ends - prematurely or there is a timeout openning a channel + prematurely or there is a timeout opening a channel .. versionchanged:: 1.15 Added the ``window_size`` and ``max_packet_size`` arguments. @@ -1692,7 +1692,7 @@ class Transport(threading.Thread, ClosingContextManager): def auth_interactive_dumb(self, username, handler=None, submethods=""): """ - Autenticate to the server interactively but dumber. + Authenticate to the server interactively but dumber. Just print the prompt and / or instructions to stdout and send back the response. This is good for situations where partial auth is achieved by key and then the user has to enter a 2fac token. @@ -2058,7 +2058,7 @@ class Transport(threading.Thread, ClosingContextManager): reply.add_string("") reply.add_string("en") # NOTE: Post-open channel messages do not need checking; the above will - # reject attemps to open channels, meaning that even if a malicious + # reject attempts to open channels, meaning that even if a malicious # user tries to send a MSG_CHANNEL_REQUEST, it will simply fall under # the logic that handles unknown channel IDs (as the channel list will # be empty.) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 32e81828..ae1d7365 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -334,7 +334,7 @@ Changelog This fixes a security flaw! If you are running Paramiko on 32-bit systems with low entropy (such as any 32-bit Python 2, or a 32-bit Python 3 which is running with ``PYTHONHASHSEED=0``) it is possible for an attacker to - craft a new keypair from an exfiltrated public key, which Paramiko would + craft a new key pair from an exfiltrated public key, which Paramiko would consider equal to the original key. This could enable attacks such as, but not limited to, the following: @@ -1130,7 +1130,7 @@ Changelog functionality to address hangs from dropped network connections and/or failed handshakes. Credit to ``@vazir`` and ``@dacut`` for the original patches and to Olle Lundberg for reimplementation. -- :bug:`490` Skip invalid/unparseable lines in ``known_hosts`` files, instead +- :bug:`490` Skip invalid/unparsable lines in ``known_hosts`` files, instead of raising `~paramiko.ssh_exception.SSHException`. This brings Paramiko's behavior more in line with OpenSSH, which silently ignores such input. Catch & patch courtesy of Martin Topholm. diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 64ea5651..16bdb67c 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -122,7 +122,7 @@ class TestProxyCommand: select.return_value = [stdout], None, None # Base case: None timeout means no timing out os_read.return_value = b"meh" - proxy = ProxyCommand("yello") + proxy = ProxyCommand("yellow") assert proxy.timeout is None # Implicit 'no raise' check assert proxy.recv(3) == b"meh" diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 2cd68d94..cecbb305 100644 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -724,7 +724,7 @@ class TestSFTP: def test_seek_append(self, sftp): """ - verify that seek does't affect writes during append. + verify that seek doesn't affect writes during append. does not work except through paramiko. :( openssh fails. """ diff --git a/tests/test_transport.py b/tests/test_transport.py index 4d28199a..4062d767 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -891,7 +891,7 @@ class TransportTest(unittest.TestCase): @slow def test_handshake_timeout(self): """ - verify that we can get a hanshake timeout. + verify that we can get a handshake timeout. """ # Tweak client Transport instance's Packetizer instance so # its read_message() sleeps a bit. This helps prevent race conditions -- cgit v1.2.3 From 04b12990e5e41739f35b58971e21890d201c5503 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 27 Jan 2023 16:51:54 -0500 Subject: Revert "RF test to use "12345" and "to" instead of misspelling components" This reverts commit 5efa354ce9fff1217d22e52493d1442866821a7b. --- tests/test_proxy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/test_proxy.py') diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 16bdb67c..85b6e67a 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -44,10 +44,10 @@ class TestProxyCommand: select.return_value = [stdout], None, None fileno = stdout.fileno.return_value # Intentionally returning <5 at a time sometimes - os_read.side_effect = [b"123", b"45", b"of to", b"me"] + os_read.side_effect = [b"was", b"te", b"of ti", b"me"] proxy = ProxyCommand("hi") data = proxy.recv(5) - assert data == b"12345" + assert data == b"waste" assert [x[0] for x in os_read.call_args_list] == [ (fileno, 5), (fileno, 2), -- cgit v1.2.3 From 5963fddab452cafed336252194ced49f5b5b580b Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 27 Jan 2023 17:21:05 -0500 Subject: Tweak silly test constant to be a real word --- tests/test_proxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_proxy.py') diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 85b6e67a..3d767729 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -122,7 +122,7 @@ class TestProxyCommand: select.return_value = [stdout], None, None # Base case: None timeout means no timing out os_read.return_value = b"meh" - proxy = ProxyCommand("yellow") + proxy = ProxyCommand("hello") assert proxy.timeout is None # Implicit 'no raise' check assert proxy.recv(3) == b"meh" -- cgit v1.2.3 From d766ba92f4775b8a70f8ea3606dceb28eefa8810 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Fri, 27 Jan 2023 17:59:55 -0500 Subject: Twiddle ProxyCommand read test to not have faux misspellings, and to be way more understandable --- tests/test_proxy.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests/test_proxy.py') diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 3d767729..22c2c9c3 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -43,14 +43,20 @@ class TestProxyCommand: stdout = Popen.return_value.stdout select.return_value = [stdout], None, None fileno = stdout.fileno.return_value - # Intentionally returning <5 at a time sometimes - os_read.side_effect = [b"was", b"te", b"of ti", b"me"] + # Force os.read to return smaller-than-requested chunks + os_read.side_effect = [b"was", b"t", b"e", b"of ti", b"me"] proxy = ProxyCommand("hi") + # Ask for 5 bytes (ie b"waste") data = proxy.recv(5) + # Ensure we got "waste" stitched together assert data == b"waste" + # Ensure the calls happened in the sizes expected (starting with the + # initial "I want all 5 bytes", followed by "I want whatever I believe + # should be left after what I've already read", until done) assert [x[0] for x in os_read.call_args_list] == [ - (fileno, 5), - (fileno, 2), + (fileno, 5), # initial + (fileno, 2), # I got 3, want 2 more + (fileno, 1), # I've now got 4, want 1 more ] @patch("paramiko.proxy.subprocess.Popen") -- cgit v1.2.3