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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 25 18:54:14 CEST 2009


Author: mattm
Date: 2009-05-25 18:54:13 +0200 (Mon, 25 May 2009)
New Revision: 3469

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/omp.c
   trunk/openvas-manager/src/tasks_sql.h
   trunk/openvas-manager/src/tests/common.c
   trunk/openvas-manager/src/tests/common.h
   trunk/openvas-manager/src/tests/omp_abort_task_0.c
   trunk/openvas-manager/src/tests/omp_delete_report_0.c
   trunk/openvas-manager/src/tests/omp_delete_report_1.c
   trunk/openvas-manager/src/tests/omp_delete_task_0.c
   trunk/openvas-manager/src/tests/omp_delete_task_1.c
   trunk/openvas-manager/src/tests/omp_delete_task_2.c
   trunk/openvas-manager/src/tests/omp_get_dependencies_1.c
   trunk/openvas-manager/src/tests/omp_get_nvt_feed_all_1.c
   trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_1.c
   trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_1.c
   trunk/openvas-manager/src/tests/omp_get_preferences_1.c
   trunk/openvas-manager/src/tests/omp_get_report_0.c
   trunk/openvas-manager/src/tests/omp_get_rules_1.c
   trunk/openvas-manager/src/tests/omp_modify_report_0.c
   trunk/openvas-manager/src/tests/omp_modify_task_0.c
   trunk/openvas-manager/src/tests/omp_modify_task_1.c
   trunk/openvas-manager/src/tests/omp_start_task_0.c
   trunk/openvas-manager/src/tests/omp_start_task_1.c
   trunk/openvas-manager/src/tests/omp_start_task_2.c
   trunk/openvas-manager/src/tests/omp_status_0.c
   trunk/openvas-manager/src/tests/omp_status_1.c
   trunk/openvas-manager/src/tests/omp_status_2.c
   trunk/openvas-manager/src/tests/omp_status_3.c
   trunk/openvas-manager/src/tests/omp_status_4.c
Log:
	* src/omp.c (omp_xml_handle_start_element): Add enclosing tags that were
	missing from certain responses.  Initialise current_uuid in STATUS.

	* src/tasks_sql.h (make_task): Quote uuid in SQL.
	(find_task): Quote uuid in SQL.  Invert return.

	* src/tests/common.c (next_entities, first_entity): New functions.
	(create_task, create_task_from_rc_file, wait_for_task_start)
	(wait_for_task_end, delete_task): Change task ID param to a string.
	(id_string): Remove.
	* src/tests/common.h: Update headers.

	* src/tests/omp_get_report_0.c, src/tests/omp_delete_report_0.c,
	src/tests/omp_start_task_2.c, src/tests/omp_get_preferences_1.c,
	src/tests/omp_modify_task_1.c, src/tests/omp_abort_task_0.c,
	src/tests/omp_delete_task_0.c, src/tests/omp_get_rules_1.c,
	src/tests/omp_start_task_1.c, src/tests/omp_delete_task_1.c,
	src/tests/omp_get_nvt_feed_details_1.c, src/tests/omp_status_2.c,
	src/tests/omp_delete_task_2.c, src/tests/omp_get_dependencies_1.c,
	src/tests/omp_get_nvt_feed_checksum_1.c, src/tests/omp_status_4.c,
	src/tests/omp_start_task_0.c, src/tests/omp_modify_task_0.c,
	src/tests/omp_status_1.c, src/tests/omp_status_0.c,
	src/tests/omp_status_3.c, src/tests/omp_delete_report_1.c,
	src/tests/omp_modify_report_0.c,
	src/tests/omp_get_nvt_feed_all_1.c: Switch to string task IDs.  Match
	response statuses to manager.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/ChangeLog	2009-05-25 16:54:13 UTC (rev 3469)
@@ -1,5 +1,34 @@
-2009-05-23  Matthew Mundell <mmundell at intevation.de>
+2009-05-25  Matthew Mundell <mmundell at intevation.de>
 
