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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Sep 6 16:37:48 CEST 2011


Author: mattm
Date: 2011-09-06 16:37:47 +0200 (Tue, 06 Sep 2011)
New Revision: 11575

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage_sql.c
Log:
	* src/manage_sql.c (host_report_count): Count only visible finished
	reports belonging to the user.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-09-06 13:59:47 UTC (rev 11574)
+++ trunk/openvas-manager/ChangeLog	2011-09-06 14:37:47 UTC (rev 11575)
@@ -1,5 +1,10 @@
 2011-09-06  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/manage_sql.c (host_report_count): Count only visible finished
+	reports belonging to the user.
+
+2011-09-06  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	* src/schema_formats/XML/OMP.xml (get_reports): Add host and pos args.
 
 	* doc/omp.rnc, doc/omp.html: Update from source.

Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c	2011-09-06 13:59:47 UTC (rev 11574)
+++ trunk/openvas-manager/src/manage_sql.c	2011-09-06 14:37:47 UTC (rev 11575)
@@ -14326,10 +14326,24 @@
 {
   int count;
   gchar *quoted_host;
+  assert (current_credentials.uuid);
   quoted_host = sql_quote (host);
   count = sql_int (0, 0,
-                   "SELECT count (*) FROM report_hosts WHERE host = '%s';",
-                   quoted_host);
+                   "SELECT count (*) FROM report_hosts WHERE host = '%s'"
+                   "  AND (SELECT reports.owner FROM reports"
+                   "       WHERE reports.ROWID = report_hosts.report)"
+                   "      = (SELECT ROWID FROM users"
+                   "         WHERE users.uuid = '%s')"
+                   "  AND (SELECT tasks.hidden FROM tasks, reports"
+                   "       WHERE reports.task = tasks.ROWID"
+                   "       AND reports.ROWID = report_hosts.report)"
+                   "      = 0"
+                   "  AND (SELECT reports.scan_run_status FROM reports"
+                   "       WHERE reports.ROWID = report_hosts.report)"
+                   "      = %u;",
+                   quoted_host,
+                   current_credentials.uuid,
+                   TASK_STATUS_DONE);
   g_free (quoted_host);
   return count;
 }



More information about the Openvas-commits mailing list