[Openvas-commits] r5586 - in trunk/openvas-client: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sat Oct 17 14:09:02 CEST 2009
Author: mattm
Date: 2009-10-17 14:09:00 +0200 (Sat, 17 Oct 2009)
New Revision: 5586
Modified:
trunk/openvas-client/ChangeLog
trunk/openvas-client/src/omp-cli.c
Log:
* src/omp-cli.c (prints_tasks): Print reports if there are any.
(main): Free report_id.
Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog 2009-10-17 11:02:16 UTC (rev 5585)
+++ trunk/openvas-client/ChangeLog 2009-10-17 12:09:00 UTC (rev 5586)
@@ -1,3 +1,8 @@
+2009-10-17 Matthew Mundell <matthew.mundell at intevation.de>
+
+ * src/omp-cli.c (prints_tasks): Print reports if there are any.
+ (main): Free report_id.
+
2009-10-16 Matthew Mundell <matthew.mundell at intevation.de>
* src/omp-cli.c (prints_tasks): Remove last report printing.
Modified: trunk/openvas-client/src/omp-cli.c
===================================================================
--- trunk/openvas-client/src/omp-cli.c 2009-10-17 11:02:16 UTC (rev 5585)
+++ trunk/openvas-client/src/omp-cli.c 2009-10-17 12:09:00 UTC (rev 5586)
@@ -144,7 +144,8 @@
{
if (strcmp (entity_name (task), "task") == 0)
{
- entity_t entity;
+ entity_t entity, report;
+ entities_t reports;
const char *id, *name, *status, *progress;
id = entity_attribute (task, "id");
@@ -183,6 +184,85 @@
printf (" %2s%% %s\n", progress, name);
else
printf (" %s\n", name);
+
+ /* Print any reports indented under the task. */
+
+ reports = task->entities;
+ while ((report = first_entity (reports)))
+ {
+ if (strcmp (entity_name (report), "report") == 0)
+ {
+ entity_t messages;
+ const char *id, *status, *holes, *infos, *logs, *warnings;
+ const char *time_stamp;
+
+ id = entity_attribute (report, "id");
+ if (id == NULL)
+ {
+ fprintf (stderr, "Failed to parse report ID.\n");
+ return -1;
+ }
+
+ entity = entity_child (report, "scan_run_status");
+ if (entity == NULL)
+ {
+ fprintf (stderr, "Failed to parse report status.\n");
+ return -1;
+ }
+ status = entity_text (entity);
+
+ messages = entity_child (report, "messages");
+ if (entity == NULL)
+ {
+ fprintf (stderr, "Failed to parse report messages.\n");
+ return -1;
+ }
+
+ entity = entity_child (messages, "hole");
+ if (entity == NULL)
+ {
+ fprintf (stderr, "Failed to parse report hole.\n");
+ return -1;
+ }
+ holes = entity_text (entity);
+
+ entity = entity_child (messages, "info");
+ if (entity == NULL)
+ {
+ fprintf (stderr, "Failed to parse report info.\n");
+ return -1;
+ }
+ infos = entity_text (entity);
+
+ entity = entity_child (messages, "log");
+ if (entity == NULL)
+ {
+ fprintf (stderr, "Failed to parse report log.\n");
+ return -1;
+ }
+ logs = entity_text (entity);
+
+ entity = entity_child (messages, "warning");
+ if (entity == NULL)
+ {
+ fprintf (stderr, "Failed to parse report warning.\n");
+ return -1;
+ }
+ warnings = entity_text (entity);
+
+ entity = entity_child (report, "timestamp");
+ if (entity == NULL)
+ {
+ fprintf (stderr, "Failed to parse report timestamp.\n");
+ return -1;
+ }
+ time_stamp = entity_text (entity);
+
+ printf (" %s %-7s %2s %2s %2s %2s %s\n",
+ id, status, holes, warnings, infos, logs, time_stamp);
+ }
+ reports = next_entities (reports);
+ }
}
tasks = next_entities (tasks);
}
@@ -719,6 +799,7 @@
exit (EXIT_FAILURE);
}
printf ("%s\n", report_id);
+ free (report_id);
point++;
}
exit_status = 0;
More information about the Openvas-commits
mailing list