[Openvas-commits] r11926 - in trunk/openvas-manager: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 1 19:20:26 CET 2011


Author: mattm
Date: 2011-11-01 19:20:25 +0100 (Tue, 01 Nov 2011)
New Revision: 11926

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage_sql.c
Log:
	* src/manage_sql.c (print_report_xml): Buffer the host only if it has
	results on the current page.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-11-01 17:39:54 UTC (rev 11925)
+++ trunk/openvas-manager/ChangeLog	2011-11-01 18:20:25 UTC (rev 11926)
@@ -1,5 +1,10 @@
 2011-11-01  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/manage_sql.c (print_report_xml): Buffer the host only if it has
+	results on the current page.
+
+2011-11-01  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	* src/manage_sql.c (struct buffer_host): New structure.
 	(buffer_host_t): New type.
 	(free_buffer): New function.

Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c	2011-11-01 17:39:54 UTC (rev 11925)
+++ trunk/openvas-manager/src/manage_sql.c	2011-11-01 18:20:25 UTC (rev 11926)
@@ -16394,17 +16394,6 @@
                 report_host = 0;
             }
 
-          if (report_host && max_results)
-            {
-              // FIX only if host has results.
-              /* Buffer IP and report_host. */
-              buffer_host_t *buffer_host;
-              buffer_host = (buffer_host_t*) g_malloc (sizeof (buffer_host_t));
-              buffer_host->report_host = report_host;
-              buffer_host->ip = g_strdup (ip);
-              array_add (buffer, buffer_host);
-            }
-
           if (report_host)
             {
               init_host_iterator (&report_hosts, 0, NULL, report_host);
@@ -16412,7 +16401,9 @@
                 {
                   iterator_t prognosis;
                   report_t report;
+                  int buffered;
 
+                  buffered = 0;
                   report = host_iterator_report (&report_hosts);
 
                   init_host_prognosis_iterator (&prognosis, report_host,
@@ -16436,6 +16427,17 @@
                        if (max_results == 0)
                          continue;
 
+                       if (buffered == 0 && report_host && max_results)
+                         {
+                           /* Buffer IP and report_host. */
+                           buffer_host_t *buffer_host;
+                           buffer_host = (buffer_host_t*) g_malloc (sizeof (buffer_host_t));
+                           buffer_host->report_host = report_host;
+                           buffer_host->ip = g_strdup (ip);
+                           array_add (buffer, buffer_host);
+                           buffered = 1;
+                         }
+
                       PRINT (out,
                              "<result>"
                              "<subnet/>"



More information about the Openvas-commits mailing list