summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBjoern Tropf <asym@gentoo.org>2009-11-14 12:16:25 +0100
committerBjoern Tropf <asym@gentoo.org>2009-11-14 12:16:25 +0100
commitf12b7f41c2dff37eebedf6027cf5aa33a5994258 (patch)
treef92e712abc6dd8f4ec7b14b33e90ba96f7bba425 /tools
parentFix some bugs (diff)
downloadkernel-check-f12b7f41c2dff37eebedf6027cf5aa33a5994258.tar.gz
kernel-check-f12b7f41c2dff37eebedf6027cf5aa33a5994258.tar.bz2
kernel-check-f12b7f41c2dff37eebedf6027cf5aa33a5994258.zip
Implement a NOCVE dictionary
Modify BUG_ON to support exception messages Fix small typo
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cron.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/tools/cron.py b/tools/cron.py
index 17475ab..ddf1792 100755
--- a/tools/cron.py
+++ b/tools/cron.py
@@ -21,11 +21,20 @@ class CronError(Exception):
def __init__(self, value):
self.value = value
-NOCVE = 'GENERIC-MAP-NOMATCH'
-NOCVEDESC = 'This GENERIC identifier is not specific to any vulnerability. '\
- 'GENERIC-MAP-NOMATCH is used by products, databases, and ' \
- 'services to specify when a particular vulnerability element ' \
- 'does not map to a corresponding CVE entry.'
+NOCVE = {
+ 'cve' : 'GENERIC-MAP-NOMATCH',
+ 'published' : '0000-00-00',
+ 'desc' : 'This GENERIC identifier is not specific to any ' \
+ 'vulnerability. GENERIC-MAP-NOMATCH is used by products, ' \
+ 'databases, and services to specify when a particular ' \
+ 'vulnerability element does not map to a corresponding ' \
+ 'CVE entry.',
+ 'severity' : 'Low',
+ 'vector' : '()',
+ 'score' : '0.0',
+ 'refs' : et.Element('refs')
+}
+
DELAY = 0.2
SKIP = False
MINYEAR = 2002
@@ -120,8 +129,8 @@ def main(argv):
vul = parse_bz_dict(DIR['bug'], item)
for cve in vul['cvelist']:
- if cve == NOCVE:
- vul['cves'] = [NOCVE]
+ if cve == NOCVE['cve']:
+ vul['cves'] = [NOCVE['cve']]
break #TODO Raise exception instead of break
else:
try:
@@ -230,7 +239,7 @@ def parse_bz_dict(directory, bugid):
string = string.replace('CAN', 'CVE')
if string in REGEX['m_nomatch'].findall(string):
- cvelist = [NOCVE]
+ cvelist = [NOCVE['cve']]
for (year, split_cves) in REGEX['grp_all'].findall(string):
for cve in REGEX['grp_split'].findall(split_cves):
@@ -247,7 +256,7 @@ def parse_bz_dict(directory, bugid):
}
for item in vul['cvelist']:
- if item != NOCVE:
+ if item != NOCVE['cve']:
if item not in CVES:
CVES[item] = vul.bugid
else:
@@ -362,11 +371,13 @@ def write_xml_file(directory, vul):
for cve in vul['cves']:
cveroot = et.SubElement(root, 'cve')
- if cve == NOCVE:
- node = et.SubElement(cveroot, 'cve')
- node.text = NOCVE
- node = et.SubElement(cveroot, 'desc')
- node.text = NOCVEDESC
+ if cve == NOCVE['cve']:
+ for element in CVEORDER:
+ if element == 'refs':
+ cveroot.append(NOCVE[element])
+ else:
+ node = et.SubElement(cveroot, element)
+ node.text = NOCVE[element]
else:
for element in CVEORDER:
if element == 'refs':