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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jun 21 19:23:31 CEST 2010


Author: mattm
Date: 2010-06-21 19:23:29 +0200 (Mon, 21 Jun 2010)
New Revision: 8102

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad.c
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/gsad_omp.h
   trunk/gsa/src/html/gsad.xsl
   trunk/gsa/src/html/help.xsl
   trunk/gsa/src/html/omp.xsl
Log:
	Remove report "Apply overrides" checkbox.  Make the actions on the task
	list preserve the override state.

	* src/gsad.c (init_validator): Add command new_task.
	(exec_omp_post): Call new_task_omp instead of gsad_newtask, passing
	"apply override" flag.  Pass "apply override" flag to create_task_omp.
	(exec_omp_get): Pass "apply override" flag to task functions that lead to
	getting the task list.  Pass "show overrides" flag to functions that lead
	to getting a single task.
	(request_handler): Remove new_task.html special case.

	* src/gsad_omp.c (gsad_newtask): Remove.
	(new_task_omp): New function.  Rename from gsad_newtask.  Add
	apply_overrides arg.
	(create_task_omp, delete_task_omp, edit_task, edit_task_omp)
	(save_task_omp, abort_task_omp, pause_task_omp, resume_paused_task_omp)
	(resume_stopped_task_omp, start_task_omp): Add apply_overrides flag.
	(delete_note_omp, save_note_omp, delete_override_omp)
	(save_override_omp): Pass overrides arg to get_tasks as apply_overrides.

	* src/gsad_omp.h: Update headers accordingly.

	* src/html/gsad.xsl (autorefresh): Add overrides to URL.
	(html-gsa-navigation): Add overrides flags to get_tasks URL.  Replace
	new_task.html with new_task command.

	* src/html/help.xsl (configure_targets.html): Correct typo.
	(new_task.html): Remove.

	* src/html/omp.xsl (apply_overrides): New template.
	(html-task-table): Get apply_overrides directly from get_tasks response.
	Replace new_task.html with command version, including overrides flag.
	Pass overrides flag to pages that return to get_tasks.
	(html-report-details): Pass overrides to get_report.  Remove overrides
	checkbox.
	(html-edit-task-form): Pass override flag on to get_tasks.
	(task): Pass overrides flag through to report and report list and to pages
	that return to get_tasks.
	(gsad_newtask): Remove.
	(new_task): New template.  Renamed from gsad_newtask.  Pass override flag
	to create_task.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2010-06-21 16:55:20 UTC (rev 8101)
+++ trunk/gsa/ChangeLog	2010-06-21 17:23:29 UTC (rev 8102)
@@ -1,3 +1,47 @@
+2010-06-21  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	Remove report "Apply overrides" checkbox.  Make the actions on the task
+	list preserve the override state.
+
+	* src/gsad.c (init_validator): Add command new_task.
+	(exec_omp_post): Call new_task_omp instead of gsad_newtask, passing
+	"apply override" flag.  Pass "apply override" flag to create_task_omp.
+	(exec_omp_get): Pass "apply override" flag to task functions that lead to
+	getting the task list.  Pass "show overrides" flag to functions that lead
+	to getting a single task.
+	(request_handler): Remove new_task.html special case.
+
+	* src/gsad_omp.c (gsad_newtask): Remove.
+	(new_task_omp): New function.  Rename from gsad_newtask.  Add
+	apply_overrides arg.
+	(create_task_omp, delete_task_omp, edit_task, edit_task_omp)
+	(save_task_omp, abort_task_omp, pause_task_omp, resume_paused_task_omp)
+	(resume_stopped_task_omp, start_task_omp): Add apply_overrides flag.
+	(delete_note_omp, save_note_omp, delete_override_omp)
+	(save_override_omp): Pass overrides arg to get_tasks as apply_overrides.
+
+	* src/gsad_omp.h: Update headers accordingly.
+
+	* src/html/gsad.xsl (autorefresh): Add overrides to URL.
+	(html-gsa-navigation): Add overrides flags to get_tasks URL.  Replace
+	new_task.html with new_task command.
+
+	* src/html/help.xsl (configure_targets.html): Correct typo.
+	(new_task.html): Remove.
+
+	* src/html/omp.xsl (apply_overrides): New template.
+	(html-task-table): Get apply_overrides directly from get_tasks response.
+	Replace new_task.html with command version, including overrides flag.
+	Pass overrides flag to pages that return to get_tasks.
+	(html-report-details): Pass overrides to get_report.  Remove overrides
+	checkbox.
+	(html-edit-task-form): Pass override flag on to get_tasks.
+	(task): Pass overrides flag through to report and report list and to pages
+	that return to get_tasks.
+	(gsad_newtask): Remove.
+	(new_task): New template.  Renamed from gsad_newtask.  Pass override flag
+	to create_task.
+
 2010-06-19  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	* src/html/help.xsl (configure_targets.html): Added

Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c	2010-06-21 16:55:20 UTC (rev 8101)
+++ trunk/gsa/src/gsad.c	2010-06-21 17:23:29 UTC (rev 8102)
@@ -241,6 +241,7 @@
                          "|(modify_auth)"
                          "|(new_note)"
                          "|(new_override)"
+                         "|(new_task)"
                          "|(pause_task)"
                          "|(resume_paused_task)"
                          "|(resume_stopped_task)"
@@ -1686,13 +1687,20 @@
           free (con_info->req_parms.schedule_id);
           con_info->req_parms.schedule_id  = NULL;
         }
+      validate (validator, "overrides", &con_info->req_parms.overrides);
       if ((con_info->req_parms.name == NULL) ||
           (con_info->req_parms.comment == NULL) ||
           (con_info->req_parms.config_id == NULL) ||
+          (con_info->req_parms.overrides == NULL) ||
           (con_info->req_parms.target_id == NULL) ||
           (con_info->req_parms.escalator_id == NULL) ||
           (con_info->req_parms.schedule_id == NULL))
-        con_info->response = gsad_newtask (credentials, "Invalid parameter");
+        con_info->response
+         = new_task_omp (credentials,
+                         "Invalid parameter",
+                         con_info->req_parms.overrides
+                          ? strcmp (con_info->req_parms.overrides, "0")
+                          : 0);
       else
         con_info->response =
           create_task_omp (credentials, con_info->req_parms.name,
@@ -1700,7 +1708,8 @@
                            con_info->req_parms.target_id,
                            con_info->req_parms.config_id,
                            con_info->req_parms.escalator_id,
-                           con_info->req_parms.schedule_id);
+                           con_info->req_parms.schedule_id,
+                           con_info->req_parms.overrides);
     }
   else if (!strcmp (con_info->req_parms.cmd, "create_user"))
     {
@@ -2610,28 +2619,39 @@
 
   /* Check cmd and precondition, start respective OMP command(s). */
   if ((!strcmp (cmd, "delete_task")) && (task_id != NULL)
-      && (strlen (task_id) < VAL_MAX_SIZE))
-    return delete_task_omp (credentials, task_id);
+      && (strlen (task_id) < VAL_MAX_SIZE)
+      && (overrides != NULL))
+    return delete_task_omp (credentials, task_id, overrides);
 
   else if ((!strcmp (cmd, "abort_task")) && (task_id != NULL)
-           && (strlen (task_id) < VAL_MAX_SIZE))
-    return abort_task_omp (credentials, task_id);
+           && (strlen (task_id) < VAL_MAX_SIZE)
+           && (overrides != NULL))
+    return abort_task_omp (credentials, task_id, overrides);
 
+  else if ((!strcmp (cmd, "new_task"))
+           && (overrides != NULL))
+    return new_task_omp (credentials, NULL,
+                         overrides ? strcmp (overrides, "0") : 0);
+
   else if ((!strcmp (cmd, "pause_task")) && (task_id != NULL)
-           && (strlen (task_id) < VAL_MAX_SIZE))
-    return pause_task_omp (credentials, task_id);
+           && (strlen (task_id) < VAL_MAX_SIZE)
+           && (overrides != NULL))
+    return pause_task_omp (credentials, task_id, overrides);
 
   else if ((!strcmp (cmd, "resume_paused_task")) && (task_id != NULL)
-           && (strlen (task_id) < VAL_MAX_SIZE))
-    return resume_paused_task_omp (credentials, task_id);
+           && (strlen (task_id) < VAL_MAX_SIZE)
+           && (overrides != NULL))
+    return resume_paused_task_omp (credentials, task_id, overrides);
 
   else if ((!strcmp (cmd, "resume_stopped_task")) && (task_id != NULL)
-           && (strlen (task_id) < VAL_MAX_SIZE))
-    return resume_stopped_task_omp (credentials, task_id);
+           && (strlen (task_id) < VAL_MAX_SIZE)
+           && (overrides != NULL))
+    return resume_stopped_task_omp (credentials, task_id, overrides);
 
   else if ((!strcmp (cmd, "start_task")) && (task_id != NULL)
-           && (strlen (task_id) < VAL_MAX_SIZE))
-    return start_task_omp (credentials, task_id);
+           && (strlen (task_id) < VAL_MAX_SIZE)
+           && (overrides != NULL))
+    return start_task_omp (credentials, task_id, overrides);
 
   else if ((!strcmp (cmd, "get_tasks")) && (task_id != NULL)
            && (strlen (task_id) < VAL_MAX_SIZE))
@@ -2699,12 +2719,13 @@
   else if ((!strcmp (cmd, "delete_note"))
            && (note_id != NULL)
            && (next != NULL)
+           && (overrides != NULL)
            && (strcmp (next, "get_tasks") == 0)
            && (task_id != NULL))
     {
       return delete_note_omp (credentials, note_id, "get_tasks", NULL, 0, 0,
-                              NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                              NULL, task_id);
+                              NULL, NULL, NULL, NULL, overrides, NULL, NULL,
+                              NULL, NULL, task_id);
     }
 
   else if ((!strcmp (cmd, "delete_override"))
@@ -2938,9 +2959,11 @@
   else if ((!strcmp (cmd, "edit_task"))
            && (task_id != NULL)
            && (next != NULL)
+           && (overrides != NULL)
            && (strcmp (next, "get_tasks") == 0))
     return edit_task_omp (credentials, task_id, "get_tasks", refresh_interval,
-                          sort_field, sort_order);
+                          sort_field, sort_order,
+                          overrides ? strcmp (overrides, "0") : 0);
 
   else if ((!strcmp (cmd, "edit_user")) && (name != NULL))
     return edit_user_oap (credentials, name);