+	* src/omp.c (omp_xml_handle_start_element): Add enclosing tags that were
+	missing from certain responses.  Initialise current_uuid in STATUS.
+
+	* src/tasks_sql.h (make_task): Quote uuid in SQL.
+	(find_task): Quote uuid in SQL.  Invert return.
+
+	* src/tests/common.c (next_entities, first_entity): New functions.
+	(create_task, create_task_from_rc_file, wait_for_task_start)
+	(wait_for_task_end, delete_task): Change task ID param to a string.
+	(id_string): Remove.
+	* src/tests/common.h: Update headers.
+
+	* src/tests/omp_get_report_0.c, src/tests/omp_delete_report_0.c,
+	src/tests/omp_start_task_2.c, src/tests/omp_get_preferences_1.c,
+	src/tests/omp_modify_task_1.c, src/tests/omp_abort_task_0.c,
+	src/tests/omp_delete_task_0.c, src/tests/omp_get_rules_1.c,
+	src/tests/omp_start_task_1.c, src/tests/omp_delete_task_1.c,
+	src/tests/omp_get_nvt_feed_details_1.c, src/tests/omp_status_2.c,
+	src/tests/omp_delete_task_2.c, src/tests/omp_get_dependencies_1.c,
+	src/tests/omp_get_nvt_feed_checksum_1.c, src/tests/omp_status_4.c,
+	src/tests/omp_start_task_0.c, src/tests/omp_modify_task_0.c,
+	src/tests/omp_status_1.c, src/tests/omp_status_0.c,
+	src/tests/omp_status_3.c, src/tests/omp_delete_report_1.c,
+	src/tests/omp_modify_report_0.c,
+	src/tests/omp_get_nvt_feed_all_1.c: Switch to string task IDs.  Match
+	response statuses to manager.
+
+2009-05-25  Matthew Mundell <mmundell at intevation.de>
+
 	* src/openvasmd.c (main): Fork into background on start, or stay in
 	foreground if -f switch given.
 

Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/omp.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -392,7 +392,10 @@
             set_client_state (CLIENT_START_TASK);
           }
         else if (strncasecmp ("STATUS", element_name, 6) == 0)
-          set_client_state (CLIENT_STATUS);
+          {
+            append_text (&current_uuid, "", 0);
+            set_client_state (CLIENT_STATUS);
+          }
         else
           {
             if (send_to_client ("<omp_response>"
@@ -1075,7 +1078,9 @@
             free_string_var (&current_uuid);
           }
         else
-          SEND_TO_CLIENT_OR_FAIL ("<status>" STATUS_INTERNAL_ERROR "</status>");
+          SEND_TO_CLIENT_OR_FAIL ("<abort_task_response>"
+                                  "<status>" STATUS_INTERNAL_ERROR "</status>"
+                                  "</abort_task_response>");
         set_client_state (CLIENT_AUTHENTIC);
         break;
       case CLIENT_ABORT_TASK_TASK_ID:
@@ -1268,6 +1273,7 @@
         SEND_TO_CLIENT_OR_FAIL ("<delete_report_response>");
         if (current_uuid)
           {
+            // FIX check syntax of current_uuid  STATUS_ERROR_SYNTAX
             int ret = delete_report (current_uuid);
             free_string_var (&current_uuid);
             switch (ret)
@@ -1435,7 +1441,9 @@
             free_string_var (&current_uuid);
           }
         else
-          SEND_TO_CLIENT_OR_FAIL ("<status>" STATUS_INTERNAL_ERROR "</status>");
+          SEND_TO_CLIENT_OR_FAIL ("<delete_task_response>"
+                                  "<status>" STATUS_INTERNAL_ERROR "</status>"
+                                  "</delete_task_response>");
         set_client_state (CLIENT_AUTHENTIC);
         break;
       case CLIENT_DELETE_TASK_TASK_ID:
@@ -1557,7 +1565,9 @@
             free_string_var (&current_uuid);
           }
         else
-          SEND_TO_CLIENT_OR_FAIL ("<status>" STATUS_INTERNAL_ERROR "</status>");
+          SEND_TO_CLIENT_OR_FAIL ("<modify_task_response>"
+                                  "<status>" STATUS_INTERNAL_ERROR "</status>"
+                                  "</modify_task_response>");
         set_client_state (CLIENT_AUTHENTIC);
         break;
       case CLIENT_MODIFY_TASK_PARAMETER:
@@ -1656,7 +1666,9 @@
             free_string_var (&current_uuid);
           }
         else
-          SEND_TO_CLIENT_OR_FAIL ("<status>" STATUS_INTERNAL_ERROR "</status>");
+          SEND_TO_CLIENT_OR_FAIL ("<start_task_response>"
+                                  "<status>" STATUS_INTERNAL_ERROR "</status>"
+                                  "<start_task_response>");
         set_client_state (CLIENT_AUTHENTIC);
         break;
       case CLIENT_START_TASK_TASK_ID:

Modified: trunk/openvas-manager/src/tasks_sql.h
===================================================================
--- trunk/openvas-manager/src/tasks_sql.h	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tasks_sql.h	2009-05-25 16:54:13 UTC (rev 3469)
@@ -914,8 +914,8 @@
   char* uuid = make_task_uuid ();
   if (uuid == NULL) return (task_t) NULL;
   // TODO: Escape name and comment.
