[Openvas-commits] r11620 - in trunk/gsa: . src src/html

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 15 20:30:30 CEST 2011


Author: mattm
Date: 2011-09-15 20:30:29 +0200 (Thu, 15 Sep 2011)
New Revision: 11620

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad.c
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/html/omp.xsl
Log:
	* src/gsad.c (init_validator): Add host filters.

	* src/gsad_omp.c (get_report_omp): Add host filters to
	GET_PROGNOSTIC_REPORT.

	* src/html/omp.xsl (html-report-details): Get most filters for back link
	from new GET_PROGNOSTIC_REPORT elements, instead of using the result
	filters.
	(report [assets]): Use host names for filter params in prognostic report
	link.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2011-09-15 15:59:32 UTC (rev 11619)
+++ trunk/gsa/ChangeLog	2011-09-15 18:30:29 UTC (rev 11620)
@@ -1,5 +1,18 @@
 2011-09-15  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/gsad.c (init_validator): Add host filters.
+
+	* src/gsad_omp.c (get_report_omp): Add host filters to
+	GET_PROGNOSTIC_REPORT.
+
+	* src/html/omp.xsl (html-report-details): Get most filters for back link
+	from new GET_PROGNOSTIC_REPORT elements, instead of using the result
+	filters.
+	(report [assets]): Use host names for filter params in prognostic report
+	link.
+
+2011-09-15  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	Add single host prognostic reports.
 
 	* src/gsad.c (init_validator): Add prognostic to type.

Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c	2011-09-15 15:59:32 UTC (rev 11619)
+++ trunk/gsa/src/gsad.c	2011-09-15 18:30:29 UTC (rev 11620)
@@ -662,6 +662,9 @@
   openvas_validator_alias (validator, "esc_max_results",  "max_results");
   openvas_validator_alias (validator, "esc_min_cvss_base", "min_cvss_base");
   openvas_validator_alias (validator, "esc_search_phrase", "search_phrase");
+  openvas_validator_alias (validator, "host_search_phrase", "search_phrase");
+  openvas_validator_alias (validator, "host_first_result", "first_result");
+  openvas_validator_alias (validator, "host_max_results", "max_results");
   openvas_validator_alias (validator, "refresh_interval", "number");
   openvas_validator_alias (validator, "event",        "condition");
   openvas_validator_alias (validator, "access_hosts", "hosts_opt");

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2011-09-15 15:59:32 UTC (rev 11619)
+++ trunk/gsa/src/gsad_omp.c	2011-09-15 18:30:29 UTC (rev 11620)
@@ -7734,7 +7734,46 @@
       else if (host || (type && (strcmp (type, "prognostic") == 0)))
         {
           if (type && (strcmp (type, "prognostic") == 0))
-            xml = g_string_new ("<get_prognostic_report>");
+            {
+              const char *host_search_phrase, *host_first_result;
+              const char *host_max_results;
+
+              xml = g_string_new ("<get_prognostic_report>");
+
+              host_search_phrase = params_value (params, "host_search_phrase");
+              if (host_search_phrase == NULL)
+                params_given (params, "host_search_phrase")
+                  || (host_search_phrase = "");
+
+              host_first_result = params_value (params, "host_first_result");
+              if (host_first_result == NULL
+                  || sscanf (host_first_result, "%u", &first) != 1)
+                host_first_result = "1";
+
+              host_max_results = params_value (params, "host_max_results");
+              if (host_max_results == NULL
+                  || sscanf (host_max_results, "%u", &max) != 1)
+                host_max_results = G_STRINGIFY (RESULTS_PER_PAGE);
+
+              if (host_search_phrase == NULL)
+                {
+                  openvas_server_close (socket, session);
+                  xml = g_string_new ("");
+                  g_string_append_printf (xml, GSAD_MESSAGE_INVALID,
+                                          "Given host search_phrase was invalid",
+                                          "Get Report");
+                  return xsl_transform_omp (credentials, g_string_free (xml, FALSE));
+                }
+
+              g_string_append_printf (xml,
+                                      "<host_search_phrase>"
+                                      "%s"
+                                      "</host_search_phrase>"
+                                      "<results start=\"%s\" max=\"%s\"/>",
+                                      host_search_phrase,
+                                      host_first_result,
+                                      host_max_results);
+            }
           else
             xml = g_string_new ("<get_asset>");
           g_string_append_printf (xml,

Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl	2011-09-15 15:59:32 UTC (rev 11619)
+++ trunk/gsa/src/html/omp.xsl	2011-09-15 18:30:29 UTC (rev 11620)
@@ -873,7 +873,7 @@
       <xsl:choose>
         <xsl:when test="@type='prognostic'">
           <div class="float_right">
-            <a href="?cmd=get_report&amp;type=assets&amp;levels={report/filters/text()}&amp;search_phrase={report/filters/phrase}&amp;first_result={report/results/@start}&amp;max_results={report/results/@max}&amp;task_id={report/task/@id}&amp;token={/envelope/token}">Back to Assets</a>
+            <a href="?cmd=get_report&amp;type=assets&amp;levels={report/filters/text()}&amp;search_phrase={../../host_search_phrase}&amp;first_result={../../results/@start}&amp;max_results={../../results/@max}&amp;token={/envelope/token}">Back to Assets</a>
           </div>
         </xsl:when>
         <xsl:otherwise>
@@ -11492,7 +11492,7 @@
              title="Asset Details" style="margin-left:3px;">
             <img src="/img/details.png" border="0" alt="Details"/>
           </a>
-          <a href="/omp?cmd=get_report&amp;type=prognostic&amp;host={ip}&amp;pos=1&amp;search_phrase={../filters/phrase}&amp;levels={gsa:build-levels(../filters)}&amp;first_result={../hosts/@start}&amp;max_results={../hosts/@max}&amp;token={/envelope/token}"
+          <a href="/omp?cmd=get_report&amp;type=prognostic&amp;host={ip}&amp;pos=1&amp;host_search_phrase={../filters/phrase}&amp;levels={gsa:build-levels(../filters)}&amp;host_first_result={../hosts/@start}&amp;host_max_results={../hosts/@max}&amp;token={/envelope/token}"
              title="Prognostic Report" style="margin-left:3px;">
             <img src="/img/new.png" border="0" alt="Prognostic Report"/>
           </a>



More information about the Openvas-commits mailing list