@@ -3246,12 +3269,13 @@
   else if ((!strcmp (cmd, "save_note"))
            && (note_id != NULL)
            && (next != NULL)
+           && (overrides != NULL)
            && (strcmp (next, "get_tasks") == 0)
            && (task_id != NULL))
     {
       return save_note_omp (credentials, note_id, text, hosts, port, threat,
                             note_task_id, note_result_id, "get_tasks", NULL,
-                            0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                            0, 0, NULL, NULL, NULL, NULL, overrides, NULL, NULL,
                             NULL, NULL, task_id);
     }
 
@@ -3348,14 +3372,15 @@
   else if ((!strcmp (cmd, "save_override"))
            && (override_id != NULL)
            && (next != NULL)
+           && (overrides != NULL)
            && (strcmp (next, "get_tasks") == 0)
            && (task_id != NULL))
     {
       return save_override_omp (credentials, override_id, text, hosts, port,
                                 threat, new_threat, override_task_id,
                                 override_result_id, "get_tasks", NULL, 0, 0,
-                                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                NULL, task_id);
+                                NULL, NULL, NULL, NULL, overrides, NULL, NULL,
+                                NULL, NULL, task_id);
     }
 
   else if ((!strcmp (cmd, "save_task"))
@@ -3364,7 +3389,8 @@
            && (strcmp (next, "get_tasks") == 0))
     return save_task_omp (credentials, task_id, name, comment, escalator_id,
                           schedule_id, "get_tasks", refresh_interval,
-                          sort_field, sort_order);
+                          sort_field, sort_order,
+                          overrides ? strcmp (overrides, "0") : 0);
 
   else
     return gsad_message ("Internal error", __FUNCTION__, __LINE__,
@@ -4007,14 +4033,6 @@
           free (res);
         }
       /* URL does not request OMP command but perhaps a special GSAD command? */
-      else if (!strncmp (&url[0], "/new_task.html",
-                    strlen ("/new_task.html"))) /* flawfinder: ignore,
-                                                   it is a const str */
-        {
-          res = gsad_newtask (credentials, NULL);
-          response = MHD_create_response_from_data (strlen (res), res,
-                                                    MHD_NO, MHD_YES);
-        }
       else if (!strncmp (&url[0], "/system_report/",
                     strlen ("/system_report/"))) /* flawfinder: ignore,
                                                     it is a const str */

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2010-06-21 16:55:20 UTC (rev 8101)
+++ trunk/gsa/src/gsad_omp.c	2010-06-21 17:23:29 UTC (rev 8102)
@@ -276,11 +276,13 @@
  *
  * @param[in]  credentials  Credentials of user issuing the action.
  * @param[in]  message      If not NULL, display message.
+ * @param[in]  apply_overrides  Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
-gsad_newtask (credentials_t * credentials, const char* message)
+new_task_omp (credentials_t * credentials, const char* message,
+              int apply_overrides)
 {
   GString *xml;
   gnutls_session_t session;
@@ -293,7 +295,7 @@
                          "Diagnostics: Failure to connect to manager daemon.",
                          "/omp?cmd=get_tasks");
 
-  xml = g_string_new ("<gsad_newtask>");
+  xml = g_string_new ("<new_task>");
 
   /* Get list of targets. */
   if (openvas_server_send (&session,
@@ -406,8 +408,11 @@
   if (message)
     g_string_append (xml, GSAD_MESSAGE_INVALID_PARAM ("Create Task"));
   g_string_append_printf (xml,
-                          "<user>%s</user></gsad_newtask>",
-                          credentials->username);
+                          "<user>%s</user>"
+                          "<apply_overrides>%i</apply_overrides>"
+                          "</new_task>",
+                          credentials->username,
+                          apply_overrides);
 
   openvas_server_close (socket, session);
   return xsl_transform_omp (credentials, g_string_free (xml, FALSE));
@@ -423,13 +428,14 @@
  * @param[in]  scanconfig    Config for task.
  * @param[in]  escalator_id  Escalator for task.
  * @param[in]  schedule_id   UUID of schedule for task.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
 create_task_omp (credentials_t * credentials, char *name, char *comment,
                  char *target_id, char *config_id, const char *escalator_id,
-                 const char *schedule_id)
+                 const char *schedule_id, const char *apply_overrides)
 {
   entity_t entity;
   gnutls_session_t session;
@@ -468,14 +474,16 @@
                               "</create_task>"
                               "<get_tasks"
                               " sort_field=\"name\""
-                              " sort_order=\"ascending\"/>"
+                              " sort_order=\"ascending\""
+                              " apply_overrides=\"%s\"/>"
                               "</commands>",
                               config_id,
                               schedule_element,
                               escalator_element,
                               target_id,
                               name,
-                              comment);
+                              comment,
+                              apply_overrides);
 
   g_free (schedule_element);
   g_free (escalator_element);
@@ -511,11 +519,13 @@
  *
  * @param[in]  credentials  Username and password for authentication.
  * @param[in]  task_id      ID of task.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
