Fixed bug where algorithm added in OpenSSH 10.x was being recommended for OpenSSH 9.x targets.

This commit is contained in:
Joe Testa
2026-07-03 10:58:48 -04:00
parent 1eb11050b3
commit 0f8bbdbfd9
2 changed files with 23 additions and 6 deletions
-2
View File
@@ -117,8 +117,6 @@ class Algorithms:
sshv, alg_db = alg_pair.sshv, alg_pair.db
rec[sshv] = {}
for alg_type, alg_list in alg_pair.items():
if alg_type == 'aut':
continue
rec[sshv][alg_type] = {'add': {}, 'del': {}, 'chg': {}}
for n, alg_desc in alg_db[alg_type].items():
versions = alg_desc[0]
+19
View File
@@ -72,10 +72,29 @@ class Software:
oversion, opatch = mx.group(1), mx.group(2).strip()
else:
oversion, opatch = other, ''
# Attempt to parse the versions into floats.
float_parse_error = False
selfversion_float = 0.0
oversion_float = 0.0
try:
selfversion_float = float(self.version)
oversion_float = float(oversion)
except ValueError:
float_parse_error = True
# If the versions could not be parsed into floats, use the old string compare method. This returns incorrect results when comparing modern OpenSSH versions ("9.6" > "10.4" evaluates to True!), but removing this may trigger other bugs, and we have no other good options here, soooo...
if float_parse_error:
if self.version < oversion:
return -1
elif self.version > oversion:
return 1
else: # Float parsing worked, so we'll use this instead. That way (9.6 > 10.4) properly evaluates to False.
if selfversion_float < oversion_float: # pylint: disable=else-if-used
return -1
elif selfversion_float > oversion_float:
return 1
spatch = self.patch or ''
if self.product == Product.DropbearSSH:
if not re.match(r'^test\d.*$', opatch):