-  sql ("INSERT into tasks_%s (uuid, name, time, comment) VALUES (%s, %s, %u, %s);",
-       uuid, current_credentials.username, name, time, comment);
+  sql ("INSERT into tasks_%s (uuid, name, time, comment) VALUES ('%s', %s, %u, %s);",
+       current_credentials.username, uuid, name, time, comment);
   free (uuid);
   free (name);
   free (comment);
@@ -1174,14 +1174,14 @@
  * @param[in]   uuid  A task identifier.
  * @param[out]  task  Task return.
  *
- * @return TRUE on success, FALSE on error.
+ * @return FALSE on success, TRUE on error.
  */
 gboolean
 find_task (const char* uuid, task_t* task)
 {
   *task = sql_int64 (0, 0,
-                     "SELECT ROWID FROM tasks_%s WHERE uuid = %s;",
+                     "SELECT ROWID FROM tasks_%s WHERE uuid = '%s';",
                      current_credentials.username,
                      uuid);
-  return TRUE;
+  return FALSE;
 }

Modified: trunk/openvas-manager/src/tests/common.c
===================================================================
--- trunk/openvas-manager/src/tests/common.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/common.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -259,7 +259,7 @@
 }
 
 /**
- * @brief Connect to the manager.
+ * @brief Close the connection to the manager.
  *
  * @param[in]  socket   Socket connected to manager (from \ref connect_to_manager).
  * @param[in]  session  GNUTLS session with manager.
@@ -372,6 +372,18 @@
   return entity;
 }
 
+entities_t
+next_entities (entities_t entities)
+{
+  return (entities_t) entities->next;
+}
+
+entity_t
+first_entity (entities_t entities)
+{
+  return (entity_t) entities->data;
+}
+
 /**
  * @brief Add an XML entity to a tree of entities.
  *
@@ -916,7 +928,8 @@
  * @param[in]   config_len  Length of config.
  * @param[in]   identifier  Task identifier.
  * @param[in]   comment     Task comment.
- * @param[out]  id          ID of new task.
+ * @param[out]  id          Pointer for newly allocated ID of new task.  Only
+ *                          set on successful return.
  *
  * @return 0 on success, -1 on error.
  */
@@ -926,7 +939,7 @@
              unsigned int config_len,
              char* identifier,
              char* comment,
-             unsigned int* id)
+             char** id)
 {
   /* Convert the file contents to base64. */
 
@@ -965,11 +978,8 @@
       free_entity (entity);
       return -1;
     }
