[Openvas-commits] r3472 - in trunk/openvas-manager: . src src/tests
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue May 26 10:55:59 CEST 2009
Author: mattm
Date: 2009-05-26 10:55:58 +0200 (Tue, 26 May 2009)
New Revision: 3472
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/omp.c
trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_0.c
trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_1.c
Log:
* src/omp.c (omp_xml_handle_end_element): Enable real
CLIENT_GET_NVT_FEED_CHECKSUM implementation.
* src/tests/omp_get_nvt_feed_checksum_0.c: Use new status code.
* src/tests/omp_get_nvt_feed_checksum_1.c: Add comparison to expected
response.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2009-05-26 08:28:24 UTC (rev 3471)
+++ trunk/openvas-manager/ChangeLog 2009-05-26 08:55:58 UTC (rev 3472)
@@ -1,3 +1,13 @@
+2009-05-26 Matthew Mundell <mmundell at intevation.de>
+
+ * src/omp.c (omp_xml_handle_end_element): Enable real
+ CLIENT_GET_NVT_FEED_CHECKSUM implementation.
+
+ * src/tests/omp_get_nvt_feed_checksum_0.c: Use new status code.
+
+ * src/tests/omp_get_nvt_feed_checksum_1.c: Add comparison to expected
+ response.
+
2009-05-25 Matthew Mundell <mmundell at intevation.de>
* src/omp.c (omp_xml_handle_start_element): Add enclosing tags that were
Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c 2009-05-26 08:28:24 UTC (rev 3471)
+++ trunk/openvas-manager/src/omp.c 2009-05-26 08:55:58 UTC (rev 3472)
@@ -1221,8 +1221,6 @@
break;
case CLIENT_GET_NVT_FEED_CHECKSUM:
-// FIX
-#if 0
if (server.plugins_md5)
{
SEND_TO_CLIENT_OR_FAIL ("<get_nvt_feed_checksum_response>"
@@ -1235,13 +1233,6 @@
SEND_TO_CLIENT_OR_FAIL ("<get_nvt_feed_checksum_response>"
"<status>" STATUS_SERVICE_DOWN "</status>"
"</get_nvt_feed_checksum_response>");
-#else
- SEND_TO_CLIENT_OR_FAIL ("<get_nvt_feed_checksum_response>"
- "<status>" STATUS_OK "</status>"
- "<algorithm>md5</algorithm>");
- SEND_TO_CLIENT_OR_FAIL ("111");
- SEND_TO_CLIENT_OR_FAIL ("</get_nvt_feed_checksum_response>");
-#endif
set_client_state (CLIENT_AUTHENTIC);
break;
Modified: trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_0.c 2009-05-26 08:28:24 UTC (rev 3471)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_0.c 2009-05-26 08:55:58 UTC (rev 3472)
@@ -1,6 +1,6 @@
/* Test 1 of OMP GET_NVT_FEED_CHECKSUM.
* $Id$
- * Description: Test the OMP GET_NVT_FEED_CHECKSUM command on a running task.
+ * Description: Test the OMP GET_NVT_FEED_CHECKSUM before running a task.
*
* Authors:
* Matthew Mundell <matt at mundell.ukfsn.org>
@@ -65,7 +65,7 @@
/* Compare to expected response. */
entity_t expected = add_entity (NULL, "get_nvt_feed_checksum_response", NULL);
- add_entity (&expected->entities, "status", "500");
+ add_entity (&expected->entities, "status", "503");
if (compare_entities (entity, expected))
{
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-26 08:28:24 UTC (rev 3471)
+++ trunk/openvas-manager/src/tests/omp_get_nvt_feed_checksum_1.c 2009-05-26 08:55:58 UTC (rev 3472)
@@ -1,6 +1,6 @@
/* Test 1 of OMP GET_NVT_FEED_CHECKSUM.
* $Id$
- * Description: Test the OMP GET_NVT_FEED_CHECKSUM command on a running task.
+ * Description: Test the OMP GET_NVT_FEED_CHECKSUM after starting a task.
*
* Authors:
* Matthew Mundell <matt at mundell.ukfsn.org>
@@ -25,6 +25,7 @@
#define TRACE 1
+#include <ctype.h>
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
@@ -34,12 +35,26 @@
#include "common.h"
#include "../tracef.h"
+/**
+ * @brief Check whether a string contains only alphanumeric characters.
+ *
+ * @return 1 if all characters are alphanumeric, else 0.
+ */
int
+isalnumstr (const char* string)
+{
+ while (*string) if (isalnum (*string)) string++; else return 0;
+ return 1;
+}
+
+int
main ()
{
int socket;
gnutls_session_t session;
char* id;
+ char* md5;
+ entity_t status, entity, algorithm;
socket = connect_to_manager (&session);
if (socket == -1) return EXIT_FAILURE;
@@ -105,7 +120,7 @@
return EXIT_FAILURE;
}
- entity_t entity = NULL;
+ entity = NULL;
if (read_entity (&session, &entity))
{
delete_task (&session, id);
@@ -115,7 +130,7 @@
}
free_entity (entity);
- /* Get the preferences. */
+ /* Get the feed checksum. */
#if 0
if (env_authenticate (&session))
@@ -139,25 +154,24 @@
entity = NULL;
read_entity (&session, &entity);
- if (entity) print_entity (stdout, entity);
-#if 0
/* Compare to expected response. */
- entity_t expected = add_entity (NULL, "get_nvt_feed_checksum_response", FIX);
-
- if (compare_entities (entity, expected))
+ if (entity == NULL
+ || (status = entity_child (entity, "status")) == NULL
+ || strcmp (entity_text (status), "200")
+ || (algorithm = entity_child (entity, "algorithm")) == NULL
+ || strcmp (entity_text (algorithm), "md5")
+ || (md5 = entity_text (entity)) == NULL
+ || !isalnumstr (md5))
{
free_entity (entity);
- free_entity (expected);
delete_task (&session, id);
close_manager_connection (socket, session);
free (id);
return EXIT_FAILURE;
}
- free_entity (expected);
-#endif
free_entity (entity);
delete_task (&session, id);
close_manager_connection (socket, session);
More information about the Openvas-commits
mailing list