[Openvas-commits] r11912 - in trunk/openvas-manager: . tools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 1 13:58:36 CET 2011


Author: hdoreau
Date: 2011-11-01 13:58:35 +0100 (Tue, 01 Nov 2011)
New Revision: 11912

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/tools/cpe_getbyname.xsl
Log:
* tools/cpe_getbyname.xsl: Return an empty item if nothing was found.


Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-11-01 12:24:12 UTC (rev 11911)
+++ trunk/openvas-manager/ChangeLog	2011-11-01 12:58:35 UTC (rev 11912)
@@ -1,3 +1,7 @@
+2011-11-01  Henri Doreau <henri.doreau at greenbone.net>
+
+	* tools/cpe_getbyname.xsl: Return an empty item if nothing was found.
+
 2011-10-31  Matthew Mundell <matthew.mundell at greenbone.net>
 
 	* src/manage_sql.c (prognostic_report_result_count): Increment the return

Modified: trunk/openvas-manager/tools/cpe_getbyname.xsl
===================================================================
--- trunk/openvas-manager/tools/cpe_getbyname.xsl	2011-11-01 12:24:12 UTC (rev 11911)
+++ trunk/openvas-manager/tools/cpe_getbyname.xsl	2011-11-01 12:58:35 UTC (rev 11912)
@@ -36,7 +36,23 @@
 <xsl:output method="html"/>
 
 <xsl:template match="cpe:cpe-list">
-  <xsl:copy-of select="cpe:cpe-item[@name = $refname]"/>
+  <xsl:choose>
+    <xsl:when test="count(cpe:cpe-item[@name = $refname]) &gt; 0">
+      <xsl:copy-of select="cpe:cpe-item[@name = $refname]"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <!--
+        Return an empty item if nothing was found. This CPE is probably
+        referenced by a CVE but not in the official dictionary yet.
+      -->
+      <cpe-item xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.3"
+                xmlns:meta="http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2"
+                xmlns:ns6="http://scap.nist.gov/schema/scap-core/0.1"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xmlns:config="http://scap.nist.gov/schema/configuration/0.1"
+                xmlns="http://cpe.mitre.org/dictionary/2.0" name="{$refname}"/>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 </xsl:stylesheet>



More information about the Openvas-commits mailing list