-delete_task_omp (credentials_t * credentials, const char *task_id)
+delete_task_omp (credentials_t * credentials, const char *task_id,
+                 const char *apply_overrides)
 {
   entity_t entity;
   char *text = NULL;
@@ -534,9 +544,11 @@
                             "<delete_task task_id=\"%s\" />"
                             "<get_tasks"
                             " sort_field=\"name\""
-                            " sort_order=\"ascending\"/>"
+                            " sort_order=\"ascending\""
+                            " apply_overrides=\"%s\"/>"
                             "</commands>",
-                            task_id)
+                            task_id,
+                            apply_overrides)
       == -1)
     {
       openvas_server_close (socket, session);
@@ -573,6 +585,7 @@
  * @param[in]  refresh_interval  Refresh interval (parsed to int).
  * @param[in]  sort_field        Field to sort on, or NULL.
  * @param[in]  sort_order        "ascending", "descending", or NULL.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
@@ -581,7 +594,7 @@
            const char *extra_xml, const char *next,
            /* Parameters for get_tasks. */
            const char *refresh_interval, const char *sort_field,
-           const char *sort_order)
+           const char *sort_order, int apply_overrides)
 {
   GString *xml;
   gnutls_session_t session;
@@ -642,13 +655,15 @@
                           /* Passthroughs. */
                           "<refresh_interval>%s</refresh_interval>"
                           "<sort_field>%s</sort_field>"
-                          "<sort_order>%s</sort_order>",
+                          "<sort_order>%s</sort_order>"
+                          "<apply_overrides>%i</apply_overrides>",
                           task_id,
                           credentials->username,
                           next,
                           refresh_interval ? refresh_interval : "",
                           sort_field,
-                          sort_order);
+                          sort_order,
+                          apply_overrides);
 
   if (read_string (&session, &xml))
     {
@@ -676,6 +691,7 @@
  * @param[in]  refresh_interval  Refresh interval (parsed to int).
  * @param[in]  sort_field        Field to sort on, or NULL.
  * @param[in]  sort_order        "ascending", "descending", or NULL.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
@@ -684,10 +700,10 @@
                const char *next,
                /* Parameters for get_tasks. */
                const char *refresh_interval, const char *sort_field,
-               const char *sort_order)
+               const char *sort_order, int apply_overrides)
 {
   return edit_task (credentials, task_id, NULL, next, refresh_interval,
-                    sort_field, sort_order);
+                    sort_field, sort_order, apply_overrides);
 }
 
 /**
@@ -703,6 +719,7 @@
  * @param[in]  refresh_interval  Refresh interval (parsed to int).
  * @param[in]  sort_field        Field to sort on, or NULL.
  * @param[in]  sort_order        "ascending", "descending", or NULL.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
@@ -712,14 +729,15 @@
                const char *schedule_id, const char *next,
                /* Parameters for get_tasks. */
                const char *refresh_interval, const char *sort_field,
-               const char *sort_order)
+               const char *sort_order, int apply_overrides)
 {
   gchar *modify_task;
 
   if (comment == NULL || name == NULL)
     return edit_task (credentials, task_id,
                       GSAD_MESSAGE_INVALID_PARAM ("Save Task"), next,
-                      refresh_interval, sort_field, sort_order);
+                      refresh_interval, sort_field, sort_order,
+                      apply_overrides);
 
   if (escalator_id == NULL || schedule_id == NULL || next == NULL
       || sort_field == NULL || sort_order == NULL || task_id == NULL)
@@ -744,7 +762,7 @@
   if (strcmp (next, "get_tasks") == 0)
     {
       char *ret = get_tasks (credentials, NULL, sort_field, sort_order,
-                             refresh_interval, modify_task, 1);
+                             refresh_interval, modify_task, apply_overrides);
       g_free (modify_task);
       return ret;
     }
@@ -762,11 +780,13 @@
  *
  * @param[in]  credentials  Username and password for authentication.
  * @param[in]  task_id      ID of task.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