-  ret = sscanf (entity_text (id_entity), "%u", id);
-  free_entity (entity);
-  if (ret == 1)
-    return 0;
-  return -1;
+  *id = g_strdup (entity_text (id_entity));
+  return 0;
 }
 
 /**
@@ -988,7 +998,7 @@
                           char* file_name,
                           char* identifier,
                           char* comment,
-                          unsigned int* id)
+                          char** id)
 {
   gchar* new_task_rc = NULL;
   gsize new_task_rc_len;
@@ -1026,10 +1036,10 @@
  */
 int
 start_task (gnutls_session_t* session,
-            unsigned int id)
+            char* id)
 {
   if (sendf_to_manager (session,
-                        "<start_task><task_id>%u</task_id></start_task>",
+                        "<start_task><task_id>%s</task_id></start_task>",
                         id)
       == -1)
     return -1;
@@ -1060,28 +1070,6 @@
 }
 
 /**
- * @brief Return a string version of an ID.
- *
- * @param[in]   id      ID.
- * @param[out]  string  Pointer to a string.  On successful return contains a
- *                      pointer to a static buffer with the task ID as a string.
- *                      The static buffer is overwritten across successive
- *                      calls.
- *
- * @return 0 success, -1 error.
- */
-int
-id_string (int id, const char ** string)
-{
-  static char buffer[11]; /* (expt 2 32) => 4294967296 */
-  int length = sprintf (buffer, "%u", id);
-  assert (length < 11);
-  if (length < 1) return -1;
-  *string = buffer;
-  return 0;
-}
-
-/**
  * @brief Wait for a task to start running on the server.
  *
  * @param[in]  session  Pointer to GNUTLS session.
@@ -1091,7 +1079,7 @@
  */
 int
 wait_for_task_start (gnutls_session_t* session,
-                     unsigned int id)
+                     char* id)
 {
   while (1)
     {
@@ -1122,12 +1110,6 @@
           /* Check the running status of the given task. */
 
           char* run_state = NULL;
-          const char* string_id;
-          if (id_string (id, &string_id))
-            {
-              free_entity (entity);
-              return -1;
-            }
 
 #if 0
           /* Lisp version. */
@@ -1137,7 +1119,7 @@
                 (fi* task-id
                   (free-entity entity)
                   (return-from wait-for-task-start -1))
-                (when (string= (entity-text task-id) string-id)
+                (when (string= (entity-text task-id) id)
                   (let ((status (entity-child child "status")))
                     (fi* status
                       (free-entity entity)
@@ -1155,7 +1137,7 @@
                                free_entity (entity);
                                return -1;
                              }
-                           if (strcasecmp (entity_text (task_id), string_id)
+                           if (strcasecmp (entity_text (task_id), id)
                                == 0)
                              {
                                entity_t status = entity_child (child, "status");
@@ -1198,7 +1180,7 @@
  */
 int
 wait_for_task_end (gnutls_session_t* session,
-                   unsigned int id)
+                   char* id)
 {
   tracef ("wait_for_task_end\n");
   while (1)
@@ -1230,12 +1212,6 @@
           /* Check the running status of the given task. */
 
           char* run_state = NULL;
-          const char* string_id;
-          if (id_string (id, &string_id))
-            {
-              free_entity (entity);
-              return -1;
-            }
 
 #if 0
           /* Lisp version. */
@@ -1245,7 +1221,7 @@
                 (fi* task-id
                   (free-entity entity)
                   (return-from wait-for-task-start -1))
-                (when (string= (entity-text task-id) string-id)
+                (when (string= (entity-text task-id) id)
                   (let ((status (entity-child child "status")))
                     (fi* status
                       (free-entity entity)
@@ -1263,7 +1239,7 @@
                                free_entity (entity);
                                return -1;
                              }
-                           if (strcasecmp (entity_text (task_id), string_id)
+                           if (strcasecmp (entity_text (task_id), id)
                                == 0)
                              {
                                entity_t status = entity_child (child, "status");
@@ -1304,10 +1280,10 @@
  * @return 0 on success, -1 on error.
  */
 int
-delete_task (gnutls_session_t* session, unsigned int id)
+delete_task (gnutls_session_t* session, char* id)
 {
   if (sendf_to_manager (session,
-                        "<delete_task><task_id>%u</task_id></delete_task>",
+                        "<delete_task><task_id>%s</task_id></delete_task>",
                         id)
       == -1)
     return -1;

Modified: trunk/openvas-manager/src/tests/common.h
===================================================================
--- trunk/openvas-manager/src/tests/common.h	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/common.h	2009-05-25 16:54:13 UTC (rev 3469)
@@ -56,14 +56,20 @@
   entities_t entities;
 } * entity_t;
 
+entities_t
+next_entities (entities_t);
+
 entity_t
+first_entity (entities_t);
+
+entity_t
 add_entity (entities_t*, const char*, const char*);
 
 int
 compare_entities (entity_t, entity_t);
 
 entity_t
-entity_child (entity_t entity, char* name);
+entity_child (entity_t, char*);
 
 char*
 entity_name (entity_t entity);
@@ -97,21 +103,19 @@
 env_authenticate (gnutls_session_t* session);
 
 int
-create_task (gnutls_session_t*, char*, unsigned int, char*, char*,
-             unsigned int*);
+create_task (gnutls_session_t*, char*, unsigned int, char*, char*, char**);
 
 int
-create_task_from_rc_file (gnutls_session_t*, char*, char*, char*,
-                          unsigned int*);
+create_task_from_rc_file (gnutls_session_t*, char*, char*, char*, char**);
 
 int
-delete_task (gnutls_session_t*, unsigned int);
+delete_task (gnutls_session_t*, char*);
 
 int
-start_task (gnutls_session_t* , unsigned int);
+start_task (gnutls_session_t* , char*);
 
 int
-wait_for_task_end (gnutls_session_t*, unsigned int);
+wait_for_task_end (gnutls_session_t*, char*);
 
 int
-wait_for_task_start (gnutls_session_t*, unsigned int);
+wait_for_task_start (gnutls_session_t*, char*);

Modified: trunk/openvas-manager/src/tests/omp_abort_task_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_abort_task_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_abort_task_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -66,6 +66,7 @@
   if (start_task (&session, id))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -75,6 +76,7 @@
   if (wait_for_task_start (&session, id))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -85,17 +87,19 @@
   if (env_authenticate (&session))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
 #endif
 
   if (sendf_to_manager (&session,
-                        "<abort_task><task_id>%i</task_id></abort_task>",
+                        "<abort_task><task_id>%s</task_id></abort_task>",
                         id)
       == -1)
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -108,13 +112,14 @@
   /* Compare. */
 
   entity_t expected = add_entity (NULL, "abort_task_response", NULL);
-  add_entity (&expected->entities, "status", "201");
+  add_entity (&expected->entities, "status", "202");
 
   if (compare_entities (entity, expected))
     {
       free_entity (expected);
       free_entity (entity);
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -122,6 +127,7 @@
   free_entity (expected);
   free_entity (entity);
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_delete_report_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_delete_report_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_delete_report_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -66,13 +66,13 @@
 
   if (sendf_to_manager (&session,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
     goto delete_fail;
 
-  /* FIX Read the first report ID from the response. */
+  /* Read the first report ID from the response. */
 
   entity_t entity = NULL;
   if (read_entity (&session, &entity))
@@ -84,13 +84,13 @@
   if (report == NULL)
     {
       fprintf (stderr, "Failed to find report.\n");
-      goto delete_fail;
+      goto free_fail;
     }
   entity_t report_id = entity_child (report, "id");
   if (report_id == NULL)
     {
       fprintf (stderr, "Failed to find report id.\n");
-      goto delete_fail;
+      goto free_fail;
     }
 
   /* Get the report. */
@@ -153,7 +153,7 @@
   /* Compare to expected response. */
 
   expected = add_entity (NULL, "get_report_response", NULL);
-  add_entity (&expected->entities, "status", "40x"); // FIX
+  add_entity (&expected->entities, "status", "404");
 
   if (compare_entities (entity, expected))
     {
@@ -164,6 +164,7 @@
  delete_fail:
       // FIX
       //delete_task (&session, id);
+      free (id);
  fail:
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
@@ -173,6 +174,7 @@
   free_entity (expected);
   // FIX
   //delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_delete_report_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_delete_report_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_delete_report_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -70,7 +70,7 @@
   /* Compare to expected response. */
 
   entity_t expected = add_entity (NULL, "delete_report_response", NULL);
-  add_entity (&expected->entities, "status", "50x");
+  add_entity (&expected->entities, "status", "400");
 
   if (compare_entities (entity, expected))
     {

Modified: trunk/openvas-manager/src/tests/omp_delete_task_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_delete_task_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_delete_task_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -64,13 +64,14 @@
   /* Remove the task. */
 
   gchar* msg = g_strdup_printf ("<delete_task>"
-                                "<task_id>%u</task_id>"
+                                "<task_id>%s</task_id>"
                                 "</delete_task>",
                                 id);
   int ret = send_to_manager (&session, msg);
   g_free (msg);
   if (ret == -1)
     {
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -83,12 +84,13 @@
   /* Compare to expected response. */
 
   entity_t expected = add_entity (NULL, "delete_task_response", NULL);
-  add_entity (&expected->entities, "status", "201");
+  add_entity (&expected->entities, "status", "202");
 
   if (compare_entities (entity, expected))
     {
       free_entity (expected);
       free_entity (entity);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -100,14 +102,16 @@
 
   if (sendf_to_manager (&session,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
     {
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
+  free (id);
 
   entity = NULL;
   if (read_entity (&session, &entity))
@@ -117,7 +121,7 @@
     }
 
   expected = add_entity (NULL, "status_response", NULL);
-  add_entity (&expected->entities, "status", "407");
+  add_entity (&expected->entities, "status", "404");
 
   if (compare_entities (entity, expected))
     {

Modified: trunk/openvas-manager/src/tests/omp_delete_task_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_delete_task_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_delete_task_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -73,7 +73,7 @@
 
   if (sendf_to_manager (&session,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
@@ -104,7 +104,7 @@
 
   if (sendf_to_manager (&session,
                         "<delete_task>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</delete_task>",
                         id))
     goto delete_fail;
@@ -119,7 +119,7 @@
   /* Try get the report. */
 
   if (sendf_to_manager (&session,
-                        "<get_report><report_id>%u</report_id></get_report>",
+                        "<get_report><report_id>%s</report_id></get_report>",
                         report_id)
       == -1)
     goto delete_fail;
@@ -132,7 +132,7 @@
   /* Compare to expected response. */
 
   entity_t expected = add_entity (NULL, "get_report_response", NULL);
-  add_entity (&expected->entities, "status", "40x");
+  add_entity (&expected->entities, "status", "404");
 
   if (compare_entities (entity, expected))
     {
@@ -141,12 +141,14 @@
       free_entity (entity);
  delete_fail:
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
 
   free_entity (expected);
   free_entity (entity);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_delete_task_2.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_delete_task_2.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_delete_task_2.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
   entity_t entity, status;
 
   verbose = 1;
@@ -69,6 +69,7 @@
   if (start_task (&session, id))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -77,10 +78,11 @@
 
   if (sendf_to_manager (&session,
                         "<delete_task>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</delete_task>",
                         id))
     {
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -89,6 +91,7 @@
   if (read_entity (&session, &entity))
     {
       fprintf (stderr, "Failed to read response.\n");
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -97,11 +100,12 @@
 
   if (sendf_to_manager (&session,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
     {
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -112,6 +116,7 @@
   if (read_entity (&session, &entity))
     {
       fprintf (stderr, "Failed to read response.\n");
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -123,10 +128,11 @@
       || strcmp (entity_name (entity), "status_response"))
     {
       free_entity (entity);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
-  if (strcmp (entity_text (status), "407"))
+  if (strcmp (entity_text (status), "404"))
     {
       const char* status_text = task_status (entity);
 
@@ -134,18 +140,21 @@
       if (status_text && strcmp (status_text, "Delete requested"))
         {
           free_entity (entity);
+          free (id);
           close_manager_connection (socket, session);
           return EXIT_SUCCESS;
         }
       else
         {
           free_entity (entity);
+          free (id);
           close_manager_connection (socket, session);
           return EXIT_FAILURE;
         }
     }
 
   free_entity (entity);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_get_dependencies_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_dependencies_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_get_dependencies_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -67,6 +67,7 @@
   if (start_task (&session, id))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -76,25 +77,30 @@
   if (wait_for_task_start (&session, id))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
 
   /* Request the task status. */
 
+#if 0
   if (env_authenticate (&session))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
+#endif
 
   if (sendf_to_manager (&session,
-                        "<status><task_id>%u</task_id></status>",
+                        "<status><task_id>%s</task_id></status>",
                         id)
       == -1)
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -103,6 +109,7 @@
   if (read_entity (&session, &entity))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -114,6 +121,7 @@
   if (env_authenticate (&session))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -122,6 +130,7 @@
   if (send_to_manager (&session, "<get_dependencies/>") == -1)
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -142,6 +151,7 @@
       free_entity (entity);
       free_entity (expected);
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -150,6 +160,7 @@
 #endif
   free_entity (entity);
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_get_nvt_feed_all_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_all_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_all_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -67,6 +67,7 @@
   if (start_task (&session, id))
     {
       delete_task (&session, id);
+      free (id);
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
     }
@@ -77,6 +78,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -87,17 +89,19 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
 
   if (sendf_to_manager (&session,
-                        "<status><task_id>%u</task_id></status>",
+                        "<status><task_id>%s</task_id></status>",
                         id)
       == -1)
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -106,6 +110,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
   free_entity (entity);
@@ -117,6 +122,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
@@ -125,6 +131,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -145,6 +152,7 @@
       free_entity (expected);
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -153,5 +161,6 @@
   free_entity (entity);
   delete_task (&session, id);
   close_manager_connection (socket, session);
+  free (id);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -68,6 +68,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -77,6 +78,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -87,17 +89,19 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
 
   if (sendf_to_manager (&session,
-                        "<status><task_id>%u</task_id></status>",
+                        "<status><task_id>%s</task_id></status>",
                         id)
       == -1)
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -106,6 +110,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
   free_entity (entity);
@@ -117,6 +122,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
@@ -125,6 +131,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -145,6 +152,7 @@
       free_entity (expected);
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -153,5 +161,6 @@
   free_entity (entity);
   delete_task (&session, id);
   close_manager_connection (socket, session);
+  free (id);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -68,6 +68,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -77,6 +78,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -87,6 +89,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
@@ -98,6 +101,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -106,6 +110,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
   free_entity (entity);
@@ -117,6 +122,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
@@ -125,6 +131,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -145,6 +152,7 @@
       free_entity (expected);
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -153,5 +161,6 @@
   free_entity (entity);
   delete_task (&session, id);
   close_manager_connection (socket, session);
+  free (id);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_get_preferences_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_preferences_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_get_preferences_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -68,6 +68,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -77,18 +78,20 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
   /* Request the task status. */
 
   if (sendf_to_manager (&session,
-                        "<status><task_id>%u</task_id></status>",
+                        "<status><task_id>%s</task_id></status>",
                         id)
       == -1)
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -97,6 +100,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
   free_entity (entity);
@@ -107,6 +111,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -128,6 +133,7 @@
       free_entity (expected);
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -136,5 +142,6 @@
   free_entity (entity);
   delete_task (&session, id);
   close_manager_connection (socket, session);
+  free (id);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_get_report_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_report_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_get_report_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -66,7 +66,7 @@
 
   if (sendf_to_manager (&session,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
@@ -84,13 +84,13 @@
   if (report == NULL)
     {
       fprintf (stderr, "Failed to find report.\n");
-      goto delete_fail;
+      goto free_fail;
     }
   entity_t report_id = entity_child (report, "id");
   if (report_id == NULL)
     {
       fprintf (stderr, "Failed to find report id.\n");
-      goto delete_fail;
+      goto free_fail;
     }
 
   /* Get the report. */
@@ -120,11 +120,13 @@
 
   if (compare_entities (entity, expected))
     {
+      free_entity (expected);
+ free_fail:
       free_entity (entity);
-      free_entity (expected);
  delete_fail:
       // FIX
       //delete_task (&session, id);
+      free (id);
  fail:
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
@@ -134,6 +136,7 @@
   free_entity (expected);
   // FIX
   //delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_get_rules_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_rules_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_get_rules_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -77,6 +77,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -87,17 +88,19 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
 
   if (sendf_to_manager (&session,
-                        "<status><task_id>%u</task_id></status>",
+                        "<status><task_id>%s</task_id></status>",
                         id)
       == -1)
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -106,6 +109,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
   free_entity (entity);
@@ -117,6 +121,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
@@ -125,6 +130,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -146,6 +152,7 @@
       free_entity (expected);
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -154,5 +161,6 @@
   free_entity (entity);
   delete_task (&session, id);
   close_manager_connection (socket, session);
+  free (id);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_modify_report_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_modify_report_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_modify_report_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -66,7 +66,7 @@
 
   if (sendf_to_manager (&session,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
@@ -84,13 +84,13 @@
   if (report == NULL)
     {
       fprintf (stderr, "Failed to find report.\n");
-      goto delete_fail;
+      goto free_fail;
     }
   entity_t report_id = entity_child (report, "id");
   if (report_id == NULL)
     {
       fprintf (stderr, "Failed to find report id.\n");
-      goto delete_fail;
+      goto free_fail;
     }
 
 
@@ -120,10 +120,12 @@
   if (compare_entities (entity, expected))
     {
       free_entity (expected);
+ free_fail:
       free_entity (entity);
  delete_fail:
       // FIX
       //delete_task (&session, id);
+      free (id);
  fail:
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
@@ -133,6 +135,7 @@
   free_entity (expected);
   // FIX
   //delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_modify_task_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_modify_task_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_modify_task_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket, ret;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -71,13 +71,14 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
 
   if (sendf_to_manager (&session,
                         "<modify_task>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "<parameter>comment</parameter>"
                         "<value>Modified comment.</value>"
                         "</modify_task>",
@@ -86,6 +87,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -110,6 +112,7 @@
   close_manager_connection (socket, session);
   free_entity (entity);
   free_entity (expected);
+  free (id);
 
   return ret;
 }

Modified: trunk/openvas-manager/src/tests/omp_modify_task_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_modify_task_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_modify_task_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
   int socket1, socket2, ret;
   gnutls_session_t session1;
   gnutls_session_t session2;
-  unsigned int id;
+  char* id;
   entity_t entity, name;
 
   socket1 = connect_to_manager (&session1);
@@ -73,6 +73,7 @@
     {
       close_manager_connection (socket1, session1);
       close_manager_connection (socket2, session2);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -81,12 +82,13 @@
       delete_task (&session1, id);
       close_manager_connection (socket1, session1);
       close_manager_connection (socket2, session2);
+      free (id);
       return EXIT_FAILURE;
     }
 
   if (sendf_to_manager (&session2,
                         "<modify_task>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "<parameter>name</parameter>"
                         "<value>Modified name</value>"
                         "</modify_task>",
@@ -96,6 +98,7 @@
       delete_task (&session1, id);
       close_manager_connection (socket1, session1);
       close_manager_connection (socket2, session2);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -113,6 +116,7 @@
       close_manager_connection (socket1, session1);
       free_entity (entity);
       free_entity (expected);
+      free (id);
       return EXIT_FAILURE;
     }
   free_entity (entity);
@@ -122,13 +126,14 @@
 
   if (sendf_to_manager (&session1,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
     {
       delete_task (&session1, id);
       close_manager_connection (socket1, session1);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -138,6 +143,7 @@
       fprintf (stderr, "Failed to read response.\n");
       delete_task (&session1, id);
       close_manager_connection (socket1, session1);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -153,6 +159,7 @@
   close_manager_connection (socket1, session1);
   close_manager_connection (socket2, session2);
   free_entity (entity);
+  free (id);
 
   return ret;
 }

Modified: trunk/openvas-manager/src/tests/omp_start_task_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_start_task_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_start_task_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -57,17 +57,17 @@
   /* Start the task. */
 
 #if 0
-  if (env_authenticate (&session)) goto fail;
+  if (env_authenticate (&session)) goto delete_fail;
 #endif
 
   gchar* msg = g_strdup_printf ("<start_task>"
-                                "<task_id>%u</task_id>"
+                                "<task_id>%s</task_id>"
                                 "</start_task>",
                                 id);
   int ret = send_to_manager (&session, msg);
   g_free (msg);
   if (ret == -1)
-    goto fail;
+    goto delete_fail;
 
   /* Read the response. */
 
@@ -77,13 +77,15 @@
   /* Compare response to expected response. */
 
   entity_t expected = add_entity (NULL, "start_task_response", NULL);
-  add_entity (&expected->entities, "status", "201");
+  add_entity (&expected->entities, "status", "202");
 
   if (compare_entities (entity, expected))
     {
       free_entity (expected);
       free_entity (entity);
+ delete_fail:
       delete_task (&session, id);
+      free (id);
  fail:
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
@@ -92,6 +94,7 @@
   free_entity (expected);
   free_entity (entity);
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_start_task_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_start_task_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_start_task_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -71,11 +71,13 @@
   if (wait_for_task_end (&session, id)) goto delete_fail;
 
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 
  delete_fail:
   delete_task (&session, id);
+  free (id);
  fail:
   close_manager_connection (socket, session);
   return EXIT_FAILURE;

Modified: trunk/openvas-manager/src/tests/omp_start_task_2.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_start_task_2.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_start_task_2.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -82,11 +82,13 @@
   if (wait_for_task_end (&session, id)) goto delete_fail;
 
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 
  delete_fail:
   delete_task (&session, id);
+  free (id);
  fail:
   close_manager_connection (socket, session);
   return EXIT_FAILURE;

Modified: trunk/openvas-manager/src/tests/omp_status_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_status_0.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_status_0.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -94,6 +94,7 @@
       free_entity (expected);
  delete_fail:
       delete_task (&session, id);
+      free (id);
  fail:
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
@@ -102,6 +103,7 @@
   free_entity (entity);
   free_entity (expected);
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_status_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_status_1.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_status_1.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -68,6 +68,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -77,6 +78,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -87,17 +89,19 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
 
   if (sendf_to_manager (&session,
-                        "<status><task_id>%u</task_id></status>",
+                        "<status><task_id>%s</task_id></status>",
                         id)
       == -1)
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -118,6 +122,7 @@
       free_entity (expected);
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -125,5 +130,6 @@
   free_entity (expected);
   delete_task (&session, id);
   close_manager_connection (socket, session);
+  free (id);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_status_2.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_status_2.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_status_2.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -39,7 +39,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -68,6 +68,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -77,6 +78,7 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -87,17 +89,19 @@
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 #endif
 
   if (sendf_to_manager (&session,
-                        "<status><task_id>%u</task_id></status>",
+                        "<status><task_id>%s</task_id></status>",
                         id)
       == -1)
     {
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -119,6 +123,7 @@
       free_entity (expected);
       delete_task (&session, id);
       close_manager_connection (socket, session);
+      free (id);
       return EXIT_FAILURE;
     }
 
@@ -126,5 +131,6 @@
   free_entity (expected);
   delete_task (&session, id);
   close_manager_connection (socket, session);
+  free (id);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_status_3.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_status_3.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_status_3.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -101,6 +101,7 @@
       free_entity (expected);
  delete_fail:
       delete_task (&session, id);
+      free (id);
  fail:
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
@@ -109,6 +110,7 @@
   free_entity (entity);
   free_entity (expected);
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }

Modified: trunk/openvas-manager/src/tests/omp_status_4.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_status_4.c	2009-05-25 13:49:47 UTC (rev 3468)
+++ trunk/openvas-manager/src/tests/omp_status_4.c	2009-05-25 16:54:13 UTC (rev 3469)
@@ -38,7 +38,7 @@
 {
   int socket;
   gnutls_session_t session;
-  unsigned int id;
+  char* id;
 
   socket = connect_to_manager (&session);
   if (socket == -1) return EXIT_FAILURE;
@@ -69,7 +69,7 @@
 
   if (sendf_to_manager (&session,
                         "<status>"
-                        "<task_id>%u</task_id>"
+                        "<task_id>%s</task_id>"
                         "</status>",
                         id)
       == -1)
@@ -105,6 +105,7 @@
       free_entity (expected);
  delete_fail:
       delete_task (&session, id);
+      free (id);
  fail:
       close_manager_connection (socket, session);
       return EXIT_FAILURE;
@@ -113,6 +114,7 @@
   free_entity (entity);
   free_entity (expected);
   delete_task (&session, id);
+  free (id);
   close_manager_connection (socket, session);
   return EXIT_SUCCESS;
 }



More information about the Openvas-commits mailing list