Author: fw Date: 2005-10-20 12:20:09 +0000 (Thu, 20 Oct 2005) New Revision: 2507 Modified: lib/python/security_db.py Log: lib/python/security_db.py (DB.readBugs): Add code to copy notes from DSAs to CVEs. Correctly handle <unfixed> notes. Modified: lib/python/security_db.py ==================================================================--- lib/python/security_db.py 2005-10-20 12:16:07 UTC (rev 2506) +++ lib/python/security_db.py 2005-10-20 12:20:09 UTC (rev 2507) @@ -719,12 +719,13 @@ if self.verbose: print " copy notes" - # Copy notes from DTSA to CVE. + # Copy notes from DSA/DTSA to CVE. old_source = '''' for source, target in list(cursor.execute( """SELECT source, target FROM bugs_xref - WHERE source LIKE ''DTSA-%'' AND target LIKE ''CVE-%''""")): + WHERE (source LIKE ''DTSA-%'' OR source LIKE ''DSA-%'') + AND target LIKE ''CVE-%''""")): if source <> old_source: source_bug = bugs.BugFromDB(cursor, source) old_source = source @@ -737,12 +738,20 @@ else: rel = '''' present = False + for (version, note_id) in list(cursor.execute( """SELECT fixed_version, id FROM package_notes WHERE bug_name = ? AND package = ? AND release = ?""", (target, n.package, rel))): - if n.fixed_version > debian_support.Version(version): + if version is None: + # The target is marked as unfixed. Our + # version cannot win. + present = True + continue + + if (n.fixed_version is None + or n.fixed_version > debian_support.Version(version)): # If our version is larger, it is the definitive one. # Remove the existing entry in this case. cursor.execute(