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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 1 10:01:32 CEST 2009


Author: mattm
Date: 2009-07-01 10:01:32 +0200 (Wed, 01 Jul 2009)
New Revision: 3898

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/omp.c
Log:
	* src/omp.c (omp_xml_handle_end_element): In GET_STATUS only print a
	LAST_REPORT if there is a last report.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-07-01 06:55:14 UTC (rev 3897)
+++ trunk/openvas-manager/ChangeLog	2009-07-01 08:01:32 UTC (rev 3898)
@@ -1,3 +1,8 @@
+2009-07-01  Matthew Mundell <mmundell at intevation.de>
+
+	* src/omp.c (omp_xml_handle_end_element): In GET_STATUS only print a
+	LAST_REPORT if there is a last report.
+
 2009-06-30  Matthew Mundell <mmundell at intevation.de>
 
 	Add a LAST_REPORT element to the GET_STATUS response.

Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c	2009-07-01 06:55:14 UTC (rev 3897)
+++ trunk/openvas-manager/src/omp.c	2009-07-01 08:01:32 UTC (rev 3898)
@@ -2064,15 +2064,29 @@
                     int ret;
                     gchar* response;
                     char* name;
-                    gchar* last_report_id;
+                    gchar *last_report_id, *last_report;
 
                     last_report_id = task_last_report_id (tsk_uuid);
-                    if (last_report_id == NULL)
+                    if (last_report_id)
                       {
-                        free (tsk_uuid);
-                        error_send_to_client (error);
-                        return;
+                        last_report = g_strdup_printf ("<last_report>"
+                                                       "<report id=\"%s\">"
+                                                       "<timestamp>"
+                                                       "FIX"
+                                                       "</timestamp>"
+                                                       "<messages>"
+                                                       "<hole>0</hole>"
+                                                       "<info>0</info>"
+                                                       "<log>0</log>"
+                                                       "<debug>0</debug>"
+                                                       "</messages>"
+                                                       "</report>"
+                                                       "</last_report>",
+                                                       last_report_id);
+                        g_free (last_report_id);
                       }
+                    else
+                      last_report = g_strdup ("");
 
                     name = task_name (task);
                     response = g_strdup_printf ("<get_status_response"
@@ -2088,17 +2102,7 @@
                                                 "<warning>%i</warning>"
                                                 "</messages>"
                                                 "<report_count>%u</report_count>"
-                                                "<last_report>"
-                                                "<report id=\"%s\">"
-                                                "<timestamp>FIX</timestamp>"
-                                                "<messages>"
-                                                "<hole>0</hole>"
-                                                "<info>0</info>"
-                                                "<log>0</log>"
-                                                "<debug>0</debug>"
-                                                "</messages>"
-                                                "</report>"
-                                                "</last_report>",
+                                                "%s",
                                                 tsk_uuid,
                                                 name,
                                                 task_run_status_name (task),
@@ -2108,8 +2112,8 @@
                                                 task_logs_size (task),
                                                 task_notes_size (task),
                                                 task_report_count (task),
-                                                last_report_id);
-                    g_free (last_report_id);
+                                                last_report);
+                    g_free (last_report);
                     ret = send_to_client (response);
                     g_free (response);
                     g_free (name);
@@ -2155,18 +2159,30 @@
                 gchar* line;
                 char* name = task_name (index);
                 char* tsk_uuid;
-                gchar* last_report_id;
+                gchar *last_report_id, *last_report;
 
                 // FIX buffer entire response so this can respond on err
                 if (task_uuid (index, &tsk_uuid)) abort ();
 
                 last_report_id = task_last_report_id (tsk_uuid);
-                if (last_report_id == NULL)
+                if (last_report_id)
                   {
-                    free (tsk_uuid);
-                    error_send_to_client (error);
-                    return;
+                    last_report = g_strdup_printf ("<last_report>"
+                                                   "<report id=\"%s\">"
+                                                   "<timestamp>FIX</timestamp>"
+                                                   "<messages>"
+                                                   "<hole>0</hole>"
+                                                   "<info>0</info>"
+                                                   "<log>0</log>"
+                                                   "<debug>0</debug>"
+                                                   "</messages>"
+                                                   "</report>"
+                                                   "</last_report>",
+                                                   last_report_id);
+                    g_free (last_report_id);
                   }
+                else
+                  last_report = g_strdup ("");
 
                 line = g_strdup_printf ("<task"
                                         " id=\"%s\">"
@@ -2180,17 +2196,7 @@
                                         "<warning>%i</warning>"
                                         "</messages>"
                                         "<report_count>%u</report_count>"
-                                        "<last_report>"
-                                        "<report id=\"%s\">"
-                                        "<timestamp>FIX</timestamp>"
-                                        "<messages>"
-                                        "<hole>0</hole>"
-                                        "<info>0</info>"
-                                        "<log>0</log>"
-                                        "<debug>0</debug>"
-                                        "</messages>"
-                                        "</report>"
-                                        "</last_report>"
+                                        "%s"
                                         "</task>",
                                         tsk_uuid,
                                         name,
@@ -2201,8 +2207,8 @@
                                         task_logs_size (index),
                                         task_notes_size (index),
                                         task_report_count (index),
-                                        last_report_id);
-                g_free (last_report_id);
+                                        last_report);
+                g_free (last_report);
                 free (name);
                 free (tsk_uuid);
                 if (send_to_client (line))



More information about the Openvas-commits mailing list