From 9192987cf0e7299a76f2e1c1c91920cf826cd78e Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 24 Aug 2011 17:52:52 +0000 Subject: [PATCH] 2011-08-24 Miguel de Dios * godmode/agentes/module_manager_editor.php: added javascript alert message when the name in field and remote config is different. Fixes: #3397306 * godmode/agentes/configurar_agente.php: fixed when copy a module the name now is safe input type. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4818 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++++ .../godmode/agentes/configurar_agente.php | 4 +- .../godmode/agentes/module_manager_editor.php | 41 ++++++++++++++++++- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1c4cadd3b0..c3344240db 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2011-08-24 Miguel de Dios + + * godmode/agentes/module_manager_editor.php: added javascript alert message + when the name in field and remote config is different. + + Fixes: #3397306 + + * godmode/agentes/configurar_agente.php: fixed when copy a module the name + now is safe input type. + 2011-08-24 Sancho Lerena * include/help/en/help_snmp_alert_field1.php: New help page. diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 6dee8edc0a..9ba1ea5442 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -905,8 +905,8 @@ if ($delete_module) { // DELETE agent module ! if ($duplicate_module) { // DUPLICATE agent module ! $id_duplicate_module = (int) get_parameter_get ("duplicate_module",0); $result = modules_copy_agent_module_to_agent ($id_duplicate_module, - modules_get_agentmodule_agent($id_duplicate_module), - __('copy of').' '.modules_get_agentmodule_name($id_duplicate_module)); + modules_get_agentmodule_agent($id_duplicate_module), + io_safe_input(__('copy of').' '.modules_get_agentmodule_name($id_duplicate_module))); $agent = db_get_row ('tagente', 'id_agente', $id_agente); diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index abf1e51aa3..2ff6488601 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -265,6 +265,7 @@ if($is_function_policies !== ENTERPRISE_NOT_HOOK) { } global $__code_from; $__code_from = 'modules'; +$remote_conf = false; switch ($moduletype) { case "dataserver": case 1: @@ -281,7 +282,8 @@ switch ($moduletype) { if ($config['enterprise_installed'] && $remote_conf) { if($id_agent_module) { enterprise_include_once('include/functions_config_agents.php'); - $configuration_data = enterprise_hook('config_agents_get_module_from_conf', array($id_agente, modules_get_agentmodule_name($id_agent_module))); + $configuration_data = enterprise_hook('config_agents_get_module_from_conf', + array($id_agente, io_safe_output(modules_get_agentmodule_name($id_agent_module)))); } enterprise_include ('godmode/agentes/module_manager_editor_data.php'); } @@ -358,10 +360,27 @@ if ($id_agent_module) { html_print_input_hidden ('update_module', 1); html_print_input_hidden ('id_agent_module', $id_agent_module); html_print_input_hidden ('id_module_type', $id_module_type); -} else { + + if ($config['enterprise_installed'] && $remote_conf) { + ?> + + + + '; echo ''; @@ -383,6 +402,24 @@ var no_plugin_lang = ""; $(document).ready (function () { configure_modules_form (); + + $("#module_form").submit(function() { + if (check_remote_conf) { + //Check the name + name = $("#text-name").val(); + remote_config = $("#textarea_configuration_data").val(); + + regexp_name = new RegExp('module_name\\s*' + name+"\n"); + + if (remote_config.match(regexp_name)) return true; + else { + alert(""); + return false; + } + } + + return true; + }); }); /* ]]> */