[Openvas-commits] r3524 - in trunk/openvas-manager: . src src/tests
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu May 28 16:21:02 CEST 2009
Author: mattm
Date: 2009-05-28 16:21:01 +0200 (Thu, 28 May 2009)
New Revision: 3524
Added:
trunk/openvas-manager/src/tests/omp_create_task_0.c
Removed:
trunk/openvas-manager/src/tests/omp_new_task_0.c
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/omp.c
trunk/openvas-manager/src/tests/CMakeLists.txt
Log:
Rename OMP NEW_TASK to CREATE_TASK.
* src/omp.c (help_text, client_state_t, omp_xml_handle_start_element)
(omp_xml_handle_end_element, omp_xml_handle_text): Rename NEW_TASK to
CREATE_TASK.
* src/tests/CMakeLists.txt: Rename omp_new_task_0 to omp_create_task_0.
* src/tests/omp_new_task_0.c: Remove. Rename to omp_create_task_0.c.
* src/tests/omp_create_task_0.c: New file. Was omp_new_task_0.c. Adjust
for new name.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2009-05-28 13:57:13 UTC (rev 3523)
+++ trunk/openvas-manager/ChangeLog 2009-05-28 14:21:01 UTC (rev 3524)
@@ -1,5 +1,19 @@
2009-05-28 Matthew Mundell <mmundell at intevation.de>
+ Rename OMP NEW_TASK to CREATE_TASK.
+
+ * src/omp.c (help_text, client_state_t, omp_xml_handle_start_element)
+ (omp_xml_handle_end_element, omp_xml_handle_text): Rename NEW_TASK to
+ CREATE_TASK.
+
+ * src/tests/CMakeLists.txt: Rename omp_new_task_0 to omp_create_task_0.
+
+ * src/tests/omp_new_task_0.c: Remove. Rename to omp_create_task_0.c.
+ * src/tests/omp_create_task_0.c: New file. Was omp_new_task_0.c. Adjust
+ for new name.
+
+2009-05-28 Matthew Mundell <mmundell at intevation.de>
+
* src/omp.c (help_text): Remove dummy implementation key.
2009-05-28 Matthew Mundell <mmundell at intevation.de>
@@ -11,9 +25,9 @@
* src/tests/CMakeLists.txt: Rename omp_version_0 to omp_get_version_0.
- * src/tests/omp_version_0.c: Remove. Rename to omp_get_version.c.
- * src/tests/omp_get_version.c: New file. Was omp_version.c. Adjust for
- new name.
+ * src/tests/omp_version_0.c: Remove. Rename to omp_get_version_0.c.
+ * src/tests/omp_get_version_0.c: New file. Was omp_version_0.c. Adjust
+ for new name.
2009-05-28 Matthew Mundell <mmundell at intevation.de>
Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c 2009-05-28 13:57:13 UTC (rev 3523)
+++ trunk/openvas-manager/src/omp.c 2009-05-28 14:21:01 UTC (rev 3524)
@@ -78,7 +78,7 @@
" HELP Get this help text.\n"
" MODIFY_REPORT Modify an existing report.\n"
" MODIFY_TASK Update an existing task.\n"
-" NEW_TASK Create a new task.\n"
+" CREATE_TASK Create a new task.\n"
" GET_VERSION Get the OpenVAS Manager Protocol version.\n"
" START_TASK Manually start an existing task.\n"
" STATUS Get task status information.\n";
@@ -126,7 +126,7 @@
buffer_size_t to_client_end = 0;
/**
- * @brief Current client task during OMP commands like NEW_TASK and MODIFY_TASK.
+ * @brief Current client task during commands like CREATE_TASK and MODIFY_TASK.
*/
/*@null@*/ /*@dependent@*/
static task_t current_client_task = (task_t) NULL;
@@ -202,10 +202,10 @@
CLIENT_MODIFY_TASK_TASK_ID,
CLIENT_MODIFY_TASK_PARAMETER,
CLIENT_MODIFY_TASK_VALUE,
- CLIENT_NEW_TASK,
- CLIENT_NEW_TASK_COMMENT,
- CLIENT_NEW_TASK_IDENTIFIER,
- CLIENT_NEW_TASK_TASK_FILE,
+ CLIENT_CREATE_TASK,
+ CLIENT_CREATE_TASK_COMMENT,
+ CLIENT_CREATE_TASK_IDENTIFIER,
+ CLIENT_CREATE_TASK_TASK_FILE,
CLIENT_START_TASK,
CLIENT_START_TASK_TASK_ID,
CLIENT_STATUS,
@@ -378,12 +378,12 @@
append_text (¤t_uuid, "", 0);
set_client_state (CLIENT_MODIFY_TASK);
}
- else if (strncasecmp ("NEW_TASK", element_name, 8) == 0)
+ else if (strncasecmp ("CREATE_TASK", element_name, 11) == 0)
{
assert (current_client_task == (task_t) NULL);
current_client_task = make_task (NULL, 0, NULL);
if (current_client_task == (task_t) NULL) abort (); // FIX
- set_client_state (CLIENT_NEW_TASK);
+ set_client_state (CLIENT_CREATE_TASK);
}
else if (strncasecmp ("GET_VERSION", element_name, 11) == 0)
set_client_state (CLIENT_VERSION);
@@ -711,18 +711,18 @@
}
break;
- case CLIENT_NEW_TASK:
+ case CLIENT_CREATE_TASK:
if (strncasecmp ("TASK_FILE", element_name, 9) == 0)
- set_client_state (CLIENT_NEW_TASK_TASK_FILE);
+ set_client_state (CLIENT_CREATE_TASK_TASK_FILE);
else if (strncasecmp ("IDENTIFIER", element_name, 10) == 0)
- set_client_state (CLIENT_NEW_TASK_IDENTIFIER);
+ set_client_state (CLIENT_CREATE_TASK_IDENTIFIER);
else if (strncasecmp ("COMMENT", element_name, 7) == 0)
- set_client_state (CLIENT_NEW_TASK_COMMENT);
+ set_client_state (CLIENT_CREATE_TASK_COMMENT);
else
{
- if (send_to_client ("<new_task_response>"
+ if (send_to_client ("<create_task_response>"
"<status>" STATUS_ERROR_SYNTAX "</status>"
- "</new_task_response>"))
+ "</create_task_response>"))
{
error_send_to_client (error);
return;
@@ -1758,11 +1758,11 @@
set_client_state (CLIENT_MODIFY_TASK);
break;
- case CLIENT_NEW_TASK:
+ case CLIENT_CREATE_TASK:
{
char* tsk_uuid;
- assert (strncasecmp ("NEW_TASK", element_name, 7) == 0);
+ assert (strncasecmp ("CREATE_TASK", element_name, 11) == 0);
assert (current_client_task != (task_t) NULL);
// FIX if all rqrd fields given then ok, else respond fail
@@ -1770,16 +1770,16 @@
// eg on err half task could be saved (or saved with base64 file)
if (task_uuid (current_client_task, &tsk_uuid))
- SEND_TO_CLIENT_OR_FAIL ("<new_task_response>"
+ SEND_TO_CLIENT_OR_FAIL ("<create_task_response>"
"<status>" STATUS_ERROR_MISSING "</status>"
- "</new_task_response>");
+ "</create_task_response>");
else
{
gchar* msg;
- msg = g_strdup_printf ("<new_task_response>"
+ msg = g_strdup_printf ("<create_task_response>"
"<status>" STATUS_OK_CREATED "</status>"
"<task_id>%s</task_id>"
- "</new_task_response>",
+ "</create_task_response>",
tsk_uuid);
free (tsk_uuid);
if (send_to_client (msg))
@@ -1794,15 +1794,15 @@
set_client_state (CLIENT_AUTHENTIC);
break;
}
- case CLIENT_NEW_TASK_COMMENT:
+ case CLIENT_CREATE_TASK_COMMENT:
assert (strncasecmp ("COMMENT", element_name, 12) == 0);
- set_client_state (CLIENT_NEW_TASK);
+ set_client_state (CLIENT_CREATE_TASK);
break;
- case CLIENT_NEW_TASK_IDENTIFIER:
+ case CLIENT_CREATE_TASK_IDENTIFIER:
assert (strncasecmp ("IDENTIFIER", element_name, 10) == 0);
- set_client_state (CLIENT_NEW_TASK);
+ set_client_state (CLIENT_CREATE_TASK);
break;
- case CLIENT_NEW_TASK_TASK_FILE:
+ case CLIENT_CREATE_TASK_TASK_FILE:
assert (strncasecmp ("TASK_FILE", element_name, 9) == 0);
if (current_client_task)
{
@@ -1812,7 +1812,7 @@
out = g_base64_decode (description, &out_len);
free (description);
set_task_description (current_client_task, (char*) out, out_len);
- set_client_state (CLIENT_NEW_TASK);
+ set_client_state (CLIENT_CREATE_TASK);
}
break;
@@ -2042,13 +2042,13 @@
append_to_credentials_password (¤t_credentials, text, text_len);
break;
- case CLIENT_NEW_TASK_COMMENT:
+ case CLIENT_CREATE_TASK_COMMENT:
append_to_task_comment (current_client_task, text, text_len);
break;
- case CLIENT_NEW_TASK_IDENTIFIER:
+ case CLIENT_CREATE_TASK_IDENTIFIER:
append_to_task_identifier (current_client_task, text, text_len);
break;
- case CLIENT_NEW_TASK_TASK_FILE:
+ case CLIENT_CREATE_TASK_TASK_FILE:
/* Append the text to the task description. */
if (add_task_description_line (current_client_task,
text,
Modified: trunk/openvas-manager/src/tests/CMakeLists.txt
===================================================================
--- trunk/openvas-manager/src/tests/CMakeLists.txt 2009-05-28 13:57:13 UTC (rev 3523)
+++ trunk/openvas-manager/src/tests/CMakeLists.txt 2009-05-28 14:21:01 UTC (rev 3524)
@@ -307,12 +307,12 @@
target_link_libraries (omp_modify_task_1 common)
ADD_TEST (omp_modify_task_1 omp_modify_task_1)
-add_executable (omp_new_task_0 omp_new_task_0.c)
-target_link_libraries (omp_new_task_0 string)
-set_target_properties (omp_new_task_0 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
-set_target_properties (omp_new_task_0 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
-target_link_libraries (omp_new_task_0 common)
-ADD_TEST (omp_new_task_0 omp_new_task_0)
+add_executable (omp_create_task_0 omp_create_task_0.c)
+target_link_libraries (omp_create_task_0 string)
+set_target_properties (omp_create_task_0 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
+set_target_properties (omp_create_task_0 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
+target_link_libraries (omp_create_task_0 common)
+ADD_TEST (omp_create_task_0 omp_create_task_0)
add_executable (omp_start_task_0 omp_start_task_0.c)
target_link_libraries (omp_start_task_0 string)
Copied: trunk/openvas-manager/src/tests/omp_create_task_0.c (from rev 3335, trunk/openvas-manager/src/tests/omp_new_task_0.c)
===================================================================
--- trunk/openvas-manager/src/tests/omp_new_task_0.c 2009-05-12 12:41:43 UTC (rev 3335)
+++ trunk/openvas-manager/src/tests/omp_create_task_0.c 2009-05-28 14:21:01 UTC (rev 3524)
@@ -0,0 +1,99 @@
+/* Test 0 of OMP CREATE_TASK.
+ * $Id$
+ * Description: Test the OMP CREATE_TASK command.
+ *
+ * Authors:
+ * Matthew Mundell <matt at mundell.ukfsn.org>
+ *
+ * Copyright:
+ * Copyright (C) 2009 Greenbone Networks GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * or, at your option, any later version as published by the Free
+ * Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define TRACE 1
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "../tracef.h"
+
+int
+main ()
+{
+ int socket, ret;
+ gnutls_session_t session;
+
+ socket = connect_to_manager (&session);
+ if (socket == -1) return EXIT_FAILURE;
+
+ /* Send request. */
+
+ if (env_authenticate (&session))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ if (send_to_manager (&session, "<create_task>"
+ "<task_file>YmFzZTY0IHRleHQ=</task_file>"
+ "<identifier>omp_create_task_0 task</identifier>"
+ "<comment>Task for omp_create_task_0.</comment>"
+ "</create_task>")
+ == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Read the response. */
+
+ entity_t entity = NULL;
+ if (read_entity (&session, &entity))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ entity_t id_entity = entity_child (entity, "task_id");
+ if (id_entity == NULL)
+ {
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Compare. */
+
+ entity_t expected = add_entity (NULL, "create_task_response", NULL);
+ add_entity (&expected->entities, "status", "201");
+ add_entity (&expected->entities, "task_id", entity_text (id_entity));
+
+ if (compare_entities (entity, expected))
+ ret = EXIT_FAILURE;
+ else
+ ret = EXIT_SUCCESS;
+
+ /* Cleanup. */
+
+ close_manager_connection (socket, session);
+ free_entity (entity);
+ free_entity (expected);
+
+ return ret;
+}
Deleted: trunk/openvas-manager/src/tests/omp_new_task_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_new_task_0.c 2009-05-28 13:57:13 UTC (rev 3523)
+++ trunk/openvas-manager/src/tests/omp_new_task_0.c 2009-05-28 14:21:01 UTC (rev 3524)
@@ -1,99 +0,0 @@
-/* Test 0 of OMP NEW_TASK.
- * $Id$
- * Description: Test the OMP NEW_TASK command.
- *
- * Authors:
- * Matthew Mundell <matt at mundell.ukfsn.org>
- *
- * Copyright:
- * Copyright (C) 2009 Greenbone Networks GmbH
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * or, at your option, any later version as published by the Free
- * Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define TRACE 1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "../tracef.h"
-
-int
-main ()
-{
- int socket, ret;
- gnutls_session_t session;
-
- socket = connect_to_manager (&session);
- if (socket == -1) return EXIT_FAILURE;
-
- /* Send request. */
-
- if (env_authenticate (&session))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- if (send_to_manager (&session, "<new_task>"
- "<task_file>YmFzZTY0IHRleHQ=</task_file>"
- "<identifier>omp_new_task_0 task</identifier>"
- "<comment>Task for omp_new_task_0.</comment>"
- "</new_task>")
- == -1)
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Read the response. */
-
- entity_t entity = NULL;
- if (read_entity (&session, &entity))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- entity_t id_entity = entity_child (entity, "task_id");
- if (id_entity == NULL)
- {
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Compare. */
-
- entity_t expected = add_entity (NULL, "new_task_response", NULL);
- add_entity (&expected->entities, "status", "201");
- add_entity (&expected->entities, "task_id", entity_text (id_entity));
-
- if (compare_entities (entity, expected))
- ret = EXIT_FAILURE;
- else
- ret = EXIT_SUCCESS;
-
- /* Cleanup. */
-
- close_manager_connection (socket, session);
- free_entity (entity);
- free_entity (expected);
-
- return ret;
-}
More information about the Openvas-commits
mailing list