[Oval-commits] r91 - trunk/tools/oval/definition
Pavel Vinogradov
blaze-guest at alioth.debian.org
Tue Jul 17 14:52:32 UTC 2007
Author: blaze-guest
Date: 2007-07-17 14:52:32 +0000 (Tue, 17 Jul 2007)
New Revision: 91
Modified:
trunk/tools/oval/definition/generator.py
Log:
Code refactoring. Change errors status.
Modified: trunk/tools/oval/definition/generator.py
===================================================================
--- trunk/tools/oval/definition/generator.py 2007-07-17 11:31:46 UTC (rev 90)
+++ trunk/tools/oval/definition/generator.py 2007-07-17 14:52:32 UTC (rev 91)
@@ -296,20 +296,28 @@
dsa -- DSA dentificator
dsaref -- DSA parsed data
"""
- doc = xml.dom.minidom.Document ()
-
if not dsaref.has_key("release"):
logging.log(logging.ERROR, "DSA %s: Release definition not well formatted. Ignore this DSA." % dsa)
raise DSAFormatException
-
- if not dsaref.has_key("description"):
- logging.log(logging.ERROR, "DSA %s: Description information missed. Ignore this DSA." % dsa)
- raise DSAFormatException
-
+
if not dsaref.has_key("packages"):
logging.log(logging.ERROR, "DSA %s: Package information missed. Ignore this DSA." % dsa)
raise DSAFormatException
+
+ if not dsaref.has_key("description"):
+ logging.log(logging.WARNING, "DSA %s: Description information missed." % dsa)
+ dsaref["description"] = ""
+
+ if not dsaref.has_key("moreinfo"):
+ logging.log(logging.WARNING, "DSA %s: Moreinfo information missed." % dsa)
+ dsaref["moreinfo"] = ""
+ if not dsaref.has_key("secrefs"):
+ logging.log(logging.WARNING, "DSA %s: Secrefs information missed." % dsa)
+ dsaref["secrefs"] = ""
+
+ doc = xml.dom.minidom.Document ()
+
### Definition block: Metadata, Notes, Criteria
### TODO: Replace DSA id with unique id
definition = __createXMLElement ("definition", attrs = {"id" : "oval:org.debian:def:%s" % __trimzero(dsa), "version" : "1", "class" : "vulnerability"})
@@ -328,14 +336,11 @@
### Definition : Metadata : Affected : END ###
refpatern = re.compile (r'((CVE|CAN)-[\d-]+)')
- if dsaref.has_key("secrefs"):
- for ref in dsaref.get("secrefs").split(" "):
- result = refpatern.search(ref)
- if result:
- (ref_id, source) = result.groups()
- metadata.appendChild ( __createXMLElement ("reference", attrs = {"source" : source, "ref_id" : ref_id, "ref_url" : "http://cve.mitre.org/cgi-bin/cvename.cgi?name=%s" % ref_id}) )
- else:
- logging.log(logging.WARNING, "DSA %s: Missing secrefs section." % dsa)
+ for ref in dsaref.get("secrefs").split(" "):
+ result = refpatern.search(ref)
+ if result:
+ (ref_id, source) = result.groups()
+ metadata.appendChild ( __createXMLElement ("reference", attrs = {"source" : source, "ref_id" : ref_id, "ref_url" : "http://cve.mitre.org/cgi-bin/cvename.cgi?name=%s" % ref_id}) )
#TODO: move this info to other place
metadata.appendChild ( __createXMLElement ("description", "What information can i put there?"))
@@ -346,8 +351,6 @@
metadata.appendChild (debianMetadata)
definition.appendChild ( metadata )
- ### Definition : Notes ###
-
### Definition : Criteria ###
platformCriteria = __createXMLElement ("criteria", attrs = {"comment" : "Platform section", "operator" : "OR"})
More information about the Oval-commits
mailing list