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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 30 19:08:54 CET 2011


Author: mattm
Date: 2011-11-30 19:08:51 +0100 (Wed, 30 Nov 2011)
New Revision: 12229

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage_sql.c
Log:
	* src/manage_sql.c (report_counts_id_filt): Account for host in override
	case.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-11-30 17:38:22 UTC (rev 12228)
+++ trunk/openvas-manager/ChangeLog	2011-11-30 18:08:51 UTC (rev 12229)
@@ -1,5 +1,10 @@
 2011-11-28  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/manage_sql.c (report_counts_id_filt): Account for host in override
+	case.
+
+2011-11-28  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	* src/manage_sql.c (report_count_filtered): Add missing paren in SQL.
 
 2011-11-24  Matthew Mundell <matthew.mundell at greenbone.net>

Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c	2011-11-30 17:38:22 UTC (rev 12228)
+++ trunk/openvas-manager/src/manage_sql.c	2011-11-30 18:08:51 UTC (rev 12229)
@@ -14246,7 +14246,7 @@
           task_t task;
 
           sqlite3_stmt *stmt, *full_stmt;
-          gchar *select;
+          gchar *select, *quoted_host;
           int ret;
 
           /* Prepare quick inner statement. */
@@ -14347,13 +14347,22 @@
           if (filtered_logs) *filtered_logs = 0;
           if (filtered_warnings) *filtered_warnings = 0;
           if (filtered_false_positives) *filtered_false_positives = 0;
+          if (host)
+            quoted_host = sql_quote (host);
           init_iterator (&results,
                          "SELECT results.ROWID, results.nvt, results.type,"
                          " results.host, results.port, results.description"
                          " FROM results, report_results"
-                         " WHERE report_results.report = %llu"
+                         " WHERE"
+                         "%s%s%s"
+                         " report_results.report = %llu"
                          " AND results.ROWID = report_results.result",
+                         host ? " results.host = '" : "",
+                         host ? quoted_host : "",
+                         host ? "' AND" : "",
                          report);
+          if (host)
+            g_free (quoted_host);
           while (next (&results))
             {
               const char *nvt, *new_type;



More information about the Openvas-commits mailing list