From 421e51537c73fd2435e043c3dd452de48ca824b0 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 21 Oct 2010 16:39:10 +0000 Subject: [PATCH] 2010-10-21 Miguel de Dios * include/functions_config.php: fixed the change the flag tconfig "can_block_policies", now the operation is between policy semaphore. Fixes: #3091940 * include/functions_db.php: fixed the save user IP when the $config don't load this var yet. * include/functions_networkmap.php: fixed the translation call function when the pandora don't load the function. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3444 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 13 ++++++++++++ pandora_console/include/functions_config.php | 20 ++++++++++++++++++- pandora_console/include/functions_db.php | 16 ++++++++++++++- .../include/functions_networkmap.php | 2 +- 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 52f6ba73c0..28a7bf6cc9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2010-10-21 Miguel de Dios + + * include/functions_config.php: fixed the change the flag tconfig + "can_block_policies", now the operation is between policy semaphore. + + Fixes: #3091940 + + * include/functions_db.php: fixed the save user IP when the $config don't + load this var yet. + + * include/functions_networkmap.php: fixed the translation call function when + the pandora don't load the function. + 2010-10-21 Miguel de Dios * include/functions_config.php: added check tconfig parameter diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 8c1eebd106..bfa3cc400a 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -220,7 +220,25 @@ function update_config () { update_config_value ('sound_critical', get_parameter('sound_critical', $config['sound_critical'])); update_config_value ('sound_warning', get_parameter('sound_warning', $config['sound_warning'])); - update_config_value ('can_block_policies', get_parameter('can_block_policies', $config['can_block_policies'])); + $enterprise = enterprise_include_once('include/functions_policies.php'); + if ($enterprise !== ENTERPRISE_NOT_HOOK) { + $locked = enterprise_hook('semaphore_policy_test_and_set'); + if ($locked) { + pandora_audit("Policy management", "BLOCK policies for change tconfig['can_block_policies'] by " . $config['id_user']); + + update_config_value ('can_block_policies', get_parameter('can_block_policies', $config['can_block_policies'])); + + pandora_audit("Policy management", "UNBLOCK policies for change tconfig['can_block_policies'] by " . $config['id_user']); + enterprise_hook('semaphore_policy_unlock'); + } + else { + pandora_audit("Policy management", "Try to BLOCK policies for change tconfig['can_block_policies'] by " . $config['id_user']); + } + } + else { + update_config_value ('can_block_policies', get_parameter('can_block_policies', $config['can_block_policies'])); + } + } /** diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index cdd24a9d15..1db38f8a2b 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -323,7 +323,21 @@ function audit_db ($id, $ip, $accion, $descripcion){ */ function pandora_audit ($accion, $descripcion){ global $config; - $ip = $config["remote_addr"]; + + if (isset($config["remote_addr"])) { + $ip = $config["remote_addr"]; + + } + else { + if ($_SERVER['REMOTE_ADDR']) { + $ip = $_SERVER['REMOTE_ADDR']; + } + else { + $ip = null; + } + } + + $id = $config["id_user"]; $accion = safe_input($accion); diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index e83284fe46..f20115e50a 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -664,7 +664,7 @@ function update_networkmap ($id_networkmap, $values) {