SVN: security/cve_reader.py

shadzik shadzik at pld-linux.org
Fri Nov 2 17:21:44 CET 2007


Author: shadzik
Date: Fri Nov  2 17:21:44 2007
New Revision: 8966

Modified:
   security/cve_reader.py
Log:
- critical fixes


Modified: security/cve_reader.py
==============================================================================
--- security/cve_reader.py	(original)
+++ security/cve_reader.py	Fri Nov  2 17:21:44 2007
@@ -82,9 +82,12 @@
 					# remember the next line after "@@"
 					mem = lines[i+cvslog+1]
 					# and parse the spec instead of commits.log
-					d = parseSPEC(spec, mem).split(" ")
-					r_rev = d[0]
-					r_date = d[1]
+					try:
+						d = parseSPEC(spec, mem).split(" ")
+						r_rev = d[0]
+						r_date = d[1]
+					except(AttributeError):
+						pass
 				if re.match('.*Revision.*', lines[i+cvslog]):
 					# Set new revison data
 					p = lines[i+cvslog].split(" ")
@@ -125,24 +128,27 @@
 
 # parse spec file to getthe real revision of CVE entries that were added later somewhere in the ChangeLog
 def parseSPEC(spec, mem):
-	os.popen("cvs -d %s get %s%s", CVSROOT, CVSMODULE, spec)
-	f = open("%s%s",CVSMODULE, spec)
-	read = f.xreadlines()
-	for l in read:
-		l = l.strip()
-		lines.append(l)
-	for i in range(lines_len):
-		ind = 1
-		if lines[i] == mem:
-			while not lines[i-ind] == "$Log$":
-				if re.match('.*Revision.*', lines[i-ind]):
-					p = lines[i-ind].split(" ")
-					real_rev = p[1]
-					date = p[3]
-				ind = ind + 1
-	f.close()
-	os.remove("%s%s", CVSMODULE, spec)
-	return real_rev + " " + date
+	os.popen("cvs -d %s get %s%s" % (CVSROOT, CVSMODULE, spec))
+	if os.path.isfile("%s%s" % (CVSMODULE, spec)):
+		f = open("%s%s" % (CVSMODULE, spec))
+		read = f.xreadlines()
+		for l in read:
+			l = l.strip()
+			lines.append(l)
+		for i in range(len(lines)):
+			ind = 1
+			if lines[i] == mem:
+				while not lines[i-ind] == "$Log$":
+					if re.match('^Revision.*', lines[i-ind]):
+						p = lines[i-ind].split(" ")
+						real_rev = p[1]
+						date = p[3]
+					ind = ind + 1
+		f.close()
+		os.remove("%s%s" % ( CVSMODULE, spec))
+		return real_rev + " " + date
+	else:
+		return
 
 # adds new <package> into the XML tree
 def addCVEnote(rootnode, spec, cve, revision, date):


More information about the pld-cvs-commit mailing list