[Openvas-commits] r11676 - in trunk/openvas-manager: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Sep 23 09:50:11 CEST 2011
Author: hdoreau
Date: 2011-09-23 09:50:10 +0200 (Fri, 23 Sep 2011)
New Revision: 11676
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/omp.c
Log:
* src/omp.c (get_info_data_t, get_info_data_reset, command_data_t)
(omp_xml_handle_start_element, omp_xml_handle_end_element): Relocated
get_info code.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2011-09-23 06:16:02 UTC (rev 11675)
+++ trunk/openvas-manager/ChangeLog 2011-09-23 07:50:10 UTC (rev 11676)
@@ -1,3 +1,9 @@
+2011-09-23 Henri Doreau <henri.doreau at greenbone.net>
+
+ * src/omp.c (get_info_data_t, get_info_data_reset, command_data_t)
+ (omp_xml_handle_start_element, omp_xml_handle_end_element): Relocated
+ get_info code.
+
2011-09-22 Matthew Mundell <matthew.mundell at greenbone.net>
* src/omp.c (omp_xml_handle_end_element): Correct last commit.
Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c 2011-09-23 06:16:02 UTC (rev 11675)
+++ trunk/openvas-manager/src/omp.c 2011-09-23 07:50:10 UTC (rev 11676)
@@ -1596,6 +1596,29 @@
}
/**
+ * @brief Command data for the get_info command.
+ */
+typedef struct
+{
+ char *type; ///< Requested information type.
+ char *name; ///< Requested information identifier.
+} get_info_data_t;
+
+/**
+ * @brief Reset command data.
+ *
+ * @param[in] data Command data.
+ */
+static void
+get_info_data_reset (get_info_data_t *data)
+{
+ free (data->type);
+ free (data->name);
+
+ memset (data, 0, sizeof (get_info_data_t));
+}
+
+/**
* @brief Command data for the get_lsc_credentials command.
*/
typedef struct
@@ -2056,29 +2079,6 @@
}
/**
- * @brief Command data for the get_info command.
- */
-typedef struct
-{
- char *type; ///< Requested information type.
- char *name; ///< Requested information identifier.
-} get_info_data_t;
-
-/**
- * @brief Reset command data.
- *
- * @param[in] data Command data.
- */
-static void
-get_info_data_reset (get_info_data_t *data)
-{
- free (data->type);
- free (data->name);
-
- memset (data, 0, sizeof (get_info_data_t));
-}
-
-/**
* @brief Command data for the help command.
*/
typedef struct
@@ -2586,6 +2586,7 @@
get_configs_data_t get_configs; ///< get_configs
get_dependencies_data_t get_dependencies; ///< get_dependencies
get_escalators_data_t get_escalators; ///< get_escalators
+ get_info_data_t get_info; ///< get_info
get_lsc_credentials_data_t get_lsc_credentials; ///< get_lsc_credentials
get_notes_data_t get_notes; ///< get_notes
get_nvts_data_t get_nvts; ///< get_nvts
@@ -2601,7 +2602,6 @@
get_system_reports_data_t get_system_reports; ///< get_system_reports
get_targets_data_t get_targets; ///< get_targets
get_tasks_data_t get_tasks; ///< get_tasks
- get_info_data_t get_info; ///< get_info
help_data_t help; ///< help
modify_config_data_t modify_config; ///< modify_config
modify_lsc_credential_data_t modify_lsc_credential; ///< modify_lsc_credential
@@ -2806,6 +2806,12 @@
= &(command_data.get_escalators);
/**
+ * @brief Parser callback data for GET_INFO.
+ */
+get_info_data_t *get_info_data
+ = &(command_data.get_info);
+
+/**
* @brief Parser callback data for GET_LSC_CREDENTIALS.
*/
get_lsc_credentials_data_t *get_lsc_credentials_data
@@ -2896,12 +2902,6 @@
= &(command_data.get_tasks);
/**
- * @brief Parser callback data for GET_INFO.
- */
-get_info_data_t *get_info_data
- = &(command_data.get_info);
-
-/**
* @brief Parser callback data for HELP.
*/
help_data_t *help_data
@@ -5203,6 +5203,23 @@
}
break;
+ case CLIENT_GET_INFO:
+ {
+ if (send_element_error_to_client ("get_info", element_name,
+ write_to_client,
+ write_to_client_data))
+ {
+ error_send_to_client (error);
+ return;
+ }
+ set_client_state (CLIENT_AUTHENTIC);
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+ "Error");
+ }
+ break;
+
case CLIENT_GET_LSC_CREDENTIALS:
{
if (send_element_error_to_client ("get_lsc_credentials",
@@ -5467,23 +5484,6 @@
"Error");
break;
- case CLIENT_GET_INFO:
- {
- if (send_element_error_to_client ("get_info", element_name,
- write_to_client,
- write_to_client_data))
- {
- error_send_to_client (error);
- return;
- }
- set_client_state (CLIENT_AUTHENTIC);
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_UNKNOWN_ELEMENT,
- "Error");
- }
- break;
-
case CLIENT_HELP:
{
if (send_element_error_to_client ("help", element_name,
@@ -15938,6 +15938,39 @@
break;
}
+ case CLIENT_GET_INFO:
+ {
+ gchar *result;
+
+ result = NULL;
+
+ manage_read_info (get_info_data->type, get_info_data->name, &result);
+ if (result)
+ {
+ SEND_TO_CLIENT_OR_FAIL ("<get_info_response"
+ " status=\"" STATUS_OK "\""
+ " status_text=\"" STATUS_OK_TEXT "\">");
+ SEND_TO_CLIENT_OR_FAIL (result);
+ SEND_TO_CLIENT_OR_FAIL ("</get_info_response>");
+
+ g_free (result);
+ }
+ else
+ {
+ if (send_find_error_to_client ("get_info", "name",
+ get_info_data->name,
+ write_to_client,
+ write_to_client_data))
+ {
+ error_send_to_client (error);
+ return;
+ }
+ }
+ get_info_data_reset (get_info_data);
+ set_client_state (CLIENT_AUTHENTIC);
+ break;
+ }
+
case CLIENT_GET_LSC_CREDENTIALS:
{
iterator_t credentials;
@@ -17447,39 +17480,6 @@
set_client_state (CLIENT_AUTHENTIC);
break;
- case CLIENT_GET_INFO:
- {
- gchar *result;
-
- result = NULL;
-
- manage_read_info (get_info_data->type, get_info_data->name, &result);
- if (result)
- {
- SEND_TO_CLIENT_OR_FAIL ("<get_info_response"
- " status=\"" STATUS_OK "\""
- " status_text=\"" STATUS_OK_TEXT "\">");
- SEND_TO_CLIENT_OR_FAIL (result);
- SEND_TO_CLIENT_OR_FAIL ("</get_info_response>");
-
- g_free (result);
- }
- else
- {
- if (send_find_error_to_client ("get_info", "name",
- get_info_data->name,
- write_to_client,
- write_to_client_data))
- {
- error_send_to_client (error);
- return;
- }
- }
- get_info_data_reset (get_info_data);
- set_client_state (CLIENT_AUTHENTIC);
- break;
- }
-
case CLIENT_VERIFY_AGENT:
assert (strcasecmp ("VERIFY_AGENT", element_name) == 0);
if (verify_agent_data->agent_id)
More information about the Openvas-commits
mailing list