-abort_task_omp (credentials_t * credentials, const char *task_id)
+abort_task_omp (credentials_t * credentials, const char *task_id,
+                const char *apply_overrides)
 {
   entity_t entity;
   char *text = NULL;
@@ -785,9 +805,11 @@
                             "<abort_task task_id=\"%s\" />"
                             "<get_tasks"
                             " sort_field=\"name\""
-                            " sort_order=\"ascending\"/>"
+                            " sort_order=\"ascending\""
+                            " apply_overrides=\"%s\"/>"
                             "</commands>",
-                            task_id)
+                            task_id,
+                            apply_overrides)
       == -1)
     {
       openvas_server_close (socket, session);
@@ -819,11 +841,13 @@
  *
  * @param[in]  credentials  Username and password for authentication.
  * @param[in]  task_id      ID of task.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
-pause_task_omp (credentials_t * credentials, const char *task_id)
+pause_task_omp (credentials_t * credentials, const char *task_id,
+                const char *apply_overrides)
 {
   entity_t entity;
   char *text = NULL;
@@ -842,9 +866,11 @@
                             "<pause_task task_id=\"%s\" />"
                             "<get_tasks"
                             " sort_field=\"name\""
-                            " sort_order=\"ascending\"/>"
+                            " sort_order=\"ascending\""
+                            " apply_overrides=\"%s\"/>"
                             "</commands>",
-                            task_id)
+                            task_id,
+                            apply_overrides)
       == -1)
     {
       openvas_server_close (socket, session);
@@ -876,11 +902,13 @@
  *
  * @param[in]  credentials  Username and password for authentication.
  * @param[in]  task_id      ID of task.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
-resume_paused_task_omp (credentials_t * credentials, const char *task_id)
+resume_paused_task_omp (credentials_t * credentials, const char *task_id,
+                        const char *apply_overrides)
 {
   entity_t entity;
   char *text = NULL;
@@ -899,9 +927,11 @@
                             "<resume_paused_task task_id=\"%s\" />"
                             "<get_tasks"
                             " sort_field=\"name\""
-                            " sort_order=\"ascending\"/>"
+                            " sort_order=\"ascending\""
+                            " apply_overrides=\"%s\"/>"
                             "</commands>",
-                            task_id)
+                            task_id,
+                            apply_overrides)
       == -1)
     {
       openvas_server_close (socket, session);
@@ -933,11 +963,13 @@
  *
  * @param[in]  credentials  Username and password for authentication.
  * @param[in]  task_id      ID of task.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
-resume_stopped_task_omp (credentials_t * credentials, const char *task_id)
+resume_stopped_task_omp (credentials_t * credentials, const char *task_id,
+                         const char *apply_overrides)
 {
   entity_t entity;
   char *text = NULL;
@@ -956,9 +988,11 @@
                             "<resume_stopped_task task_id=\"%s\" />"
                             "<get_tasks"
                             " sort_field=\"name\""
-                            " sort_order=\"ascending\"/>"
+                            " sort_order=\"ascending\""
+                            " apply_overrides=\"%s\"/>"
                             "</commands>",
-                            task_id)
+                            task_id,
+                            apply_overrides)
       == -1)
     {
       openvas_server_close (socket, session);
@@ -990,11 +1024,13 @@
  *
  * @param[in]  credentials  Username and password for authentication.
  * @param[in]  task_id      ID of task.
+ * @param[in]  apply_overrides   Whether to apply overrides.
  *
  * @return Result of XSL transformation.
  */
 char *
-start_task_omp (credentials_t * credentials, const char *task_id)
+start_task_omp (credentials_t * credentials, const char *task_id,
+                const char *apply_overrides)
 {
   entity_t entity;
   char *text = NULL;
@@ -1013,9 +1049,11 @@
                             "<start_task task_id=\"%s\" />"
                             "<get_tasks"
                             " sort_field=\"name\""
-                            " sort_order=\"ascending\"/>"
+                            " sort_order=\"ascending\""
+                            " apply_overrides=\"%s\"/>"
                             "</commands>",
-                            task_id)
+                            task_id,
+                            apply_overrides)
       == -1)
     {
       openvas_server_close (socket, session);
@@ -5055,7 +5093,7 @@
  * @param[in]  sort_order     "ascending", "descending", or NULL.
  * @param[in]  levels         Threat levels to include in report.
  * @param[in]  notes          Whether to include notes.
- * @param[in]  overrides      Whether to include overrides.
+ * @param[in]  overrides      Whether to apply/include overrides.
  * @param[in]  result_hosts_only  Whether to show only hosts with results.
  * @param[in]  search_phrase  Phrase which included results must contain.
  * @param[in]  min_cvss_base  Minimum CVSS included results may have.
@@ -5117,7 +5155,8 @@
   if (strcmp (next, "get_tasks") == 0)
     {
       gchar *extra = g_strdup_printf ("<delete_note note_id=\"%s\"/>", note_id);
-      char *ret = get_tasks (credentials, task_id, NULL, NULL, NULL, extra, 1);
+      char *ret = get_tasks (credentials, task_id, NULL, NULL, NULL, extra,
+                             overrides ? strcmp (overrides, "0") : 0);
       g_free (extra);
       return ret;
     }
@@ -5367,7 +5406,7 @@
  * @param[in]  sort_order      "ascending", "descending", or NULL.
  * @param[in]  levels          Threat levels to include in report.
  * @param[in]  notes           Whether to include notes.
- * @param[in]  overrides       Whether to include overrides.
+ * @param[in]  overrides       Whether to apply/include overrides.
  * @param[in]  result_hosts_only  Whether to show only hosts with results.
  * @param[in]  search_phrase   Phrase which included results must contain.
  * @param[in]  min_cvss_base   Minimum CVSS included results may have.
@@ -5455,7 +5494,8 @@
   if (strcmp (next, "get_tasks") == 0)
     {
       char *ret = get_tasks (credentials, task_id, NULL, NULL, NULL,
-                             modify_note, 1);
+                             modify_note,
+                             overrides ? strcmp (overrides, "0") : 0);
       g_free (modify_note);
       return ret;
     }
@@ -6115,7 +6155,7 @@
  * @param[in]  sort_order     "ascending", "descending", or NULL.
  * @param[in]  levels         Threat levels to include in report.
  * @param[in]  notes          Whether to include notes.
- * @param[in]  overrides      Whether to include overrides.
+ * @param[in]  overrides      Whether to apply/include overrides.
  * @param[in]  result_hosts_only  Whether to show only hosts with results.
  * @param[in]  search_phrase  Phrase which included results must contain.
  * @param[in]  min_cvss_base  Minimum CVSS included results may have.
@@ -6180,7 +6220,8 @@
     {
       gchar *extra = g_strdup_printf ("<delete_override override_id=\"%s\"/>",
                                       override_id);
-      char *ret = get_tasks (credentials, task_id, NULL, NULL, NULL, extra, 1);
+      char *ret = get_tasks (credentials, task_id, NULL, NULL, NULL, extra,
+                             overrides ? strcmp (overrides, "0") : 0);
       g_free (extra);
       return ret;
     }
@@ -6432,7 +6473,7 @@
  * @param[in]  sort_order      "ascending", "descending", or NULL.
  * @param[in]  levels          Threat levels to include in report.
  * @param[in]  notes           Whether to include notes.
- * @param[in]  overrides       Whether to include overrides.
+ * @param[in]  overrides       Whether to apply/include overrides.
  * @param[in]  result_hosts_only  Whether to show only hosts with results.
  * @param[in]  search_phrase   Phrase which included results must contain.
  * @param[in]  min_cvss_base   Minimum CVSS included results may have.
@@ -6525,7 +6566,8 @@
   if (strcmp (next, "get_tasks") == 0)
     {
       char *ret = get_tasks (credentials, task_id, NULL, NULL, NULL,
-                             modify_override, 1);
+                             modify_override,
+                             overrides ? strcmp (overrides, "0") : 0);
       g_free (modify_override);
       return ret;
     }

Modified: trunk/gsa/src/gsad_omp.h
===================================================================
--- trunk/gsa/src/gsad_omp.h	2010-06-21 16:55:20 UTC (rev 8101)
+++ trunk/gsa/src/gsad_omp.h	2010-06-21 17:23:29 UTC (rev 8102)
@@ -39,21 +39,20 @@
 
 void omp_init (const gchar *, int);
 
-char * gsad_newtask (credentials_t *, const char *);
-
 char * create_task_omp (credentials_t *, char *, char *, char *, char *,
-                        const char *, const char *);
-char * delete_task_omp (credentials_t *, const char *);
+                        const char *, const char *, const char *);
+char * delete_task_omp (credentials_t *, const char *, const char *);
 char * edit_task_omp (credentials_t *, const char *, const char *, const char *,
-                      const char *, const char *);
+                      const char *, const char *, int);
+char * new_task_omp (credentials_t *, const char *, int);
 char * save_task_omp (credentials_t *, const char *, const char *, const char *,
                       const char *, const char *, const char *, const char *,
-                      const char *, const char *);
-char * abort_task_omp (credentials_t *, const char *);
-char * pause_task_omp (credentials_t *, const char *);
-char * resume_paused_task_omp (credentials_t *, const char *);
-char * resume_stopped_task_omp (credentials_t *, const char *);
-char * start_task_omp (credentials_t *, const char *);
+                      const char *, const char *, int);
+char * abort_task_omp (credentials_t *, const char *, const char *);
+char * pause_task_omp (credentials_t *, const char *, const char *);
+char * resume_paused_task_omp (credentials_t *, const char *, const char *);
+char * resume_stopped_task_omp (credentials_t *, const char *, const char *);
+char * start_task_omp (credentials_t *, const char *, const char *);
 
 char * get_tasks_omp (credentials_t *, const char *, const char *,
                       const char *, const char*, int);

Modified: trunk/gsa/src/html/gsad.xsl
===================================================================
--- trunk/gsa/src/html/gsad.xsl	2010-06-21 16:55:20 UTC (rev 8101)
+++ trunk/gsa/src/html/gsad.xsl	2010-06-21 17:23:29 UTC (rev 8102)
@@ -60,7 +60,7 @@
 <!-- Add meta refresh info if autorefresh element present -->
 <xsl:template match="autorefresh" mode="html-header-meta">
   <xsl:if test="@interval &gt; 0">
-    <meta http-equiv="refresh" content="{@interval};/omp?cmd=get_tasks&amp;refresh_interval={@interval}" />
+    <meta http-equiv="refresh" content="{@interval};/omp?cmd=get_tasks&amp;refresh_interval={@interval}&amp;overrides={../get_tasks/apply_overrides}" />
   </xsl:if>
 </xsl:template>
 
@@ -111,8 +111,8 @@
           <li>
             Scan Management
             <ul>
-              <li><a href="/omp?cmd=get_tasks">Tasks</a></li>
-              <li><a href="/new_task.html">New Task</a></li>
+              <li><a href="/omp?cmd=get_tasks&amp;overrides=1">Tasks</a></li>
+              <li><a href="/omp?cmd=new_task&amp;overrides=1">New Task</a></li>
               <li><a href="/omp?cmd=get_notes">Notes</a></li>
               <li><a href="/omp?cmd=get_overrides">Overrides</a></li>
               <li><a href="/omp?cmd=get_system_reports&amp;duration=86400">Performance</a></li>

Modified: trunk/gsa/src/html/help.xsl
===================================================================
--- trunk/gsa/src/html/help.xsl	2010-06-21 16:55:20 UTC (rev 8101)
+++ trunk/gsa/src/html/help.xsl	2010-06-21 17:23:29 UTC (rev 8102)
@@ -982,7 +982,7 @@
           <td>Password</td>
           <td>yes</td>
           <td>40</td>
-          <td>Password corresponind to the above username.</td>
+          <td>Password corresponding to the above username.</td>
           <td></td>
         </tr>
       </table>
@@ -1919,89 +1919,6 @@
   </div>
 </xsl:template>
 
-<xsl:template mode="help" match="new_task.html">
-  <div class="gb_window_part_center">Help: New task</div>
-  <div class="gb_window_part_content">
-    <div style="float:left;"><a href="/help/contents.html">Help Contents</a></div>
-    <div class="float_right"><a href="/new_task.html">Jump to dialog</a></div>
-    <div style="text-align:left">
-
-      <br/>
-      <h1>New task</h1>
-      <a name="newtask"></a>
-      <p>
-       To create a new <a href="/help/glossary.html#task">task</a>
-       you have to provide the following elements:
-      </p>
-
-      <table class="gbntable">
-        <tr class="gbntablehead2">
-          <td></td>
-          <td>Mandatory</td>
-          <td>Max Length</td>
-          <td>Syntax</td>
-          <td>Example</td>
-        </tr>
-        <tr class="odd">
-          <td>Task Name</td>
-          <td>yes</td>
-          <td>80</td>
-          <td>Alphanumeric</td>
-          <td>All Windows desktops in-depth</td>
-        </tr>
-        <tr class="even">
-          <td>Comment</td>
-          <td>no</td>
-          <td>400</td>
-          <td>Alphanumeric</td>
-          <td>This task scans all Windows desktops on this floor.</td>
-        </tr>
-        <tr class="odd">
-          <td>Scan Type</td>
-          <td>yes</td>
-          <td>---</td>
-          <td>One of the
-              <a href="/help/configure_scanconfigs.html">configured scan configs</a>.
-          </td>
-          <td>Full and fast</td>
-        </tr>
-        <tr class="even">
-          <td>Scan Targets</td>
-          <td>yes</td>
-          <td>---</td>
-          <td>One of the
-              <a href="/help/configure_targets.html">configured targets</a>.</td>
-          <td>The Windows Desktops</td>
-        </tr>
-        <tr class="odd">
-          <td>Escalator (optional)</td>
-          <td>no</td>
-          <td>---</td>
-          <td>One of the
-              <a href="/help/configure_escalators.html">configured escalators</a>.
-          </td>
-          <td>EmailFinished</td>
-        </tr>
-        <tr class="even">
-          <td>Schedule (optional)</td>
-          <td>no</td>
-          <td>---</td>
-          <td>One of the
-              <a href="/help/configure_schedules.html">configured schedules</a>.
-          </td>
-          <td>Every Tuesday Morning</td>
-        </tr>
-      </table>
-
-      <p>
-       Pressing button "Create Task" will add a new entry to the list
-       of tasks and return to the <a href="/help/tasks.html">Tasks</a>
-       overview.
-      </p>
-    </div>
-  </div>
-</xsl:template>
-
 <xsl:template mode="help" match="notes.html">
   <div class="gb_window_part_center">Help: Notes</div>
   <div class="gb_window_part_content">

Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl	2010-06-21 16:55:20 UTC (rev 8101)
+++ trunk/gsa/src/html/omp.xsl	2010-06-21 17:23:29 UTC (rev 8102)
@@ -82,8 +82,11 @@
 <xsl:template match="sort">
 </xsl:template>
 
+<xsl:template match="apply_overrides">
+</xsl:template>
+
 <xsl:template name="html-task-table">
-  <xsl:variable name="apply-overrides" select="../../apply_overrides"/>
+  <xsl:variable name="apply-overrides" select="apply_overrides"/>
   <div class="gb_window">
     <div class="gb_window_part_left"></div>
     <div class="gb_window_part_right"></div>
@@ -91,7 +94,8 @@
       <a href="/help/tasks.html" title="Help: Tasks">
         <img src="/img/help.png" border="0"/>
       </a>
-      <a href="/new_task.html" title="New Task">
+      <a href="/omp?cmd=new_task&amp;overrides={$apply-overrides}"
+         title="New Task">
         <img src="/img/new.png" border="0" style="margin-left:3px;"/>
       </a>
       <div id="small_inline_form" style="display: inline">
@@ -100,6 +104,7 @@
                  src="/img/refresh.png"
                  alt="Refresh" style="margin-left:3px;margin-right:3px;"/>
           <input type="hidden" name="cmd" value="get_tasks"/>
+          <input type="hidden" name="overrides" value="{$apply-overrides}"/>
           <select style="margin-bottom: 0px;" name="refresh_interval" size="1">
             <xsl:choose>
               <xsl:when test="/envelope/autorefresh/@interval='0'">
@@ -484,6 +489,9 @@
             <input type="hidden" name="report_id" value="{report/@id}"/>
             <input type="hidden" name="sort_field" value="{$sort_field}"/>
             <input type="hidden" name="sort_order" value="{$sort_order}"/>
+            <input type="hidden"
+                   name="overrides"
+                   value="{report/filters/apply_overrides}"/>
             <tr>
               <td colspan="3">
                 <xsl:choose>
@@ -500,19 +508,6 @@
             <tr>
               <td colspan="3">
                 <xsl:choose>
-                  <xsl:when test="report/filters/apply_overrides = 0">
-                    <input type="checkbox" name="overrides" value="1"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <input type="checkbox" name="overrides" value="1" checked="1"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-                Apply overrides
-              </td>
-            </tr>
-            <tr>
-              <td colspan="3">
-                <xsl:choose>
                   <xsl:when test="report/filters/result_hosts_only = 0">
                     <input type="checkbox" name="result_hosts_only" value="1"/>
                   </xsl:when>
@@ -1364,6 +1359,7 @@
         <input type="hidden" name="next" value="{next}"/>
         <input type="hidden" name="sort_field" value="{sort_field}"/>
         <input type="hidden" name="sort_order" value="{sort_order}"/>
+        <input type="hidden" name="overrides" value="{apply_overrides}"/>
         <table border="0" cellspacing="0" cellpadding="3" width="100%">
           <tr>
            <td valign="top" width="165">Name</td>
@@ -1546,7 +1542,7 @@
         <td style="text-align:right;font-size:10px;">
           <xsl:choose>
             <xsl:when test="report_count &gt; 0">
-              <a href="/omp?cmd=get_tasks&amp;task_id={@id}">
+              <a href="/omp?cmd=get_tasks&amp;task_id={@id}&amp;overrides={../apply_overrides}">
                 <xsl:value-of select="report_count/finished"/>
               </a>
             </xsl:when>
