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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 21 17:34:06 CEST 2011


Author: mattm
Date: 2011-09-21 17:34:04 +0200 (Wed, 21 Sep 2011)
New Revision: 11651

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/omp.c
Log:
	* src/omp.c (create_task_data_t, create_task_data_reset): Add observers.
	(client_state_t): Add CLIENT_CREATE_TASK_OBSERVERS.
	(omp_xml_handle_start_element, omp_xml_handle_end_element)
	(omp_xml_handle_text): Add OBSERVERS to CREATE_TASK.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-09-21 14:34:34 UTC (rev 11650)
+++ trunk/openvas-manager/ChangeLog	2011-09-21 15:34:04 UTC (rev 11651)
@@ -1,5 +1,12 @@
 2011-09-19  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/omp.c (create_task_data_t, create_task_data_reset): Add observers.
+	(client_state_t): Add CLIENT_CREATE_TASK_OBSERVERS.
+	(omp_xml_handle_start_element, omp_xml_handle_end_element)
+	(omp_xml_handle_text): Add OBSERVERS to CREATE_TASK.
+
+2011-09-19  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	Add task observers.
 
 	* src/omp.c (get_configs_data_t, get_configs_data_reset)

Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c	2011-09-21 14:34:34 UTC (rev 11650)
+++ trunk/openvas-manager/src/omp.c	2011-09-21 15:34:04 UTC (rev 11651)
@@ -1187,6 +1187,7 @@
 {
   char *config_id;      ///< ID of task config.
   char *escalator_id;   ///< ID of task escalator.
+  char *observers;      ///< Space separated names of observer users.
   name_value_t *preference;  ///< Current preference.
   array_t *preferences; ///< Preferences.
   char *schedule_id;    ///< ID of task schedule.
@@ -1205,6 +1206,7 @@
 {
   free (data->config_id);
   free (data->escalator_id);
+  free (data->observers);
   if (data->preferences)
     {
       guint index = data->preferences->len;
@@ -3204,6 +3206,7 @@
   CLIENT_CREATE_TASK_CONFIG,
   CLIENT_CREATE_TASK_ESCALATOR,
   CLIENT_CREATE_TASK_NAME,
+  CLIENT_CREATE_TASK_OBSERVERS,
   CLIENT_CREATE_TASK_PREFERENCES,
   CLIENT_CREATE_TASK_PREFERENCES_PREFERENCE,
   CLIENT_CREATE_TASK_PREFERENCES_PREFERENCE_NAME,
@@ -7314,6 +7317,8 @@
                               &create_task_data->escalator_id);
             set_client_state (CLIENT_CREATE_TASK_ESCALATOR);
           }
+        else if (strcasecmp ("OBSERVERS", element_name) == 0)
+          set_client_state (CLIENT_CREATE_TASK_OBSERVERS);
         else if (strcasecmp ("SCHEDULE", element_name) == 0)
           {
             append_attribute (attribute_names, attribute_values, "id",
@@ -14070,6 +14075,36 @@
               set_task_schedule (create_task_data->task, schedule);
             }
 
+          /* Set any observers. */
+
+          if (create_task_data->observers)
+            {
+              int fail;
+              fail = set_task_observers (create_task_data->task,
+                                         create_task_data->observers);
+              switch (fail)
+                {
+                  case 0:
+                    break;
+                  case 1:
+                  case 2:
+                    SEND_TO_CLIENT_OR_FAIL
+                      (XML_ERROR_SYNTAX ("create_task",
+                                         "User name error in observers"));
+                    break;
+                  case -1:
+                  default:
+                    SEND_TO_CLIENT_OR_FAIL
+                      (XML_INTERNAL_ERROR ("create_task"));
+                }
+              if (fail)
+                {
+                  create_task_data_reset (create_task_data);
+                  set_client_state (CLIENT_AUTHENTIC);
+                  break;
+                }
+            }
+
           /* Check for name. */
 
           name = task_name (create_task_data->task);
@@ -14280,6 +14315,10 @@
         assert (strcasecmp ("NAME", element_name) == 0);
         set_client_state (CLIENT_CREATE_TASK);
         break;
+      case CLIENT_CREATE_TASK_OBSERVERS:
+        assert (strcasecmp ("OBSERVERS", element_name) == 0);
+        set_client_state (CLIENT_CREATE_TASK);
+        break;
       case CLIENT_CREATE_TASK_PREFERENCES:
         assert (strcasecmp ("PREFERENCES", element_name) == 0);
         set_client_state (CLIENT_CREATE_TASK);
@@ -17972,6 +18011,9 @@
       case CLIENT_CREATE_TASK_NAME:
         append_to_task_name (create_task_data->task, text, text_len);
         break;
+      case CLIENT_CREATE_TASK_OBSERVERS:
+        openvas_append_text (&create_task_data->observers, text, text_len);
+        break;
       case CLIENT_CREATE_TASK_RCFILE:
         /* Append the text to the task description. */
         add_task_description_line (create_task_data->task,



More information about the Openvas-commits mailing list