diff --git a/ssh.py b/ssh.py index 1d7ebe32..bb89fa1f 100644 --- a/ssh.py +++ b/ssh.py @@ -42,7 +42,7 @@ def _parse_ssh_version(ver_str=None): """parse a ssh version string into a tuple""" if ver_str is None: ver_str = _run_ssh_version() - m = re.match(r"^OpenSSH_([0-9.]+)(p[0-9]+)?\s", ver_str) + m = re.match(r"^OpenSSH_([0-9.]+)(p[0-9]+)?[\s,]", ver_str) if m: return tuple(int(x) for x in m.group(1).split(".")) else: diff --git a/tests/test_ssh.py b/tests/test_ssh.py index a9c1be7f..d74f7fe8 100644 --- a/tests/test_ssh.py +++ b/tests/test_ssh.py @@ -39,6 +39,8 @@ class SshTests(unittest.TestCase): "OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\n" ) self.assertEqual(ver, (7, 6)) + ver = ssh._parse_ssh_version("OpenSSH_9.0p1, LibreSSL 3.3.6\n") + self.assertEqual(ver, (9, 0)) def test_version(self): """Check version() handling."""