[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvas-cvs
Subject:    [Openvas-commits] r6275 - in trunk/openvas-manager: . src
From:       scm-commit () wald ! intevation ! org
Date:       2009-12-29 15:10:46
Message-ID: 20091229151046.D932B8667D1D () pyrosoma ! intevation ! org
[Download RAW message or body]

Author: mattm
Date: 2009-12-29 16:10:45 +0100 (Tue, 29 Dec 2009)
New Revision: 6275

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage.c
   trunk/openvas-manager/src/tasks_sql.h
Log:
	* src/tasks_sql.h (make_report): Add status arg.  Use as initial status
	of report.
	(create_report): Add status arg.  Pass to make_report.

	* src/manage.c (start_task): Create report with requested status, as the
	fork additions have moved the report task association to the end of the
	function.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-12-29 14:43:22 UTC (rev 6274)
+++ trunk/openvas-manager/ChangeLog	2009-12-29 15:10:45 UTC (rev 6275)
@@ -1,5 +1,15 @@
 2009-12-29  Matthew Mundell <matthew.mundell@intevation.de>
 
+	* src/tasks_sql.h (make_report): Add status arg.  Use as initial status
+	of report.
+	(create_report): Add status arg.  Pass to make_report.
+
+	* src/manage.c (start_task): Create report with requested status, as the
+	fork additions have moved the report task association to the end of the
+	function.
+
+2009-12-29  Matthew Mundell <matthew.mundell@intevation.de>
+
 	* src/tasks_sql.h (init_escalator_iterator): Add name arg.  Update caller.
 	(init_escalator_task_iterator, escalator_task_iterator_name)
 	(escalator_task_iterator_uuid): New functions.

Modified: trunk/openvas-manager/src/manage.c
===================================================================
--- trunk/openvas-manager/src/manage.c	2009-12-29 14:43:22 UTC (rev 6274)
+++ trunk/openvas-manager/src/manage.c	2009-12-29 15:10:45 UTC (rev 6275)
@@ -856,7 +856,7 @@
 
   /* Create the report. */
 
-  if (create_report (task, report_id))
+  if (create_report (task, report_id, TASK_STATUS_REQUESTED))
     {
       free (target);
       free (hosts);
@@ -892,6 +892,8 @@
   // FIX On fail exits only, if another process has set a request state then
   //     honour that request.  (stop_task, request_delete_task)
 
+  /** @todo Also reset status on report, as current_scanner_task is 0 here. */
+
   run_status = TASK_STATUS_INTERNAL_ERROR;
 
   /* Reset any running information. */

Modified: trunk/openvas-manager/src/tasks_sql.h
===================================================================
--- trunk/openvas-manager/src/tasks_sql.h	2009-12-29 14:43:22 UTC (rev 6274)
+++ trunk/openvas-manager/src/tasks_sql.h	2009-12-29 15:10:45 UTC (rev 6275)
@@ -4133,18 +4133,20 @@
 /**
  * @brief Make a report.
  *
- * @param[in]  task  The task associated with the report.
- * @param[in]  uuid  The UUID of the report.
+ * @param[in]  task    The task associated with the report.
+ * @param[in]  uuid    The UUID of the report.
+ * @param[in]  status  The run status of the scan associated with the report.
  *
  * @return A report descriptor for the new report.
  */
 report_t
-make_report (task_t task, const char* uuid)
+make_report (task_t task, const char* uuid, task_status_t status)
 {
   report_t report;
-  sql ("INSERT into reports (uuid, hidden, task, date, nbefile, comment)"
-       " VALUES ('%s', 0, %llu, %i, '', '');",
-       uuid, task, time (NULL));
+  sql ("INSERT into reports (uuid, hidden, task, date, nbefile, comment,"
+       " scan_run_status)"
+       " VALUES ('%s', 0, %llu, %i, '', '', %u);",
+       uuid, task, time (NULL), status);
   report = sqlite3_last_insert_rowid (task_db);
   return report;
 }
@@ -4154,11 +4156,12 @@
  *
  * @param[in]   task       The task.
  * @param[out]  report_id  Report ID.
+ * @param[in]   status     Run status of scan associated with report.
  *
  * @return 0 success, -1 current_report is already set, -2 failed to generate ID.
  */
 static int
-create_report (task_t task, char **report_id)
+create_report (task_t task, char **report_id, task_status_t status)
 {
   assert (current_report == (report_t) 0);
   if (current_report) return -1;
@@ -4172,7 +4175,7 @@
 
   /* Create the report. */
 
-  current_report = make_report (task, *report_id);
+  current_report = make_report (task, *report_id, status);
 
   return 0;
 }

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
http://lists.wald.intevation.org/mailman/listinfo/openvas-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic