[Openvas-commits] r11626 - in trunk/openvas-manager: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Sep 16 18:23:03 CEST 2011
Author: mattm
Date: 2011-09-16 18:23:01 +0200 (Fri, 16 Sep 2011)
New Revision: 11626
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/manage.h
trunk/openvas-manager/src/manage_sql.c
trunk/openvas-manager/src/omp.c
Log:
Add host filters to GET_REPORT for prognostic case.
* src/manage_sql.c (print_report_xml): Add host filters for prognostic
report. Enable multi-host prognostic case. Update caller.
(manage_send_report): Add host filters for prognostic report.
* src/manage.h: Add headers accordingly.
* src/omp.c (get_reports_data_t, get_reports_data_reset)
(omp_xml_handle_start_element, omp_xml_handle_end_element): Add host
filters to GET_REPORT.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2011-09-16 15:22:17 UTC (rev 11625)
+++ trunk/openvas-manager/ChangeLog 2011-09-16 16:23:01 UTC (rev 11626)
@@ -1,9 +1,24 @@
2011-09-15 Matthew Mundell <matthew.mundell at greenbone.net>
- * src/manage_sql.c (print_report_xml):
+ Add host filters to GET_REPORT for prognostic case.
+ * src/manage_sql.c (print_report_xml): Add host filters for prognostic
+ report. Enable multi-host prognostic case. Update caller.
+ (manage_send_report): Add host filters for prognostic report.
+
+ * src/manage.h: Add headers accordingly.
+
+ * src/omp.c (get_reports_data_t, get_reports_data_reset)
+ (omp_xml_handle_start_element, omp_xml_handle_end_element): Add host
+ filters to GET_REPORT.
+
2011-09-15 Matthew Mundell <matthew.mundell at greenbone.net>
+ * src/manage_sql.c (print_report_xml): Remove SCAP details from prognostic
+ report.
+
+2011-09-15 Matthew Mundell <matthew.mundell at greenbone.net>
+
Add single host prognostic reports.
* src/manage_sql.c (init_prognosis_iterator): Add description and CPE
Modified: trunk/openvas-manager/src/manage.h
===================================================================
--- trunk/openvas-manager/src/manage.h 2011-09-16 15:22:17 UTC (rev 11625)
+++ trunk/openvas-manager/src/manage.h 2011-09-16 16:23:01 UTC (rev 11626)
@@ -811,7 +811,7 @@
const char *, int, int, int, int, int, int, int,
gboolean (*) (const char *, int (*) (void*), void*),
int (*) (void*), void *, const char *, const char *,
- const char *, int);
+ const char *, int, const char *, const char *, int, int);
/* RC's. */
Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c 2011-09-16 15:22:17 UTC (rev 11625)
+++ trunk/openvas-manager/src/manage_sql.c 2011-09-16 16:23:01 UTC (rev 11626)
@@ -14816,6 +14816,15 @@
* @param[in] host Host or NULL, when type "assets".
* @param[in] pos Position of report from end, when type
* "assets".
+ * @param[in] host_search_phrase Phrase that results must include. All results
+ * if NULL or "". For hosts.
+ * @param[in] host_levels String describing threat levels (message types)
+ * to include in count (for example, "hmlgd" for
+ * High, Medium, Low, loG and Debug). All levels if
+ * NULL.
+ * @param[in] host_first_result The host result to start from. The results
+ * are 0 indexed.
+ * @param[in] host_max_results The host maximum number of results returned.
*
* @return 0 on success, -1 error.
*/
@@ -14827,7 +14836,9 @@
int apply_overrides, const char *search_phrase, int notes,
int notes_details, int overrides, int overrides_details,
int first_result, int max_results, const char *type,
- const char *host, int pos)
+ const char *host, int pos, const char *host_search_phrase,
+ const char *host_levels, int host_first_result,
+ int host_max_results)
{
FILE *out;
char *uuid, *tsk_uuid = NULL, *start_time, *end_time;
@@ -15305,8 +15316,8 @@
}
else
{
- abort ();
-#if 0
+ host_levels = host_levels ? host_levels : "hmlgd";
+
init_asset_iterator (&hosts, host_first_result, host_max_results,
host_levels, host_search_phrase);
PRINT (out,
@@ -15321,7 +15332,6 @@
/* Add 1 for 1 indexing. */
host_first_result + 1,
host_max_results);
-#endif
}
result_count = holes = warnings = infos = logs = 0;
@@ -16710,7 +16720,8 @@
result_hosts_only, min_cvss_base, report_format,
levels, NULL, apply_overrides, search_phrase, notes,
notes_details, overrides, overrides_details,
- first_result, max_results, type, NULL, 0))
+ first_result, max_results, type, NULL, 0, NULL, NULL,
+ 0, 0))
{
g_free (xml_file);
return NULL;
@@ -17120,6 +17131,15 @@
* @param[in] host Host or NULL, when type "assets".
* @param[in] pos Position of report from end, when host. 1 for
* last.
+ * @param[in] host_search_phrase Phrase that results must include. All results
+ * if NULL or "". For hosts.
+ * @param[in] host_levels String describing threat levels (message types)
+ * to include in count (for example, "hmlgd" for
+ * High, Medium, Low, loG and Debug). All levels if
+ * NULL.
+ * @param[in] host_first_result The host result to start from. The results
+ * are 0 indexed.
+ * @param[in] host_max_results The host maximum number of results returned.
*
* @return 0 success, -1 error, 1 failed to find escalator.
*/
@@ -17136,7 +17156,9 @@
gboolean (*send) (const char *, int (*) (void*), void*),
int (*send_data_1) (void*), void *send_data_2,
const char *escalator_id, const char *type,
- const char *host, int pos)
+ const char *host, int pos, const char *host_search_phrase,
+ const char *host_levels, int host_first_result,
+ int host_max_results)
{
task_t task;
gchar *xml_file;
@@ -17195,7 +17217,8 @@
report_format, levels, delta_states, apply_overrides,
search_phrase, notes, notes_details, overrides,
overrides_details, first_result, max_results, type,
- host, pos))
+ host, pos, host_search_phrase, host_levels,
+ host_first_result, host_max_results))
{
g_free (xml_file);
return -1;
Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c 2011-09-16 15:22:17 UTC (rev 11625)
+++ trunk/openvas-manager/src/omp.c 2011-09-16 16:23:01 UTC (rev 11626)
@@ -1784,10 +1784,14 @@
char *report_id; ///< ID of single report to get.
int first_result; ///< Skip over results before this result number.
int max_results; ///< Maximum number of results return.
+ int host_first_result; ///< Skip over results before this result number.
+ int host_max_results; ///< Maximum number of results return.
char *sort_field; ///< Field to sort results on.
int sort_order; ///< Result sort order: 0 descending, else ascending.
char *levels; ///< Letter encoded threat level filter.
+ char *host_levels; ///< Letter encoded threat level filter, for hosts.
char *search_phrase; ///< Search phrase result filter.
+ char *host_search_phrase; ///< Search phrase result filter.
char *min_cvss_base; ///< Minimum CVSS base filter.
int notes; ///< Boolean. Whether to include associated notes.
int notes_details; ///< Boolean. Whether to include details of above.
@@ -1814,7 +1818,9 @@
free (data->report_id);
free (data->sort_field);
free (data->levels);
+ free (data->host_levels);
free (data->search_phrase);
+ free (data->host_search_phrase);
free (data->min_cvss_base);
free (data->type);
free (data->host);
@@ -4236,11 +4242,24 @@
get_reports_data->first_result = 0;
if (find_attribute (attribute_names, attribute_values,
+ "host_first_result", &attribute))
+ /* Subtract 1 to switch from 1 to 0 indexing. */
+ get_reports_data->host_first_result = atoi (attribute) - 1;
+ else
+ get_reports_data->host_first_result = 0;
+
+ if (find_attribute (attribute_names, attribute_values,
"max_results", &attribute))
get_reports_data->max_results = atoi (attribute);
else
get_reports_data->max_results = -1;
+ if (find_attribute (attribute_names, attribute_values,
+ "host_max_results", &attribute))
+ get_reports_data->host_max_results = atoi (attribute);
+ else
+ get_reports_data->host_max_results = -1;
+
append_attribute (attribute_names, attribute_values, "sort_field",
&get_reports_data->sort_field);
@@ -4260,6 +4279,9 @@
append_attribute (attribute_names, attribute_values, "levels",
&get_reports_data->levels);
+ append_attribute (attribute_names, attribute_values, "host_levels",
+ &get_reports_data->host_levels);
+
append_attribute (attribute_names, attribute_values, "delta_states",
&get_reports_data->delta_states);
@@ -9927,7 +9949,8 @@
get_reports_data->escalator_id,
"assets",
get_reports_data->host,
- pos);
+ pos,
+ NULL, NULL, 0, 0);
if (ret)
{
@@ -9997,7 +10020,11 @@
get_reports_data->escalator_id,
"prognostic",
get_reports_data->host,
- pos);
+ pos,
+ get_reports_data->host_search_phrase,
+ get_reports_data->host_levels,
+ get_reports_data->host_first_result,
+ get_reports_data->host_max_results);
if (ret)
{
@@ -10069,8 +10096,7 @@
write_to_client_data,
get_reports_data->escalator_id,
get_reports_data->type,
- NULL,
- 0);
+ NULL, 0, NULL, NULL, 0, 0);
if (ret)
{
if (get_reports_data->escalator_id)
More information about the Openvas-commits
mailing list