summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Tropf <asymmail@googlemail.com>2009-08-23 14:24:03 +0200
committerBjoern Tropf <asymmail@googlemail.com>2009-08-23 14:24:03 +0200
commit4cb8714ab194e7152aed40b65214213f00576273 (patch)
tree061e9051aed0e706b4ca771affc52a50ec8c4f6e
parentImplement -show cve (diff)
downloadkernel-check-4cb8714ab194e7152aed40b65214213f00576273.tar.gz
kernel-check-4cb8714ab194e7152aed40b65214213f00576273.tar.bz2
kernel-check-4cb8714ab194e7152aed40b65214213f00576273.zip
Implement is_affected()
-rwxr-xr-xkernellib.py88
1 files changed, 47 insertions, 41 deletions
diff --git a/kernellib.py b/kernellib.py
index c4dafc6..18604a8 100755
--- a/kernellib.py
+++ b/kernellib.py
@@ -678,14 +678,6 @@ def eval_cve_files(directory, kernel, kernel_gp, arch):
for item in files:
evaluation.number += 1
- kernel_gentoo = (kernel.source == 'gentoo' and kernel_gp is not None)
- kernel_affected = False
- kernel_linux_affected = False
- kernel_gp_affected = False
- #TODO kernel_gp_exp_affected = False
- linux_interval = False
- gentoo_interval = False
-
if item.arch not in ARCHES:
debug('[Error] Wrong architecture %s in bugid: %s' %
(item.arch, item.bugid))
@@ -695,46 +687,60 @@ def eval_cve_files(directory, kernel, kernel_gp, arch):
else:
evaluation.arch += 1
- for interval in item.affected:
- if interval.name == 'genpatches':
- gentoo_interval = True
- if kernel_gentoo:
- if is_in_interval(interval, kernel_gp, item):
- kernel_genpatch_aff = True
+ if is_affected(item.affected, kernel, kernel_gp, item):
+ evaluation.affected.append(item)
+ else:
+ evaluation.unaffected.append(item)
+
+ return evaluation
+
- elif interval.name == 'linux':
- linux_interval = True
- if is_in_interval(interval, kernel, item):
- kernel_linux_affected = True
+def is_affected(interval_list, kernel, kernel_gp, item): #TODO Remove item
+ 'Returns true if a kernel is affected'
+
+ kernel_gentoo = (kernel.source == 'gentoo' and kernel_gp is not None)
+ kernel_affected = False
+ kernel_linux_affected = False
+ kernel_gp_affected = False
+ #TODO kernel_gp_exp_affected = False
+ linux_interval = False
+ gentoo_interval = False
+
+ for interval in interval_list:
+ if interval.name == 'genpatches':
+ gentoo_interval = True
+ if kernel_gentoo:
+ if is_in_interval(interval, kernel_gp, item):
+ kernel_genpatch_aff = True
+
+ elif interval.name == 'linux':
+ linux_interval = True
+ if is_in_interval(interval, kernel, item):
+ kernel_linux_affected = True
- else:
- pass #TODO
-
- if linux_interval:
- if kernel_linux_affected:
- if gentoo_interval and kernel_gentoo:
- if kernel_gp_affected:
- kernel_affected = True
- else:
- kernel_affected = False
- else:
- kernel_affected = True
+ else:
+ pass #TODO
+
+ if linux_interval:
+ if kernel_linux_affected:
+ if gentoo_interval and kernel_gentoo:
+ if kernel_gp_affected:
+ kernel_affected = True
else:
kernel_affected = False
else:
- if kernel_gentoo and gentoo_interval:
- if kernel_gp_affected:
- kernel_affected = True
- else:
- kernel_affected = False
- #TODO Implement else for hardend/xen/expand
-
- if kernel_affected:
- evaluation.affected.append(item)
+ kernel_affected = True
+ else:
+ kernel_affected = False
+ else:
+ if kernel_gentoo and gentoo_interval:
+ if kernel_gp_affected:
+ kernel_affected = True
else:
- evaluation.unaffected.append(item)
+ kernel_affected = False
+ #TODO Implement else for hardend/xen/expand
- return evaluation
+ return kernel_affected
def bundle_evaluation(kernel, best):