[Openvas-commits] r3527 - in trunk/openvas-manager: . src src/tests
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu May 28 18:51:48 CEST 2009
Author: mattm
Date: 2009-05-28 18:51:47 +0200 (Thu, 28 May 2009)
New Revision: 3527
Added:
trunk/openvas-manager/src/tests/omp_get_nvt_details_0.c
trunk/openvas-manager/src/tests/omp_get_nvt_details_1.c
trunk/openvas-manager/src/tests/omp_get_nvt_details_2.c
trunk/openvas-manager/src/tests/omp_get_nvt_details_3.c
trunk/openvas-manager/src/tests/omp_get_nvt_details_4.c
Removed:
trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_0.c
trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_1.c
trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_2.c
trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_3.c
trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_4.c
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/omp.c
trunk/openvas-manager/src/tests/CMakeLists.txt
Log:
Rename OMP GET_NVT_FEED_DETAILS to GET_NVT_DETAILS.
* src/omp.c (help_text, client_state_t, omp_xml_handle_start_element)
(omp_xml_handle_end_element, omp_xml_handle_text): Rename
GET_NVT_FEED_DETAILS to GET_NVT_DETAILS.
* src/tests/CMakeLists.txt: Rename tests to match new command name.
* src/tests/omp_get_nvt_feed_details_0.c: Remove. Rename to
omp_get_nvt_details_0.c.
* src/tests/omp_get_nvt_details_0.c: New file. Was
omp_get_nvt_feed_details_0.c. Adjust for new name.
* src/tests/omp_get_nvt_feed_details_1.c: Remove. Rename to
omp_get_nvt_details_0.c.
* src/tests/omp_get_nvt_details_1.c: New file. Was
omp_get_nvt_feed_details_0.c. Adjust for new name.
* src/tests/omp_get_nvt_feed_details_2.c: Remove. Rename to
omp_get_nvt_details_2.c.
* src/tests/omp_get_nvt_details_2.c: New file. Was
omp_get_nvt_feed_details_2.c. Adjust for new name.
* src/tests/omp_get_nvt_feed_details_3.c: Remove. Rename to
omp_get_nvt_details_3.c.
* src/tests/omp_get_nvt_details_3.c: New file. Was
omp_get_nvt_feed_details_3.c. Adjust for new name.
* src/tests/omp_get_nvt_feed_details_4.c: Remove. Rename to
omp_get_nvt_details_4.c.
* src/tests/omp_get_nvt_details_4.c: New file. Was
omp_get_nvt_feed_details_4.c. Adjust for new name.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2009-05-28 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/ChangeLog 2009-05-28 16:51:47 UTC (rev 3527)
@@ -1,20 +1,57 @@
2009-05-28 Matthew Mundell <mmundell at intevation.de>
+ Rename OMP GET_NVT_FEED_DETAILS to GET_NVT_DETAILS.
+
+ * src/omp.c (help_text, client_state_t, omp_xml_handle_start_element)
+ (omp_xml_handle_end_element, omp_xml_handle_text): Rename
+ GET_NVT_FEED_DETAILS to GET_NVT_DETAILS.
+
+ * src/tests/CMakeLists.txt: Rename tests to match new command name.
+
+ * src/tests/omp_get_nvt_feed_details_0.c: Remove. Rename to
+ omp_get_nvt_details_0.c.
+ * src/tests/omp_get_nvt_details_0.c: New file. Was
+ omp_get_nvt_feed_details_0.c. Adjust for new name.
+
+ * src/tests/omp_get_nvt_feed_details_1.c: Remove. Rename to
+ omp_get_nvt_details_0.c.
+ * src/tests/omp_get_nvt_details_1.c: New file. Was
+ omp_get_nvt_feed_details_0.c. Adjust for new name.
+
+ * src/tests/omp_get_nvt_feed_details_2.c: Remove. Rename to
+ omp_get_nvt_details_2.c.
+ * src/tests/omp_get_nvt_details_2.c: New file. Was
+ omp_get_nvt_feed_details_2.c. Adjust for new name.
+
+ * src/tests/omp_get_nvt_feed_details_3.c: Remove. Rename to
+ omp_get_nvt_details_3.c.
+ * src/tests/omp_get_nvt_details_3.c: New file. Was
+ omp_get_nvt_feed_details_3.c. Adjust for new name.
+
+ * src/tests/omp_get_nvt_feed_details_4.c: Remove. Rename to
+ omp_get_nvt_details_4.c.
+ * src/tests/omp_get_nvt_details_4.c: New file. Was
+ omp_get_nvt_feed_details_4.c. Adjust for new name.
+
+2009-05-28 Matthew Mundell <mmundell at intevation.de>
+
Rename OMP GET_NVT_FEED_ALL to GET_NVT_ALL.
* src/omp.c (help_text, client_state_t, omp_xml_handle_start_element)
(omp_xml_handle_end_element): Rename GET_NVT_FEED_ALL to GET_NVT_ALL.
- * src/tests/CMakeLists.txt: Rename omp_get_nvt_feed_all_0 to omp_get_nvt_all_0
- and omp_get_nvt_feed_all_1 to omp_get_nvt_all_1.
+ * src/tests/CMakeLists.txt: Rename omp_get_nvt_feed_all_0 to
+ omp_get_nvt_all_0 and omp_get_nvt_feed_all_1 to omp_get_nvt_all_1.
- * src/tests/omp_get_nvt_feed_all_0.c: Remove. Rename to omp_get_nvt_all_0.c.
- * src/tests/omp_get_nvt_all_0.c: New file. Was omp_get_nvt_feed_all_0.c. Adjust
- for new name.
+ * src/tests/omp_get_nvt_feed_all_0.c: Remove. Rename to
+ omp_get_nvt_all_0.c.
+ * src/tests/omp_get_nvt_all_0.c: New file. Was omp_get_nvt_feed_all_0.c.
+ Adjust for new name.
- * src/tests/omp_get_nvt_feed_all_1.c: Remove. Rename to omp_get_nvt_all_1.c.
- * src/tests/omp_get_nvt_all_1.c: New file. Was omp_get_nvt_feed_all_1.c. Adjust
- for new name.
+ * src/tests/omp_get_nvt_feed_all_1.c: Remove. Rename to
+ omp_get_nvt_all_1.c.
+ * src/tests/omp_get_nvt_all_1.c: New file. Was omp_get_nvt_feed_all_1.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 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/src/omp.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -71,7 +71,7 @@
" GET_DEPENDENCIES Get dependencies for all available NVTs.\n"
" GET_NVT_ALL Get IDs and names of all available NVTs.\n"
" GET_NVT_FEED_CHECKSUM Get checksum for entire NVT collection.\n"
-" GET_NVT_FEED_DETAILS Get all details for all available NVTs.\n"
+" GET_NVT_DETAILS Get all details for all available NVTs.\n"
" GET_PREFERENCES Get preferences for all available NVTs.\n"
" GET_REPORT Get a report identified by its unique ID.\n"
" GET_RULES Get the rules for the authenticated user.\n"
@@ -187,8 +187,8 @@
CLIENT_GET_DEPENDENCIES,
CLIENT_GET_NVT_ALL,
CLIENT_GET_NVT_FEED_CHECKSUM,
- CLIENT_GET_NVT_FEED_DETAILS,
- CLIENT_GET_NVT_FEED_DETAILS_OID,
+ CLIENT_GET_NVT_DETAILS,
+ CLIENT_GET_NVT_DETAILS_OID,
CLIENT_GET_PREFERENCES,
CLIENT_GET_REPORT,
CLIENT_GET_REPORT_ID,
@@ -355,8 +355,8 @@
set_client_state (CLIENT_GET_NVT_ALL);
else if (strncasecmp ("GET_NVT_FEED_CHECKSUM", element_name, 21) == 0)
set_client_state (CLIENT_GET_NVT_FEED_CHECKSUM);
- else if (strncasecmp ("GET_NVT_FEED_DETAILS", element_name, 20) == 0)
- set_client_state (CLIENT_GET_NVT_FEED_DETAILS);
+ else if (strncasecmp ("GET_NVT_DETAILS", element_name, 20) == 0)
+ set_client_state (CLIENT_GET_NVT_DETAILS);
else if (strncasecmp ("GET_PREFERENCES", element_name, 15) == 0)
set_client_state (CLIENT_GET_PREFERENCES);
else if (strncasecmp ("GET_REPORT", element_name, 10) == 0)
@@ -548,14 +548,14 @@
}
break;
- case CLIENT_GET_NVT_FEED_DETAILS:
+ case CLIENT_GET_NVT_DETAILS:
if (strncasecmp ("OID", element_name, 3) == 0)
- set_client_state (CLIENT_GET_NVT_FEED_DETAILS_OID);
+ set_client_state (CLIENT_GET_NVT_DETAILS_OID);
else
{
- if (send_to_client ("<get_nvt_feed_details>"
+ if (send_to_client ("<get_nvt_details>"
"<status>" STATUS_ERROR_SYNTAX "</status>"
- "</get_nvt_feed_details>"))
+ "</get_nvt_details>"))
{
error_send_to_client (error);
return;
@@ -1384,10 +1384,10 @@
set_client_state (CLIENT_AUTHENTIC);
break;
- case CLIENT_GET_NVT_FEED_DETAILS:
+ case CLIENT_GET_NVT_DETAILS:
if (server.plugins)
{
- SEND_TO_CLIENT_OR_FAIL ("<get_nvt_feed_details_response>");
+ SEND_TO_CLIENT_OR_FAIL ("<get_nvt_details_response>");
if (current_uuid)
{
nvti_t* plugin = find_nvti (server.plugins, current_uuid);
@@ -1420,13 +1420,13 @@
return;
}
}
- SEND_TO_CLIENT_OR_FAIL ("</get_nvt_feed_details_response>");
+ SEND_TO_CLIENT_OR_FAIL ("</get_nvt_details_response>");
}
else
{
- SEND_TO_CLIENT_OR_FAIL ("<get_nvt_feed_details_response>"
+ SEND_TO_CLIENT_OR_FAIL ("<get_nvt_details_response>"
"<status>" STATUS_SERVICE_DOWN "</status>"
- "</get_nvt_feed_details_response>");
+ "</get_nvt_details_response>");
/* \todo TODO Sort out a cache for this. */
if (request_plugin_list ())
{
@@ -1438,9 +1438,9 @@
}
set_client_state (CLIENT_AUTHENTIC);
break;
- case CLIENT_GET_NVT_FEED_DETAILS_OID:
+ case CLIENT_GET_NVT_DETAILS_OID:
assert (strncasecmp ("OID", element_name, 3) == 0);
- set_client_state (CLIENT_GET_NVT_FEED_DETAILS);
+ set_client_state (CLIENT_GET_NVT_DETAILS);
break;
case CLIENT_DELETE_REPORT:
@@ -2060,7 +2060,7 @@
case CLIENT_DELETE_REPORT_ID:
case CLIENT_DELETE_TASK_TASK_ID:
case CLIENT_GET_REPORT_ID:
- case CLIENT_GET_NVT_FEED_DETAILS_OID:
+ case CLIENT_GET_NVT_DETAILS_OID:
case CLIENT_MODIFY_REPORT_REPORT_ID:
case CLIENT_MODIFY_TASK_TASK_ID:
case CLIENT_START_TASK_TASK_ID:
Modified: trunk/openvas-manager/src/tests/CMakeLists.txt
===================================================================
--- trunk/openvas-manager/src/tests/CMakeLists.txt 2009-05-28 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/src/tests/CMakeLists.txt 2009-05-28 16:51:47 UTC (rev 3527)
@@ -209,40 +209,40 @@
target_link_libraries (omp_get_nvt_feed_checksum_1 common)
ADD_TEST (omp_get_nvt_feed_checksum_1 omp_get_nvt_feed_checksum_1)
-add_executable (omp_get_nvt_feed_details_0 omp_get_nvt_feed_details_0.c)
-target_link_libraries (omp_get_nvt_feed_details_0 string)
-set_target_properties (omp_get_nvt_feed_details_0 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
-set_target_properties (omp_get_nvt_feed_details_0 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
-target_link_libraries (omp_get_nvt_feed_details_0 common)
-ADD_TEST (omp_get_nvt_feed_details_0 omp_get_nvt_feed_details_0)
+add_executable (omp_get_nvt_details_0 omp_get_nvt_details_0.c)
+target_link_libraries (omp_get_nvt_details_0 string)
+set_target_properties (omp_get_nvt_details_0 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
+set_target_properties (omp_get_nvt_details_0 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
+target_link_libraries (omp_get_nvt_details_0 common)
+ADD_TEST (omp_get_nvt_details_0 omp_get_nvt_details_0)
-add_executable (omp_get_nvt_feed_details_1 omp_get_nvt_feed_details_1.c)
-target_link_libraries (omp_get_nvt_feed_details_1 string)
-set_target_properties (omp_get_nvt_feed_details_1 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
-set_target_properties (omp_get_nvt_feed_details_1 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
-target_link_libraries (omp_get_nvt_feed_details_1 common)
-ADD_TEST (omp_get_nvt_feed_details_1 omp_get_nvt_feed_details_1)
+add_executable (omp_get_nvt_details_1 omp_get_nvt_details_1.c)
+target_link_libraries (omp_get_nvt_details_1 string)
+set_target_properties (omp_get_nvt_details_1 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
+set_target_properties (omp_get_nvt_details_1 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
+target_link_libraries (omp_get_nvt_details_1 common)
+ADD_TEST (omp_get_nvt_details_1 omp_get_nvt_details_1)
-add_executable (omp_get_nvt_feed_details_2 omp_get_nvt_feed_details_2.c)
-target_link_libraries (omp_get_nvt_feed_details_2 string)
-set_target_properties (omp_get_nvt_feed_details_2 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
-set_target_properties (omp_get_nvt_feed_details_2 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
-target_link_libraries (omp_get_nvt_feed_details_2 common)
-ADD_TEST (omp_get_nvt_feed_details_2 omp_get_nvt_feed_details_2)
+add_executable (omp_get_nvt_details_2 omp_get_nvt_details_2.c)
+target_link_libraries (omp_get_nvt_details_2 string)
+set_target_properties (omp_get_nvt_details_2 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
+set_target_properties (omp_get_nvt_details_2 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
+target_link_libraries (omp_get_nvt_details_2 common)
+ADD_TEST (omp_get_nvt_details_2 omp_get_nvt_details_2)
-add_executable (omp_get_nvt_feed_details_3 omp_get_nvt_feed_details_3.c)
-target_link_libraries (omp_get_nvt_feed_details_3 string)
-set_target_properties (omp_get_nvt_feed_details_3 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
-set_target_properties (omp_get_nvt_feed_details_3 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
-target_link_libraries (omp_get_nvt_feed_details_3 common)
-ADD_TEST (omp_get_nvt_feed_details_3 omp_get_nvt_feed_details_3)
+add_executable (omp_get_nvt_details_3 omp_get_nvt_details_3.c)
+target_link_libraries (omp_get_nvt_details_3 string)
+set_target_properties (omp_get_nvt_details_3 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
+set_target_properties (omp_get_nvt_details_3 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
+target_link_libraries (omp_get_nvt_details_3 common)
+ADD_TEST (omp_get_nvt_details_3 omp_get_nvt_details_3)
-add_executable (omp_get_nvt_feed_details_4 omp_get_nvt_feed_details_4.c)
-target_link_libraries (omp_get_nvt_feed_details_4 string)
-set_target_properties (omp_get_nvt_feed_details_4 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
-set_target_properties (omp_get_nvt_feed_details_4 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
-target_link_libraries (omp_get_nvt_feed_details_4 common)
-ADD_TEST (omp_get_nvt_feed_details_4 omp_get_nvt_feed_details_4)
+add_executable (omp_get_nvt_details_4 omp_get_nvt_details_4.c)
+target_link_libraries (omp_get_nvt_details_4 string)
+set_target_properties (omp_get_nvt_details_4 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
+set_target_properties (omp_get_nvt_details_4 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
+target_link_libraries (omp_get_nvt_details_4 common)
+ADD_TEST (omp_get_nvt_details_4 omp_get_nvt_details_4)
add_executable (omp_get_preferences_0 omp_get_preferences_0.c)
target_link_libraries (omp_get_preferences_0 string)
Copied: trunk/openvas-manager/src/tests/omp_get_nvt_details_0.c (from rev 3484, trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_0.c)
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_0.c 2009-05-26 17:46:12 UTC (rev 3484)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_details_0.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -0,0 +1,82 @@
+/* Test 0 of OMP GET_NVT_DETAILS.
+ * $Id$
+ * Description: Test the OMP GET_NVT_DETAILS command before a task runs.
+ *
+ * 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 <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "../tracef.h"
+
+int
+main ()
+{
+ int socket;
+ gnutls_session_t session;
+
+ socket = connect_to_manager (&session);
+ if (socket == -1) return EXIT_FAILURE;
+
+ /* Request the feed details. */
+
+ if (env_authenticate (&session))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ if (send_to_manager (&session, "<get_nvt_details/>") == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Read the response. */
+
+ entity_t entity = NULL;
+ read_entity (&session, &entity);
+
+ /* Compare to expected response. */
+
+ entity_t expected = add_entity (NULL, "get_nvt_details_response", NULL);
+ add_entity (&expected->entities, "status", "503");
+
+ if (compare_entities (entity, expected))
+ {
+ free_entity (entity);
+ free_entity (expected);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ free_entity (expected);
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_SUCCESS;
+}
Copied: trunk/openvas-manager/src/tests/omp_get_nvt_details_1.c (from rev 3484, 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-26 17:46:12 UTC (rev 3484)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_details_1.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -0,0 +1,182 @@
+/* Test 1 of OMP GET_NVT_DETAILS.
+ * $Id$
+ * Description: Test the OMP GET_NVT_DETAILS command after a task runs.
+ *
+ * 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 <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "../tracef.h"
+
+int
+main ()
+{
+ int socket;
+ gnutls_session_t session;
+ char* id;
+ entity_t entity, status;
+
+ setup_test ();
+
+ socket = connect_to_manager (&session);
+ if (socket == -1) return EXIT_FAILURE;
+
+ if (env_authenticate (&session))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Request feed information once, so manager requests it from server. */
+
+ if (send_to_manager (&session, "<get_nvt_all/>") == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+ entity = NULL;
+ if (read_entity (&session, &entity))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+ free_entity (entity);
+
+ /* Create a task. */
+
+ if (create_task_from_rc_file (&session,
+ "new_task_small_rc",
+ "Task for omp_get_nvt_details_1",
+ "Test omp_get_nvt_details_1 task.",
+ &id))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Start the task. */
+
+ if (start_task (&session, id))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ /* Wait for the task to start on the server. */
+
+ if (wait_for_task_start (&session, id))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ /* Request the task status. */
+
+#if 0
+ if (env_authenticate (&session))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+#endif
+
+ if (sendf_to_manager (&session,
+ "<status><task_id>%s</task_id></status>",
+ id)
+ == -1)
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ entity = NULL;
+ if (read_entity (&session, &entity))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+ free_entity (entity);
+
+ /* Get the feed details. */
+
+#if 0
+ if (env_authenticate (&session))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+#endif
+
+ if (send_to_manager (&session, "<get_nvt_details/>") == -1)
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ /* Read the response. */
+
+ entity = NULL;
+ read_entity (&session, &entity);
+ if (entity) print_entity (stdout, entity);
+
+ /* Compare to expected response. */
+
+ if (entity == NULL
+ || strcmp (entity_name (entity), "get_nvt_details_response")
+ || (status = entity_child (entity, "status")) == NULL
+ || (strcmp (entity_text (status), "200")
+ && strcmp (entity_text (status), "503")))
+ {
+ free_entity (entity);
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ free_entity (entity);
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_SUCCESS;
+}
Copied: trunk/openvas-manager/src/tests/omp_get_nvt_details_2.c (from rev 3492, trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_2.c)
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_2.c 2009-05-27 13:19:40 UTC (rev 3492)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_details_2.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -0,0 +1,88 @@
+/* Test 2 of OMP GET_NVT_DETAILS.
+ * $Id$
+ * Description: Test OMP GET_NVT_DETAILS with a missing ID.
+ *
+ * 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 <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "../tracef.h"
+
+int
+main ()
+{
+ int socket;
+ gnutls_session_t session;
+
+ verbose = 1;
+
+ socket = connect_to_manager (&session);
+ if (socket == -1) return EXIT_FAILURE;
+
+ /* Request the feed details. */
+
+ if (env_authenticate (&session))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ if (send_to_manager (&session,
+ "<get_nvt_details>"
+ "<oid>0.0.0.0.0.0.0.0.0.0</oid>"
+ "</get_nvt_details>")
+ == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Read the response. */
+
+ entity_t entity = NULL;
+ read_entity (&session, &entity);
+
+ /* Compare to expected response. */
+
+ entity_t expected = add_entity (NULL, "get_nvt_details_response", NULL);
+ add_entity (&expected->entities, "status", "404");
+
+ if (compare_entities (entity, expected))
+ {
+ free_entity (entity);
+ free_entity (expected);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ free_entity (expected);
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_SUCCESS;
+}
Copied: trunk/openvas-manager/src/tests/omp_get_nvt_details_3.c (from rev 3492, trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_3.c)
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_3.c 2009-05-27 13:19:40 UTC (rev 3492)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_details_3.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -0,0 +1,86 @@
+/* Test 3 of OMP GET_NVT_DETAILS.
+ * $Id$
+ * Description: Test OMP GET_NVT_DETAILS with a bogus ID.
+ *
+ * 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 <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "../tracef.h"
+
+int
+main ()
+{
+ int socket;
+ gnutls_session_t session;
+
+ socket = connect_to_manager (&session);
+ if (socket == -1) return EXIT_FAILURE;
+
+ /* Request the feed details. */
+
+ if (env_authenticate (&session))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ if (send_to_manager (&session,
+ "<get_nvt_details>"
+ "<oid>-*_*-</oid>"
+ "</get_nvt_details>")
+ == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Read the response. */
+
+ entity_t entity = NULL;
+ read_entity (&session, &entity);
+
+ /* Compare to expected response. */
+
+ entity_t expected = add_entity (NULL, "get_nvt_details_response", NULL);
+ add_entity (&expected->entities, "status", "404");
+
+ if (compare_entities (entity, expected))
+ {
+ free_entity (entity);
+ free_entity (expected);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ free_entity (expected);
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_SUCCESS;
+}
Copied: trunk/openvas-manager/src/tests/omp_get_nvt_details_4.c (from rev 3518, trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_4.c)
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_4.c 2009-05-28 13:21:18 UTC (rev 3518)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_details_4.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -0,0 +1,200 @@
+/* Test 4 of OMP GET_NVT_DETAILS.
+ * $Id$
+ * Description: Test the OMP GET_NVT_DETAILS with a known ID.
+ *
+ * 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 <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "../tracef.h"
+
+int
+main ()
+{
+ int socket;
+ gnutls_session_t session;
+ char* id;
+ entity_t entity, entity2, status, nvt, nvt_id;
+
+ verbose = 1;
+
+ socket = connect_to_manager (&session);
+ if (socket == -1) return EXIT_FAILURE;
+
+ if (env_authenticate (&session))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Request feed information once, so manager requests it from server. */
+
+ if (send_to_manager (&session, "<get_nvt_all/>") == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+ entity = NULL;
+ if (read_entity (&session, &entity))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+ free_entity (entity);
+
+ /* Create a task. */
+
+ if (create_task_from_rc_file (&session,
+ "new_task_small_rc",
+ "Task for omp_get_nvt_details_1",
+ "Test omp_get_nvt_details_1 task.",
+ &id))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Start the task. */
+
+ if (start_task (&session, id))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ /* Wait for the task to start on the server. */
+
+ if (wait_for_task_start (&session, id))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ /* Request the task status. */
+
+#if 0
+ if (env_authenticate (&session))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+#endif
+
+ if (sendf_to_manager (&session,
+ "<status><task_id>%s</task_id></status>",
+ id)
+ == -1)
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+
+ entity = NULL;
+ if (read_entity (&session, &entity))
+ {
+ delete_task (&session, id);
+ close_manager_connection (socket, session);
+ free (id);
+ return EXIT_FAILURE;
+ }
+ free_entity (entity);
+
+ delete_task (&session, id);
+ free (id);
+
+ /* Get summary of all NVTs, to get details of one NVT. */
+
+ if (send_to_manager (&session, "<get_nvt_all/>") == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+ entity = NULL;
+ if (read_entity (&session, &entity))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+ nvt = entity_child (entity, "nvt");
+ if (nvt == NULL
+ || (nvt_id = entity_child (nvt, "oid")) == NULL)
+ {
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Request details of the NVT. */
+
+ if (sendf_to_manager (&session,
+ "<get_nvt_details>"
+ "<oid>%s</oid>"
+ "</get_nvt_details>",
+ entity_text (nvt_id))
+ == -1)
+ {
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Read the response. */
+
+ entity2 = NULL;
+ if (read_entity (&session, &entity2))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ /* Compare to expected response. */
+
+ if (entity2 == NULL
+ || strcmp (entity_name (entity2), "get_nvt_details_response")
+ || (status = entity_child (entity2, "status")) == NULL
+ || strcmp (entity_text (status), "200")
+ || compare_entities (entity_child (entity, "nvt"), nvt))
+ {
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
+
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_SUCCESS;
+}
Deleted: trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_0.c 2009-05-28 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_0.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -1,82 +0,0 @@
-/* Test 0 of OMP GET_NVT_FEED_DETAILS.
- * $Id$
- * Description: Test the OMP GET_NVT_FEED_DETAILS command before a task runs.
- *
- * 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 <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "../tracef.h"
-
-int
-main ()
-{
- int socket;
- gnutls_session_t session;
-
- socket = connect_to_manager (&session);
- if (socket == -1) return EXIT_FAILURE;
-
- /* Request the feed details. */
-
- if (env_authenticate (&session))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- if (send_to_manager (&session, "<get_nvt_feed_details/>") == -1)
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Read the response. */
-
- entity_t entity = NULL;
- read_entity (&session, &entity);
-
- /* Compare to expected response. */
-
- entity_t expected = add_entity (NULL, "get_nvt_feed_details_response", NULL);
- add_entity (&expected->entities, "status", "503");
-
- if (compare_entities (entity, expected))
- {
- free_entity (entity);
- free_entity (expected);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- free_entity (expected);
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_SUCCESS;
-}
Deleted: 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-28 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_1.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -1,180 +0,0 @@
-/* Test 1 of OMP GET_NVT_FEED_DETAILS.
- * $Id$
- * Description: Test the OMP GET_NVT_FEED_DETAILS command after a task runs.
- *
- * 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 <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "../tracef.h"
-
-int
-main ()
-{
- int socket;
- gnutls_session_t session;
- char* id;
- entity_t entity, status;
-
- socket = connect_to_manager (&session);
- if (socket == -1) return EXIT_FAILURE;
-
- if (env_authenticate (&session))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Request feed information once, so manager requests it from server. */
-
- if (send_to_manager (&session, "<get_nvt_feed_all/>") == -1)
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
- entity = NULL;
- if (read_entity (&session, &entity))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
- free_entity (entity);
-
- /* Create a task. */
-
- if (create_task_from_rc_file (&session,
- "new_task_small_rc",
- "Task for omp_get_nvt_feed_details_1",
- "Test omp_get_nvt_feed_details_1 task.",
- &id))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Start the task. */
-
- if (start_task (&session, id))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- /* Wait for the task to start on the server. */
-
- if (wait_for_task_start (&session, id))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- /* Request the task status. */
-
-#if 0
- if (env_authenticate (&session))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-#endif
-
- if (sendf_to_manager (&session,
- "<status><task_id>%s</task_id></status>",
- id)
- == -1)
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- entity = NULL;
- if (read_entity (&session, &entity))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
- free_entity (entity);
-
- /* Get the feed details. */
-
-#if 0
- if (env_authenticate (&session))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-#endif
-
- if (send_to_manager (&session, "<get_nvt_feed_details/>") == -1)
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- /* Read the response. */
-
- entity = NULL;
- read_entity (&session, &entity);
- if (entity) print_entity (stdout, entity);
-
- /* Compare to expected response. */
-
- if (entity == NULL
- || strcmp (entity_name (entity), "get_nvt_feed_details_response")
- || (status = entity_child (entity, "status")) == NULL
- || (strcmp (entity_text (status), "200")
- && strcmp (entity_text (status), "503")))
- {
- free_entity (entity);
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- free_entity (entity);
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_SUCCESS;
-}
Deleted: trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_2.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_2.c 2009-05-28 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_2.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -1,88 +0,0 @@
-/* Test 2 of OMP GET_NVT_FEED_DETAILS.
- * $Id$
- * Description: Test OMP GET_NVT_FEED_DETAILS with a missing ID.
- *
- * 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 <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "../tracef.h"
-
-int
-main ()
-{
- int socket;
- gnutls_session_t session;
-
- verbose = 1;
-
- socket = connect_to_manager (&session);
- if (socket == -1) return EXIT_FAILURE;
-
- /* Request the feed details. */
-
- if (env_authenticate (&session))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- if (send_to_manager (&session,
- "<get_nvt_feed_details>"
- "<oid>0.0.0.0.0.0.0.0.0.0</oid>"
- "</get_nvt_feed_details>")
- == -1)
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Read the response. */
-
- entity_t entity = NULL;
- read_entity (&session, &entity);
-
- /* Compare to expected response. */
-
- entity_t expected = add_entity (NULL, "get_nvt_feed_details_response", NULL);
- add_entity (&expected->entities, "status", "404");
-
- if (compare_entities (entity, expected))
- {
- free_entity (entity);
- free_entity (expected);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- free_entity (expected);
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_SUCCESS;
-}
Deleted: trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_3.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_3.c 2009-05-28 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_3.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -1,86 +0,0 @@
-/* Test 3 of OMP GET_NVT_FEED_DETAILS.
- * $Id$
- * Description: Test OMP GET_NVT_FEED_DETAILS with a bogus ID.
- *
- * 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 <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "../tracef.h"
-
-int
-main ()
-{
- int socket;
- gnutls_session_t session;
-
- socket = connect_to_manager (&session);
- if (socket == -1) return EXIT_FAILURE;
-
- /* Request the feed details. */
-
- if (env_authenticate (&session))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- if (send_to_manager (&session,
- "<get_nvt_feed_details>"
- "<oid>-*_*-</oid>"
- "</get_nvt_feed_details>")
- == -1)
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Read the response. */
-
- entity_t entity = NULL;
- read_entity (&session, &entity);
-
- /* Compare to expected response. */
-
- entity_t expected = add_entity (NULL, "get_nvt_feed_details_response", NULL);
- add_entity (&expected->entities, "status", "404");
-
- if (compare_entities (entity, expected))
- {
- free_entity (entity);
- free_entity (expected);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- free_entity (expected);
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_SUCCESS;
-}
Deleted: trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_4.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_4.c 2009-05-28 15:31:39 UTC (rev 3526)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_details_4.c 2009-05-28 16:51:47 UTC (rev 3527)
@@ -1,200 +0,0 @@
-/* Test 4 of OMP GET_NVT_FEED_DETAILS.
- * $Id$
- * Description: Test the OMP GET_NVT_FEED_DETAILS with a known ID.
- *
- * 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 <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "../tracef.h"
-
-int
-main ()
-{
- int socket;
- gnutls_session_t session;
- char* id;
- entity_t entity, entity2, status, nvt, nvt_id;
-
- verbose = 1;
-
- socket = connect_to_manager (&session);
- if (socket == -1) return EXIT_FAILURE;
-
- if (env_authenticate (&session))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Request feed information once, so manager requests it from server. */
-
- if (send_to_manager (&session, "<get_nvt_feed_all/>") == -1)
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
- entity = NULL;
- if (read_entity (&session, &entity))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
- free_entity (entity);
-
- /* Create a task. */
-
- if (create_task_from_rc_file (&session,
- "new_task_small_rc",
- "Task for omp_get_nvt_feed_details_1",
- "Test omp_get_nvt_feed_details_1 task.",
- &id))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Start the task. */
-
- if (start_task (&session, id))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- /* Wait for the task to start on the server. */
-
- if (wait_for_task_start (&session, id))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- /* Request the task status. */
-
-#if 0
- if (env_authenticate (&session))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-#endif
-
- if (sendf_to_manager (&session,
- "<status><task_id>%s</task_id></status>",
- id)
- == -1)
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
-
- entity = NULL;
- if (read_entity (&session, &entity))
- {
- delete_task (&session, id);
- close_manager_connection (socket, session);
- free (id);
- return EXIT_FAILURE;
- }
- free_entity (entity);
-
- delete_task (&session, id);
- free (id);
-
- /* Get summary of all NVTs, to get details of one NVT. */
-
- if (send_to_manager (&session, "<get_nvt_feed_all/>") == -1)
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
- entity = NULL;
- if (read_entity (&session, &entity))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
- nvt = entity_child (entity, "nvt");
- if (nvt == NULL
- || (nvt_id = entity_child (nvt, "oid")) == NULL)
- {
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Request details of the NVT. */
-
- if (sendf_to_manager (&session,
- "<get_nvt_feed_details>"
- "<oid>%s</oid>"
- "</get_nvt_feed_details>",
- entity_text (nvt_id))
- == -1)
- {
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Read the response. */
-
- entity2 = NULL;
- if (read_entity (&session, &entity2))
- {
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- /* Compare to expected response. */
-
- if (entity2 == NULL
- || strcmp (entity_name (entity2), "get_nvt_feed_details_response")
- || (status = entity_child (entity2, "status")) == NULL
- || strcmp (entity_text (status), "200")
- || compare_entities (entity_child (entity, "nvt"), nvt))
- {
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
- }
-
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_SUCCESS;
-}
More information about the Openvas-commits
mailing list