From 240b705d618d669ce006dae23f970b8af70ed394 Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Tue, 20 Oct 2020 13:17:32 -0400 Subject: [PATCH] OpenSSH-portable patch level 1 now considered equivalent to stock OpenBSD version. --- src/ssh_audit/software.py | 3 +++ test/test_version_compare.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ssh_audit/software.py b/src/ssh_audit/software.py index 02366c4..37c7d36 100644 --- a/src/ssh_audit/software.py +++ b/src/ssh_audit/software.py @@ -90,6 +90,9 @@ class Software: opatch = mx1.group(1) if mx2 is not None: spatch = mx2.group(1) + # OpenBSD version and p1 versions are considered the same. + if ((spatch == '') and (opatch == '1')) or ((spatch == '1') and (opatch == '')): + return 0 if spatch < opatch: return -1 elif spatch > opatch: diff --git a/test/test_version_compare.py b/test/test_version_compare.py index 1eedf7d..f6f0441 100644 --- a/test/test_version_compare.py +++ b/test/test_version_compare.py @@ -138,7 +138,7 @@ class TestVersionCompare: assert s2.compare_version(s2) == 0 assert s1.compare_version('2.1.1') == 0 assert s2.compare_version('2.1.1p2') == 0 - assert s1.compare_version('2.1.1p1') != 0 + assert s1.compare_version('2.1.1p1') == 0 # OpenBSD version and p1 version should be the same. assert s1.compare_version('2.1.1p2') != 0 assert s2.compare_version('2.1.1') != 0 assert s2.compare_version('2.1.1p1') > 0