mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-11-16 13:35:39 +01:00
Fixed OpenSSH patch version comparison. (#74)
This commit is contained in:
parent
2bb31b306f
commit
83d8014a50
@ -83,8 +83,8 @@ class Software:
|
|||||||
if not re.match(r'^test\d.*$', spatch):
|
if not re.match(r'^test\d.*$', spatch):
|
||||||
spatch = 'z{}'.format(spatch)
|
spatch = 'z{}'.format(spatch)
|
||||||
elif self.product == Product.OpenSSH:
|
elif self.product == Product.OpenSSH:
|
||||||
mx1 = re.match(r'^p\d(.*)', opatch)
|
mx1 = re.match(r'^p(\d).*', opatch)
|
||||||
mx2 = re.match(r'^p\d(.*)', spatch)
|
mx2 = re.match(r'^p(\d).*', spatch)
|
||||||
if not (bool(mx1) and bool(mx2)):
|
if not (bool(mx1) and bool(mx2)):
|
||||||
if mx1 is not None:
|
if mx1 is not None:
|
||||||
opatch = mx1.group(1)
|
opatch = mx1.group(1)
|
||||||
|
@ -136,13 +136,15 @@ class TestVersionCompare:
|
|||||||
s2 = self.get_openssh_software('2.1.1p2')
|
s2 = self.get_openssh_software('2.1.1p2')
|
||||||
assert s1.compare_version(s1) == 0
|
assert s1.compare_version(s1) == 0
|
||||||
assert s2.compare_version(s2) == 0
|
assert s2.compare_version(s2) == 0
|
||||||
assert s1.compare_version('2.1.1p1') == 0
|
assert s1.compare_version('2.1.1') == 0
|
||||||
assert s1.compare_version('2.1.1p2') == 0
|
assert s2.compare_version('2.1.1p2') == 0
|
||||||
assert s2.compare_version('2.1.1') == 0
|
assert s1.compare_version('2.1.1p1') != 0
|
||||||
|
assert s1.compare_version('2.1.1p2') != 0
|
||||||
|
assert s2.compare_version('2.1.1') != 0
|
||||||
assert s2.compare_version('2.1.1p1') > 0
|
assert s2.compare_version('2.1.1p1') > 0
|
||||||
assert s2.compare_version('2.1.1p3') < 0
|
assert s2.compare_version('2.1.1p3') < 0
|
||||||
assert s1.compare_version(s2) == 0
|
assert s1.compare_version(s2) != 0
|
||||||
assert s2.compare_version(s1) == 0
|
assert s2.compare_version(s1) != 0
|
||||||
|
|
||||||
def test_openbsd_compare_version_sequential(self):
|
def test_openbsd_compare_version_sequential(self):
|
||||||
versions = []
|
versions = []
|
||||||
|
Loading…
Reference in New Issue
Block a user