@@ -1559,14 +1555,14 @@
             <xsl:when test="last_report/report/@id = first_report/report/@id">
             </xsl:when>
             <xsl:otherwise>
-              <a href="/omp?cmd=get_report&amp;report_id={first_report/report/@id}&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1">
+              <a href="/omp?cmd=get_report&amp;report_id={first_report/report/@id}&amp;notes=1&amp;overrides={../apply_overrides}&amp;result_hosts_only=1">
                 <xsl:call-template name="short_timestamp_first"/>
               </a>
             </xsl:otherwise>
           </xsl:choose>
         </td>
         <td style="font-size:10px;">
-          <a href="/omp?cmd=get_report&amp;report_id={last_report/report/@id}&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1">
+          <a href="/omp?cmd=get_report&amp;report_id={last_report/report/@id}&amp;notes=1&amp;overrides={../apply_overrides}&amp;result_hosts_only=1">
             <xsl:call-template name="short_timestamp_last"/>
           </a>
         </td>
@@ -1590,7 +1586,7 @@
               </a>
             </xsl:when>
             <xsl:when test="status='Running' or status='Requested'">
-              <a href="/omp?cmd=pause_task&amp;task_id={@id}"
+              <a href="/omp?cmd=pause_task&amp;task_id={@id}&amp;overrides={../apply_overrides}"
                  title="Pause Task">
                 <img src="/img/pause.png" border="0" alt="Pause"/>
               </a>
@@ -1599,7 +1595,7 @@
               <img src="/img/start_inactive.png" border="0" alt="Start"/>
             </xsl:when>
             <xsl:otherwise>
-              <a href="/omp?cmd=start_task&amp;task_id={@id}"
+              <a href="/omp?cmd=start_task&amp;task_id={@id}&amp;overrides={../apply_overrides}"
                  title="Start Task">
                 <img src="/img/start.png" border="0" alt="Start"/>
               </a>
@@ -1611,7 +1607,7 @@
                    style="margin-left:3px;"/>
             </xsl:when>
             <xsl:when test="status='Stopped'">
-              <a href="/omp?cmd=resume_stopped_task&amp;task_id={@id}"
+              <a href="/omp?cmd=resume_stopped_task&amp;task_id={@id}&amp;overrides={../apply_overrides}"
                  title="Resume Task">
                 <img src="/img/resume.png"
                      border="0"
@@ -1620,7 +1616,7 @@
               </a>
             </xsl:when>
             <xsl:when test="status='Paused'">
-              <a href="/omp?cmd=resume_paused_task&amp;task_id={@id}"
+              <a href="/omp?cmd=resume_paused_task&amp;task_id={@id}&amp;overrides={../apply_overrides}"
                  title="Resume Task">
                 <img src="/img/resume.png"
                      border="0"
@@ -1645,7 +1641,8 @@
                    style="margin-left:3px;"/>
             </xsl:when>
             <xsl:otherwise>
-              <a href="/omp?cmd=abort_task&amp;task_id={@id}" title="Abort Task">
+              <a href="/omp?cmd=abort_task&amp;task_id={@id}&amp;overrides={../apply_overrides}"
+                 title="Abort Task">
                 <img src="/img/stop.png"
                      border="0"
                      alt="Abort"
@@ -1661,7 +1658,7 @@
                    style="margin-left:3px;"/>
             </xsl:when>
             <xsl:otherwise>
-              <a href="/omp?cmd=delete_task&amp;task_id={@id}"
+              <a href="/omp?cmd=delete_task&amp;task_id={@id}&amp;overrides={../apply_overrides}"
                  title="Delete Task"
                  style="margin-left:3px;">
                 <img src="/img/delete.png"
@@ -1676,7 +1673,7 @@
                  alt="Details"
                  style="margin-left:3px;"/>
           </a>
-          <a href="/omp?cmd=edit_task&amp;task_id={@id}&amp;next=get_tasks&amp;refresh_interval={/envelope/autorefresh/@interval}&amp;sort_order={../sort/field/order}&amp;sort_field={../sort/field/text()}"
+          <a href="/omp?cmd=edit_task&amp;task_id={@id}&amp;next=get_tasks&amp;refresh_interval={/envelope/autorefresh/@interval}&amp;sort_order={../sort/field/order}&amp;sort_field={../sort/field/text()}&amp;overrides={../apply_overrides}"
              title="Edit Task"
              style="margin-left:3px;">
             <img src="/img/edit.png" border="0" alt="Edit"/>
@@ -7245,9 +7242,9 @@
   </xsl:call-template>
 </xsl:template>
 
-<!-- GSAD_NEWTASK -->
+<!-- NEW_TASK -->
 
-<xsl:template match="gsad_newtask">
+<xsl:template match="new_task">
   <xsl:apply-templates select="gsad_msg"/>
 
   <div class="gb_window_part_left"></div>
@@ -7260,6 +7257,7 @@
   <div class="gb_window_part_content">
     <form action="/omp" method="post" enctype="multipart/form-data">
       <input type="hidden" name="cmd" value="create_task"/>
+      <input type="hidden" name="overrides" value="{apply_overrides}"/>
       <table border="0" cellspacing="0" cellpadding="3" width="100%">
         <tr>
          <td valign="top" width="125">Name</td>



More information about the Openvas-commits mailing list