From bbbddf2fff07d372a52a4dedfcec598d356b6932 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Mon, 13 Jul 2015 15:59:08 +0200 Subject: [PATCH 01/29] Acces to non-privilege user to planned downtime --- .../agentes/planned_downtime.export_csv.php | 2 +- .../godmode/agentes/planned_downtime.list.php | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.export_csv.php b/pandora_console/godmode/agentes/planned_downtime.export_csv.php index bf7785c4fd..efb349caeb 100644 --- a/pandora_console/godmode/agentes/planned_downtime.export_csv.php +++ b/pandora_console/godmode/agentes/planned_downtime.export_csv.php @@ -22,7 +22,7 @@ require_once ("../../include/functions_users.php"); require_once ("../../include/functions_groups.php"); $config["id_user"] = $_SESSION["id_usuario"]; -if (! check_acl ($config['id_user'], 0, "AW")) { +if (! check_acl ($config['id_user'], 0, "AR")) { db_pandora_audit("ACL Violation", "Trying to access downtime scheduler"); require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index f2cb14e0ba..1bc398859a 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -18,7 +18,7 @@ global $config; check_login(); -if (! check_acl ($config['id_user'], 0, "AW")) { +if (! check_acl ($config['id_user'], 0, "AR")) { db_pandora_audit("ACL Violation", "Trying to access downtime scheduler"); require ("general/noaccess.php"); @@ -541,9 +541,11 @@ else { if ($downtime["executed"] == 0) { $data[8] = '' . html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; - $data[9] = '' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); + if (check_acl ($config['id_user'], 0, "AW")) { + $data[9] = '' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); + } } elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once') { @@ -580,8 +582,10 @@ else { "location.href='godmode/agentes/planned_downtime.export_csv.php?$filter_params_str'", 'class="sub next"'); echo ''; echo ' '; - echo '
'; - html_print_submit_button (__('Create'), 'create', false, 'class="sub next"'); + if (check_acl ($config['id_user'], 0, "AW")) { + echo ''; + html_print_submit_button (__('Create'), 'create', false, 'class="sub next"'); + } echo '
'; echo ''; } From 8906e050ae273b454e43543e4d9754d0eb0197ae Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Mon, 13 Jul 2015 18:03:16 +0200 Subject: [PATCH 02/29] Change permissions to a non-privilege user in planned-downtimes-acl Ticket #2404 --- .../godmode/agentes/planned_downtime.list.php | 68 ++++++++++++------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 1bc398859a..51828cccb0 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -528,38 +528,56 @@ else { array ('width' => 20, 'height' => 20, 'alt' => __('Not executed'))); } - if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { + //If user have writting permissions + if ( check_acl ($config['id_user'], 0, "AW")) { + if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { + + $data[7] .= '
' . + html_print_image("images/cancel.png", true, array("border" => '0', "alt" => __('Stop downtime'))); + } + else { + $data[7] = ""; + } - $data[7] .= '' . - html_print_image("images/cancel.png", true, array("border" => '0', "alt" => __('Stop downtime'))); + if ($downtime["executed"] == 0) { + $data[8] = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; + if (check_acl ($config['id_user'], 0, "AW")) { + $data[9] = '' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); + } + } + elseif ($downtime["executed"] == 1 + && $downtime['type_execution'] == 'once') { + + $data[8] = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; + $data[9]= "N/A"; + } + else { + $data[8]= "N/A"; + $data[9]= "N/A"; + } } - else { - $data[7] = ""; - } - - if ($downtime["executed"] == 0) { - $data[8] = '' . - html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; - if (check_acl ($config['id_user'], 0, "AW")) { - $data[9] = '' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); + else{ + if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { + $data[7] .= ''; } } elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once') { - $data[8] = '' . - html_print_image("images/config.png", true, - array("border" => '0', "alt" => __('Update'))) . ''; - $data[9]= "N/A"; - } - else { - $data[8]= "N/A"; - $data[9]= "N/A"; - + if ($downtime["executed"] == 0) { + $data[8] = ''; + $data[9] = ''; + } + elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once') { + $data[8] = ''; + $data[9]= ''; + } } if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) { From 595ffe8f5c9d57818b7df0d75e821b07f26e4f03 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Tue, 14 Jul 2015 12:10:46 +0200 Subject: [PATCH 03/29] Planned downtime list changed. Ticket #2404 --- pandora_console/godmode/agentes/planned_downtime.list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 51828cccb0..347ad6b048 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -444,6 +444,9 @@ else { ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset); + $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); + $groupsAW = array_keys($groupsAW); + foreach ($downtimes as $downtime) { $data = array(); $total = db_get_sql ("SELECT COUNT(id_agent) @@ -528,8 +531,9 @@ else { array ('width' => 20, 'height' => 20, 'alt' => __('Not executed'))); } + $downtimeGroup = $downtime['id_group']; //If user have writting permissions - if ( check_acl ($config['id_user'], 0, "AW")) { + if ( in_array($downtimeGroup, $groupsAW) ){ if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { $data[7] .= '= '".date('d', strtotime($date_to))."')"; + $periodically_monthly_w = "type_periodicity = 'monthly' + AND ((periodically_day_from <= '".date('d', strtotime($date_from))."' AND periodically_day_to >= '".date('d', strtotime($date_to))."') + OR (periodically_day_from > periodically_day_to + AND (periodically_day_from <= '".date('d', strtotime($date_from))."' OR periodically_day_to >= '".date('d', strtotime($date_to))."')))"; $periodically_weekly_days = array(); $date_from_aux = strtotime($date_from); From 12334a3cd185541a78a79abb3fdecc4a38e77d67 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Tue, 14 Jul 2015 16:15:04 +0200 Subject: [PATCH 05/29] Planned downtime list and edit changed. Ticket #2404 --- .../godmode/agentes/planned_downtime.editor.php | 11 ++++++++++- .../godmode/agentes/planned_downtime.list.php | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 02dfa70f5a..c0ae46623a 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -557,6 +557,14 @@ if ($id_downtime > 0) { $filter_group = get_parameter("filter_group", 0); + $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); + $groupsAW = array_keys($groupsAW); + $id_groups_list = implode(",", $groupsAW); + + if (empty($id_groups_list)){ + $id_groups_list = -1; + } + $filter_cond = ''; if ($filter_group > 0) $filter_cond = " AND id_grupo = $filter_group "; @@ -569,7 +577,8 @@ if ($id_downtime > 0) { WHERE tplanned_downtime_agents.id_agent = tagente.id_agente AND tplanned_downtime_agents.id_downtime = %d ) AND disabled = 0 $filter_cond - ORDER by tagente.nombre", $id_downtime); + AND tagente.id_grupo IN (%s) + ORDER by tagente.nombre", $id_downtime, $id_groups_list); $downtimes = db_get_all_rows_sql ($sql); $data = array (); if ($downtimes) { diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 347ad6b048..5d7794ec6f 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -447,6 +447,10 @@ else { $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); $groupsAW = array_keys($groupsAW); + if (empty($groupsAW)){ + $groupsAW = -1; + } + foreach ($downtimes as $downtime) { $data = array(); $total = db_get_sql ("SELECT COUNT(id_agent) From 52619f4e7c64995131245e9f94fe30b1a5aa9048 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Tue, 14 Jul 2015 18:34:08 +0200 Subject: [PATCH 06/29] Planned downtime editor changed. Ticket #2404 --- .../godmode/agentes/planned_downtime.editor.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index c0ae46623a..1945f6a7b1 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -81,8 +81,6 @@ $id_agent = (int) get_parameter ('id_agent'); $insert_downtime_agent = (int) get_parameter ('insert_downtime_agent'); $delete_downtime_agent = (int) get_parameter ('delete_downtime_agent'); -$groups = users_get_groups (); - // INSERT A NEW DOWNTIME_AGENT ASSOCIATION if ($insert_downtime_agent === 1) { $agents = (array) get_parameter ('id_agents'); @@ -356,10 +354,14 @@ if ($id_downtime > 0) { break; } + $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); + $groupsAW = array_keys($groupsAW); + $result = db_get_row_sql ($sql); $name = (string) $result["name"]; $id_group = (int) $result['id_group']; + $description = (string) $result["description"]; $type_downtime = (string) $result['type_downtime']; @@ -385,6 +387,13 @@ if ($id_downtime > 0) { $sunday = (bool) $result['sunday']; $executed = (bool) $result['executed']; + + if ( !in_array($id_group, $groupsAW) ){ + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } } // when the planned down time is in execution, only action to postpone on once type is enabled and the other are disabled. From ff5e786a5f0c3d08a0e2141bd1f921013181ac6f Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 15 Jul 2015 16:08:20 +0200 Subject: [PATCH 07/29] Fixed some count functions and improvments on other functions --- pandora_console/include/functions_tags.php | 125 ++++++++++++--------- 1 file changed, 71 insertions(+), 54 deletions(-) diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index b348233210..1fab02220c 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -25,59 +25,62 @@ * @param string $tag_name_description Name or description of the tag that it's currently searched. * @param array $filter Array with pagination parameters. * @param bool $only_names Whether to return only names or all fields. + * @param bool $count To return the number of items. * * @return mixed Returns an array with the tag selected by name or false. + * When the count parameter is enabled, returns an integer. */ -function tags_search_tag ($tag_name_description = false, $filter = false, $only_names = false) { +function tags_search_tag ($tag_name_description = false, $filter = false, $only_names = false, $count = false) { global $config; + if ($filter === false) + $filter = array(); + + if (isset($filter['name'])) { + if (empty($tag_name_description)) + $tag_name_description = $filter['name']; + unset($filter['name']); + } + if ($tag_name_description) { switch ($config["dbtype"]) { case "mysql": - $sql = 'SELECT * - FROM ttag - WHERE ((name COLLATE utf8_general_ci LIKE "%'. $tag_name_description .'%") OR - (description COLLATE utf8_general_ci LIKE "%'. $tag_name_description .'%")) ORDER BY name'; + $filter[] = '((name COLLATE utf8_general_ci LIKE "%'. $tag_name_description .'%") OR + (description COLLATE utf8_general_ci LIKE "%'. $tag_name_description .'%"))'; break; case "postgresql": - $sql = 'SELECT * - FROM ttag - WHERE ((name COLLATE utf8_general_ci LIKE \'%'. $tag_name_description .'%\') OR - (description COLLATE utf8_general_ci LIKE \'%'. $tag_name_description .'%\')) ORDER BY name'; + $filter[] = '((name LIKE \'%'. $tag_name_description .'%\') OR + (description LIKE \'%'. $tag_name_description .'%\'))'; break; case "oracle": - $sql = 'SELECT * - FROM ttag - WHERE (UPPER(name) LIKE UPPER (\'%'. $tag_name_description .'%\') OR - UPPER(dbms_lob.substr(description, 4000, 1)) LIKE UPPER (\'%'. $tag_name_description .'%\')) ORDER BY name'; + $filter[] = '(UPPER(name) LIKE UPPER (\'%'. $tag_name_description .'%\') OR + UPPER(dbms_lob.substr(description, 4000, 1)) LIKE UPPER (\'%'. $tag_name_description .'%\'))'; break; } } - else { - $sql = 'SELECT * FROM ttag ORDER BY name'; + + // Default order + set_unless_defined($filter['order'], 'name'); + + $fields = '*'; + if ($only_names) { + $fields = array('id_tag', 'name'); } - if ($filter !== false) { - switch ($config["dbtype"]) { - case "mysql": - $result = db_get_all_rows_sql ($sql . ' LIMIT ' . $filter['offset'] . ',' . $filter['limit']); - break; - case "postgresql": - $result = db_get_all_rows_sql ($sql . ' OFFSET ' . $filter['offset'] . ' LIMIT ' . $filter['limit']); - break; - case "oracle": - $result = oracle_recode_query ($sql, $filter, 'AND', false); - if ($components != false) { - for ($i=0; $i < count($components); $i++) { - unset($result[$i]['rnum']); - } - } - break; - } - } - else { - $result = db_get_all_rows_sql ($sql); + + // It will return the count + if ($count) { + unset($filter['order']); + unset($filter['limit']); + unset($filter['offset']); + + if (!empty($filter)) + return (int) db_get_value_filter('COUNT(id_tag)', 'ttag', $filter); + else + return (int) db_get_value('COUNT(id_tag)', 'ttag'); } + $result = db_get_all_rows_filter('ttag', $filter, $fields); + if ($result === false) $result = array(); @@ -172,11 +175,11 @@ function tags_get_url($id) { * * @param array $id Int with tag id info. * - * @return mixed Int with the tag's count or false. + * @return int Tag's count. */ -function tags_get_modules_count($id) { - $num_modules = (int)db_get_value_filter('count(*)', 'ttag_module', array('id_tag' => $id)); - $num_policy_modules = (int)db_get_value_filter('count(*)', 'ttag_policy_module', array('id_tag' => $id)); +function tags_get_modules_count ($id) { + $num_modules = tags_get_local_modules_count($id); + $num_policy_modules = tags_get_policy_modules_count($id); return $num_modules + $num_policy_modules; } @@ -186,23 +189,29 @@ function tags_get_modules_count($id) { * * @param array $id Int with tag id info. * - * @return mixed Int with the tag's count or false. + * @return int Local module tag's count. */ -function tags_get_local_modules_count($id) { - $num_modules = (int)db_get_value_filter('count(*)', 'ttag_module', array('id_tag' => $id)); +function tags_get_local_modules_count ($id) { + $field = 'COUNT(id_tag)'; + $filter = array('id_tag' => $id); + + $num_modules = (int) db_get_value_filter($field, 'ttag_module', $filter); return $num_modules; } /** - * Get tag's local module count. + * Get module tag's count. * - * @param array $id Int with tag id info. + * @param array $id Int with agent module id info. * - * @return mixed Int with the tag's count or false. + * @return int Module tag's count. */ -function tags_get_modules_tag_count($id) { - $num_modules = (int)db_get_value_filter('count(*)', 'ttag_module', array('id_agente_modulo' => $id)); +function tags_get_modules_tag_count ($id) { + $field = 'COUNT(id_agente_modulo)'; + $filter = array('id_agente_modulo' => $id); + + $num_modules = (int) db_get_value_filter($field, 'ttag_module', $filter); return $num_modules; } @@ -212,16 +221,17 @@ function tags_get_modules_tag_count($id) { * * @param array $id Int with tag id info. * - * @return mixed Int with the tag's count or false. + * @return int Policy module tag's count. */ -function tags_get_policy_modules_count($id) { - $num_policy_modules = (int)db_get_value_filter('count(*)', 'ttag_policy_module', array('id_tag' => $id)); +function tags_get_policy_modules_count ($id) { + $field = 'COUNT(id_tag)'; + $filter = array('id_tag' => $id); + + $num_policy_modules = (int) db_get_value_filter($field, 'ttag_policy_module', $filter); return $num_policy_modules; } - - /** * Updates a tag by id. * @@ -278,8 +288,15 @@ function tags_remove_tag($id_tag, $id_module) { * * @return mixed Int with the tag's count. */ -function tags_get_tag_count() { - return (int)db_get_value('count(*)', 'ttag'); +function tags_get_tag_count($filter = false) { + + $tag_name = false; + if (isset($filter['name'])) { + $tag_name = $filter['name']; + unset($filter['name']); + } + + return tags_search_tag($tag_name, $filter, false, true); } /** From df50d6e343a26ff1f43e0f8c75ced3fb962cff95 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 15 Jul 2015 16:09:07 +0200 Subject: [PATCH 08/29] Fixed the tags and module tags counters on the metaconsole and many more Like the ui when a user search does not return items. --- pandora_console/godmode/tag/tag.php | 254 +++++++++++++++++----------- 1 file changed, 152 insertions(+), 102 deletions(-) diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index b4a1c38534..1b2fc0afe6 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -19,8 +19,6 @@ global $config; // Check login and ACLs check_login (); -enterprise_hook('open_meta_frame'); - if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { db_pandora_audit("ACL Violation", "Trying to access Tag Management"); require ("general/noaccess.php"); @@ -32,12 +30,20 @@ require_once ($config['homedir'].'/include/functions_tags.php'); // Get parameters $delete = (int) get_parameter ("delete_tag", 0); -$search = (int) get_parameter ("search_tag", 0); $tag_name = (string) get_parameter ("tag_name",""); $tab = (string) get_parameter ("tab", "list"); +// Metaconsole nodes +$servers = false; +if (is_metaconsole()) { + enterprise_include_once('include/functions_metaconsole.php'); + $servers = metaconsole_get_servers(); +} + //Ajax tooltip to deploy module's count info of a tag. if (is_ajax ()) { + ob_clean(); + $get_tag_tooltip = (bool) get_parameter ('get_tag_tooltip', 0); if ($get_tag_tooltip) { @@ -46,19 +52,43 @@ if (is_ajax ()) { if ($tag === false) return; + $local_modules_count = 0; + if (is_metaconsole() && !empty($servers)) { + $local_modules_count = array_reduce($servers, function($counter, $server) use ($id_tag) { + if (metaconsole_connect($server) === NOERR) + $counter += tags_get_local_modules_count($id_tag); + return $counter; + }, 0); + } + else { + $local_modules_count = tags_get_local_modules_count($id_tag); + } + + $policy_modules_count = 0; + if (is_metaconsole() && !empty($servers)) { + $policy_modules_count = array_reduce($servers, function($counter, $server) use ($id_tag) { + if (metaconsole_connect($server) === NOERR) + $counter += tags_get_policy_modules_count($id_tag); + return $counter; + }, 0); + } + else { + $policy_modules_count = tags_get_policy_modules_count($id_tag); + } + echo '

'.$tag['name'].'

'; - echo ''.__('Number of modules').': ' . - tags_get_local_modules_count($id_tag); + echo ''.__('Number of modules').': ' . $local_modules_count; echo '
'; - echo ''.__('Number of policy modules').': ' . - tags_get_policy_modules_count($id_tag); + echo ''.__('Number of policy modules').': ' . $policy_modules_count; return; } return; } -if (defined('METACONSOLE')) +enterprise_hook('open_meta_frame'); + +if (is_metaconsole()) $sec = 'advanced'; else $sec = 'gmodules'; @@ -71,20 +101,15 @@ $buttons = array( $buttons[$tab]['active'] = true; -if (defined('METACONSOLE')) { - +if (is_metaconsole()) { // Print header ui_meta_print_header(__('Tags'), "", $buttons); - } else { - // Header ui_print_page_header (__('Tags configuration'), "images/tag.png", false, "tags_config", true, $buttons); - } - // Two actions can performed in this page: search and delete tags // Delete action: This will delete a tag @@ -101,59 +126,54 @@ if ($delete != 0) { } } -// statements for pagination -$url = ui_get_url_refresh (); -$total_tags = tags_get_tag_count(); +// Search action: This will filter the display tag view +$filter = array(); +// Filtered view? +if (!empty($tag_name)) { + $filter['name'] = $tag_name; +} + +// If the user has filtered the view +$filter_performed = !empty($filter); $filter['offset'] = (int) get_parameter ('offset'); $filter['limit'] = (int) $config['block_size']; -// Search action: This will filter the display tag view -$result = false; -// Filtered view? -if ($search != 0) { - $result = tags_search_tag($tag_name, $filter); -} -else { - $result = tags_search_tag(false, $filter); -} + +// statements for pagination +$url = ui_get_url_refresh (); +$total_tags = tags_get_tag_count($filter); + +$result = tags_search_tag(false, $filter); + +// Filter form +$table = new StdClass(); +$table->class = 'databox filters'; +$table->width = '100%'; +$table->data = array(); + +$row = array(); + +$name_input = __("Name") . " / " . __("Description"); +$name_input .= "  "; +$name_input .= html_print_input_text ('tag_name', $tag_name, '', 30, 255, true); +$row[] = $name_input; + +$filter_button = html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"',true); +$row[] = $filter_button; + +$table->data[] = $row; + +$filter_form = '
'; +$filter_form .= html_print_table($table, true); +$filter_form .= "
"; +// End of filter form if (!empty($result)) { - // Form to add new tags or search tags - if (!defined('METACONSOLE')) { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "
"; - echo '' . __("Name") . "/" . __("Description") . ''; - echo ""; - echo '
'; - html_print_input_hidden ("search_tag", "1"); - html_print_input_text ('tag_name', $tag_name, '', 30, 255, false); - echo "   "; - html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"'); - echo "
"; - echo "
"; + if (!is_metaconsole()) { + echo $filter_form; } else { - - $filters = '
'; - $filters .= ""; - $filters .= ""; - $filters .= ""; - $filters .= ""; - $filters .= ""; - $filters .= "
"; - $filters .= __("Name") . "/" . __("Description"); - $filters .= "  "; - $filters .= html_print_input_hidden ("search_tag", "1",true); - $filters .= html_print_input_text ('tag_name', $tag_name, '', 30, 255, true); - $filters .= ""; - $filters .= html_print_submit_button (__('Filter'), 'filter_button', false, 'class="sub search"',true); - $filters .= "
"; - $filters .= "
"; - ui_toggle($filters, __("Show Options")); + ui_toggle($filter_form, __("Show Options")); } // Prepare pagination @@ -162,8 +182,6 @@ if (!empty($result)) { // Display tags previously filtered or not $rowPair = true; $iterator = 0; - - $table = new stdClass(); $table->width = '100%'; @@ -199,11 +217,27 @@ if (!empty($result)) { $data[0] = "
" . $tag["name"] . ""; $data[1] = ui_print_truncate_text($tag["description"], 'description', false); $data[2] = '' . $tag["url"] . ''; - $data[3] = ' ' . - html_print_image("images/zoom.png", true, array("id" => 'tag-details-'.$tag['id_tag'], "class" => "img_help")) . ' '; - $data[3] .= tags_get_modules_count($tag["id_tag"]); + // The tooltip needs a title on the item, don't delete the title + $data[3] = '' . + html_print_image("images/zoom.png", true) . ' '; + + $modules_count = 0; + if (is_metaconsole() && !empty($servers)) { + $tag_id = $tag['id_tag']; + $modules_count = array_reduce($servers, function($counter, $server) use ($tag_id) { + if (metaconsole_connect($server) === NOERR) + $counter += tags_get_modules_count($tag_id); + + return $counter; + }, 0); + } + else { + $modules_count = tags_get_modules_count($tag["id_tag"]); + } + + $data[3] .= $modules_count; $email_large = io_safe_output($tag["email"]); $email_small = substr($email_large,0, 24); @@ -242,15 +276,20 @@ if (!empty($result)) { html_print_table ($table); } -else{ - if(!defined("METACONSOLE")){ - require_once ($config['homedir'] . "/general/firts_task/tags.php"); +else { + if (is_metaconsole()) { + ui_toggle($filter_form, __("Show Options")); + ui_print_info_message(array("no_close" => true, "message" => __("No tags defined"))); + } + else if ($filter_performed) { + echo $filter_form; + } + else { + require ($config['homedir'] . "/general/firts_task/tags.php"); return; } - else{ - ui_print_info_message(array("no_close"=>true,"message"=>__("No tags defined."))); - } } + echo ""; echo ""; echo "
"; @@ -265,44 +304,55 @@ echo "
"; enterprise_hook('close_meta_frame'); -ui_require_css_file ('cluetip'); -ui_require_jquery_file ('cluetip'); - ?> - From a85edf061e8e2fe3d0ab6dde10e4ad518f9d2113 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 15 Jul 2015 16:53:51 +0200 Subject: [PATCH 09/29] Fixed the format of the decimal and the thousands marker for the numeric fields --- pandora_console/include/db/oracle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/db/oracle.php b/pandora_console/include/db/oracle.php index 1f73131ad2..745daa7a67 100644 --- a/pandora_console/include/db/oracle.php +++ b/pandora_console/include/db/oracle.php @@ -43,7 +43,7 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $datetime_tz_format = oci_parse($connect_id , 'alter session set NLS_TIMESTAMP_TZ_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); $datetime_format = oci_parse($connect_id , 'alter session set NLS_TIMESTAMP_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); $date_format = oci_parse($connect_id , 'alter session set NLS_DATE_FORMAT =\'YYYY-MM-DD HH24:MI:SS\''); - $decimal_separator = oci_parse($connect_id , 'alter session set NLS_NUMERIC_CHARACTERS =\',.\''); + $decimal_separator = oci_parse($connect_id , 'alter session set NLS_NUMERIC_CHARACTERS =\'.,\''); oci_execute($datetime_tz_format); oci_execute($datetime_format); From 05f40a21fcdd6cf3d6f0d0eec94a51c5e912ffc5 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 15 Jul 2015 16:55:08 +0200 Subject: [PATCH 10/29] Now the data column of the module's raw data dialog are casted to double when is numeric --- pandora_console/include/ajax/module.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index a4360c388b..98a9a8ab6c 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -57,7 +57,7 @@ if ($get_agent_modules_json_for_multiple_agents) { $result = array(); - if (defined("METACONSOLE")) { + if (is_metaconsole()) { $rows = db_get_all_rows_filter('tmetaconsole_agent', array("id_tagente" => $idAgents), @@ -194,7 +194,7 @@ if ($get_module_detail) { $agentId = (int) get_parameter("id_agent"); $server_name = (string) get_parameter('server_name'); - if (defined ('METACONSOLE')) { + if (is_metaconsole()) { $server = metaconsole_get_connection ($server_name); if (metaconsole_connect($server) != NOERR) @@ -381,10 +381,15 @@ if ($get_module_detail) { else { // Just a string of alphanumerical data... just do print //Fixed the data from Selenium Plugin - if ($row[$attr[0]] != strip_tags($row[$attr[0]])) + if ($row[$attr[0]] != strip_tags($row[$attr[0]])) { $data[] = io_safe_input($row[$attr[0]]); - else + } + else if (is_numeric($row[$attr[0]])) { + $data[] = (double) $row[$attr[0]]; + } + else { $data[] = $row[$attr[0]]; + } } } @@ -401,7 +406,7 @@ if ($get_module_detail) { html_print_table($table); } - if (defined ('METACONSOLE')) + if (is_metaconsole()) metaconsole_restore_db(); return; From 04b6621da54166c6f60f1dc517479aca5d27bb49 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 15 Jul 2015 18:15:30 +0200 Subject: [PATCH 11/29] Now the recon task editor avoid edit the ipam recons. TICKET: #2428 --- .../godmode/servers/manage_recontask_form.php | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/pandora_console/godmode/servers/manage_recontask_form.php b/pandora_console/godmode/servers/manage_recontask_form.php index ed940cd1fc..d213efadbb 100644 --- a/pandora_console/godmode/servers/manage_recontask_form.php +++ b/pandora_console/godmode/servers/manage_recontask_form.php @@ -121,6 +121,9 @@ if (isset($_GET["update"]) || (isset($_GET["crt"]))) { $parent_detection = $row["parent_detection"]; $parent_recursion = $row["parent_recursion"]; $macros = $row["macros"]; + + $name_script = db_get_value('name', + 'trecon_script', 'id_recon_script', $id_recon_script); } } elseif (isset($_GET["create"]) || isset($_GET["crt"])) { @@ -217,7 +220,7 @@ $table->data[2][1] = html_print_select ($fields, "mode", $mode, '', '', 0, true) // Network -$table->data[3][0] = "".__('Network'); +$table->data[3][0] = "" . __('Network') . ""; $table->data[3][1] = html_print_input_text ('network', $network, '', 25, 0, true); // Interval @@ -236,7 +239,7 @@ $table->data[4][1] .= ''; // Module template -$table->data[5][0] = "".__('Module template'); +$table->data[5][0] = "" . __('Module template') . ""; $sql = 'SELECT id_np, name FROM tnetwork_profile @@ -245,17 +248,23 @@ $table->data[5][1] = html_print_select_from_sql ($sql, "id_network_profile", $id // Recon script $data[1] = ''; -$table->data[6][0] = "".__('Recon script'); +$table->data[6][0] = "" . __('Recon script') . ""; $sql = 'SELECT id_recon_script, name FROM trecon_script + WHERE name <> "IPAM Recon" ORDER BY name'; -$table->data[6][1] = html_print_select_from_sql ($sql, "id_recon_script", $id_recon_script, '', '', '', true); -$table->data[6][1] .= ""; -$table->data[6][1] .= $data[1] .= html_print_input_hidden('macros', base64_encode($macros),true); +if ($name_script != "IPAM Recon") { + $table->data[6][1] = html_print_select_from_sql ($sql, "id_recon_script", $id_recon_script, '', '', '', true); + $table->data[6][1] .= ""; + $table->data[6][1] .= $data[1] .= html_print_input_hidden('macros', base64_encode($macros),true); +} +else { + $table->data[6][1] = "IPAM Recon"; +} // OS -$table->data[7][0] = "".__('OS'); +$table->data[7][0] = "" . __('OS') . ""; $sql = 'SELECT id_os, name FROM tconfig_os @@ -263,7 +272,7 @@ $sql = 'SELECT id_os, name $table->data[7][1] = html_print_select_from_sql ($sql, "id_os", $id_os, '', __('Any'), -1, true); // Recon ports -$table->data[8][0] = "".__('Ports'); +$table->data[8][0] = "" . __('Ports') . ""; $table->data[8][1] = html_print_input_text ('recon_ports', $recon_ports, '', 25, 0, true); $table->data[8][1] .= ui_print_help_tip( __('Ports defined like: 80 or 80,443,512 or even 0-1024 (Like Nmap command line format). If dont want to do a sweep using portscan, left it in blank'), true); @@ -346,10 +355,15 @@ $table->data[21][1] = html_print_input_text ('parent_recursion', $parent_recurs echo '
'; html_print_table ($table); echo '
'; -if ($id_rt != -1) - html_print_submit_button (__('Update'), "crt", false, 'class="sub upd"'); -else + +if ($id_rt != -1) { + if ($name_script != "IPAM Recon") { + html_print_submit_button (__('Update'), "crt", false, 'class="sub upd"'); + } +} +else { html_print_submit_button (__('Add'), "crt", false, 'class="sub wand"'); +} echo "
"; echo "
"; From 6d2efe5824bf2a3cc7562353fc12c10a65d4b8cf Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 15 Jul 2015 18:16:48 +0200 Subject: [PATCH 12/29] PandoraAgentWindows: Added latest scripts & configuration (cherry picked from commit 30afa2a1353394c1287f378b1cbc215dfc385374) Conflicts: pandora_agents/win32/bin/pandora_agent.conf --- pandora_agents/win32/bin/pandora_agent.conf | 44 +-- .../win32/bin/util/software_installed.vbs | 83 ++--- pandora_agents/win32/bin/util/win_cf.vbs | 292 ++++++++++++++++++ .../win32/bin/util/win_cf_winxp.vbs | 281 +++++++++++++++++ 4 files changed, 642 insertions(+), 58 deletions(-) create mode 100644 pandora_agents/win32/bin/util/win_cf.vbs create mode 100644 pandora_agents/win32/bin/util/win_cf_winxp.vbs diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 8e5fbc82bb..f4ea2ccb05 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2014 Artica Soluciones Tecnologicas -# Version 6.0dev +# Version 6.0dev # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software @@ -187,94 +187,100 @@ module_end #Antivirus monitoring #This modules checks the antivirus is running on your system, if there is and antivirus #This module gets the last date the signature file was updated and send this date to pandora. -module_begin -module_name Antivirus Last Update -module_type async_string -module_precondition =~ avguard.exe cmd.exe /c tasklist | grep avguard.exe | gawk "{print $1}" -module_exec dir "%ProgramFiles%\Avira\AntiVir Desktop\aevdf.dat" | grep aevdf.dat | gawk "{print $1\" \"$2}" -module_description Last update for Antivirus Signature file -module_end +#module_begin +#module_name Antivirus Last Update +#module_type async_string +#module_precondition =~ avguard.exe cmd.exe /c tasklist | grep avguard.exe | gawk "{print $1}" +#module_exec dir "%ProgramFiles%\Avira\AntiVir Desktop\aevdf.dat" | grep aevdf.dat | gawk "{print $1\" \"$2}" +#module_description Last update for Antivirus Signature file +#module_end + +# Windows inventory module (This information will be displayed only in enterprise version) -# Windows inventory module (This information will be displayed only in enterprise version)^M module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end module_begin -module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\architecture.vbs" +module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\win_cf.vbs" module_crontab * 12-15 * * 1 +module_timeout 50 module_end -module_begin -module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\domain.vbs" -module_crontab * 12-15 * * 1 -module_end - -module_begin -module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\osversion.vbs" -module_crontab * 12-15 * * 1 -module_end # ---------------------------------------------------------------------------------------------------- # This samples below need to be reconfigured and uncommented. Please read documentation diff --git a/pandora_agents/win32/bin/util/software_installed.vbs b/pandora_agents/win32/bin/util/software_installed.vbs index 4317a06732..967aba2798 100644 --- a/pandora_agents/win32/bin/util/software_installed.vbs +++ b/pandora_agents/win32/bin/util/software_installed.vbs @@ -2,7 +2,8 @@ ' (c) 2015 Sancho Lerena ' (c) 2015 Borja Sanchez ' This plugin extends agent inventory feature. Only enterprise version -' -------------------------------------------------------------------------- +' Warning: If the system has the WMI corrupted, call this script with nowmi argument +' ------------------------------------------------------------------------------------ on error resume next Class ObjectList @@ -31,7 +32,7 @@ Class ObjectList End Class class AppClass - dim InstallDate,Caption,Version,Vendor + dim InstallDate,Caption,Version,Vendor end class ' Print the XML structure @@ -43,46 +44,50 @@ Wscript.StdOut.WriteLine "" '------ Checks if an item exists on the main collection function isItemInArray(objeto,coleccion) - for each id in coleccion.List - if (strComp(objeto,coleccion.List(id).caption) = 0) then - isItemInArray=true - exit function - end if - next - isItemInArray=false + for each id in coleccion.List + if (strComp(objeto,coleccion.List(id).caption) = 0) then + isItemInArray=true + exit function + end if + next + isItemInArray=false end function '------ main collection definition dim colObjSW : set colObjSW = new ObjectList strComputer = "." -'------ Retrieve the WMI registers first -Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") -Set colSoftware = objWMIService.ExecQuery ("SELECT installstate,caption,installdate,Version,vendor FROM Win32_Product") +' Disable by arguments WMI queries - corrupted WMI host + +If (not WScript.Arguments(0) = "nowmi") Then + '------ Retrieve the WMI registers first + Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") + Set colSoftware = objWMIService.ExecQuery ("SELECT installstate,caption,installdate,Version,vendor FROM Win32_Product",,48) -'------ Check all -'-- first) add all unique WMI (unique) entries to main collector -'-- second) add all unique REGISTRY items to main collector + '------ Check all + '-- first) add all unique WMI (unique) entries to main collector + '-- second) add all unique REGISTRY items to main collector -for each objSoftware in colSoftware - if ( objSoftware.installstate = 5 ) then - if ( isItemInArray(objSoftware.caption, colObjSW) = false ) then - ' It doesn't exists, added. - With colObjSW.Append(New AppClass) - .caption = objSoftware.caption - .InstallDate = objSoftware.InstallDate - .version = objSoftware.version - .vendor = objSoftware.vendor - End with - ' Add to XML the verified ones - Wscript.StdOut.WriteLine "" - end if - end if -next + for each objSoftware in colSoftware + if ( objSoftware.installstate = 5 ) then + if ( isItemInArray(objSoftware.caption, colObjSW) = false ) then + ' It doesn't exists, added. + With colObjSW.Append(New AppClass) + .caption = objSoftware.caption + .InstallDate = objSoftware.InstallDate + .version = objSoftware.version + .vendor = objSoftware.vendor + End with + ' Add to XML the verified ones + Wscript.StdOut.WriteLine "" + end if + end if + next +End If ' ------ Getting the REGISTRY Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE @@ -123,12 +128,12 @@ For Each strSubkey In arrSubkeys ' foreach registry item, check if exists in the main collector ' it it exists, it doesn't be added. if ( isItemInArray(appname, colObjSW) = false ) then - ' as item doesn't exist, we add it to main collector and to XML - With colObjSW.Append(New AppClass) - .caption = appname - .version = appversion - End with - Wscript.StdOut.WriteLine "" + ' as item doesn't exist, we add it to main collector and to XML + With colObjSW.Append(New AppClass) + .caption = appname + .version = appversion + End with + Wscript.StdOut.WriteLine "" end if end if next diff --git a/pandora_agents/win32/bin/util/win_cf.vbs b/pandora_agents/win32/bin/util/win_cf.vbs new file mode 100644 index 0000000000..08c85b0339 --- /dev/null +++ b/pandora_agents/win32/bin/util/win_cf.vbs @@ -0,0 +1,292 @@ +' Pandora FMS Agent Custom Field Plugin for Microsoft Windows (All platfforms) +' (c) 2015 Borja Sanchez +' This plugin extends agent inventory feature. Only enterprise version +' ------------------------------------------- +' Custom fields information generator +' +' Basic structure: +' +' +' +' +' +' +' +' -------------------------------------------------------------------------- +' Custom Fields: Windows Agent + +' SET CORRECT BASE_DIR!! +Set WshShell = WScript.CreateObject("WScript.Shell") +AGENT_HOME_DIR = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%") & "\pandora_agent\" + +Function BASE_DIR (subitem) + BASE_DIR = chr(34) & AGENT_HOME_DIR & subitem & chr(34) +End Function + +randomize + +strComputer = "." +Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") + +'--------------------------------------------------------------------- +' Parses the pandora_agent configuration file to extract the +' fields agent_name, parent_agent_name and group +'--------------------------------------------------------------------- +Sub parse_conf_file () + + If WScript.Arguments.Count = 0 Then + pandora_agent_base_path = AGENT_HOME_DIR + Else + pandora_agent_base_path = WScript.Arguments(0) + End If + + Set objFSO = CreateObject("Scripting.FileSystemObject") + + If (Not objFSO.FileExists(pandora_agent_base_path & "pandora_agent.conf" ) ) Then + Exit Sub + End If + + Set objFile = objFSO.OpenTextFile(pandora_agent_base_path & "pandora_agent.conf", 1) + + name_flag = 1 + do until objFile.AtEndOfStream + + '"agent_name", "agent_name" + '"parent", "parent_agent_name" + '"group", "group" + line = objFile.ReadLine + If (Not "#" = Left(line, 1) ) Then + + lc = InStr(4, line," ") + If (lc > 0 ) Then + field = Left(line, lc -1) + value = Mid(line, lc +1, Len(line)) + + Select Case field + Case "agent_name" + If (Not value = "") Then + Wscript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + name_flag = 0 + End If + + Case "parent_agent_name","group" + Wscript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + End Select + End If + End If + loop + + If (name_flag = 1) Then + + Wscript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + Set cols = objWMIService.ExecQuery("SELECT caption FROM Win32_ComputerSystem") + + on error resume next + flag = cols.Count + If (err.number <> 0) Then + flag = true + Else + flag = false + End If + on error goto 0 + + If (NOT flag) Then + For Each data In cols + Wscript.StdOut.WriteLine "" + Next + End If + Wscript.StdOut.WriteLine "" + End If + + objFile.Close + + If objFSO.FileExists(OUT_FILE) Then + objFSO.DeleteFile OUT_FILE + End If + +End Sub + + + +' FILE STARTS +WScript.StdOut.WriteLine "" + +'-------------------------------- +' Custom Field: os_version +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT version from win32_operatingsystem") + +For Each data In cols + Wscript.StdOut.WriteLine "" +Next + +Wscript.StdOut.WriteLine "" +'-------------------------------- + + +'-------------------------------- +' Custom Field: Domain +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT Domain FROM Win32_ComputerSystem") + +For Each data In cols + Wscript.StdOut.WriteLine "" +Next + +Wscript.StdOut.WriteLine "" +'-------------------------------- + + + +'-------------------------------- +' Custom Field: Architecture +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT osarchitecture FROM Win32_OperatingSystem") + +on error resume next +flag = cols.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + + +If flag Then + Wscript.StdOut.WriteLine "" +Else + For Each data In cols + If ( NOT IsNull(data.osarchitecture) ) Then + Wscript.StdOut.WriteLine "" + Else + Wscript.StdOut.WriteLine "" + End If + Next +End If + + +Wscript.StdOut.WriteLine "" +'-------------------------------- + + +'-------------------------------- +' Extract info +'-------------------------------- +parse_conf_file +'-------------------------------- + + +'---------------------------------------------------- +' Custom Field: IP, IPv6 AND MAC -> XXX First found. +'---------------------------------------------------- +Set cols = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter " & _ + "Where not PNPDeviceID like 'ROOT%%' " & _ + "and not PNPDeviceID like 'SW%%' " & _ + "and not ServiceName is null " & _ + "and not ServiceName like 'vwifimp' ") +on error resume next +flag = cols.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + + +If (NOT flag) Then + For Each iface In cols + ' return model MACAddress IPAddress + set ifaces_cfg = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'") + for each iface_cfg in ifaces_cfg + if ( NOT IsNull(iface_cfg.IPAddress) ) then + on error resume next + IP = trim(iface_cfg.IPAddress(0)) + If ( err.number <> 0 ) Then + IP = NULL + End If + MAC = iface.MACAddress + If ( err.number <> 0 ) Then + MAC = NULL + End If + IPv6 = trim(iface_cfg.IPAddress(1)) + If ( err.number <> 0 ) Then + IPv6 = NULL + End If + on error goto 0 + end if + next + Next +End If +If (NOT IsNull(IP)) Then + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" +End If + +If (NOT IsNull(IPv6)) Then + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" +End If + +If (NOT IsNull(MAC)) Then + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" +End If + +'-------------------------------- + + +'-------------------------------- +' Custom Field: Hostname +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT caption FROM Win32_ComputerSystem") + +on error resume next +flag = cols.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + +If (NOT flag) Then + For Each data In cols + Wscript.StdOut.WriteLine "" + Next +End If + +Wscript.StdOut.WriteLine "" + + +'-------------------------------- + +WScript.StdOut.WriteLine "" + +' FILE ENDS diff --git a/pandora_agents/win32/bin/util/win_cf_winxp.vbs b/pandora_agents/win32/bin/util/win_cf_winxp.vbs new file mode 100644 index 0000000000..662e14fc88 --- /dev/null +++ b/pandora_agents/win32/bin/util/win_cf_winxp.vbs @@ -0,0 +1,281 @@ +' Pandora FMS Agent Custom Field Plugin for Microsoft Windows Xp +' (c) 2015 Borja Sanchez +' This plugin extends agent inventory feature. Only enterprise version +' ------------------------------------------- +' Custom fields information generator +' +' Basic structure: +' +' +' +' +' +' +' +' -------------------------------------------------------------------------- +' Custom Fields: Windows Agent + +' SET CORRECT BASE_DIR!! +Set WshShell = WScript.CreateObject("WScript.Shell") +AGENT_HOME_DIR = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%") & "\pandora_agent\" + +Function BASE_DIR (subitem) + BASE_DIR = chr(34) & AGENT_HOME_DIR & subitem & chr(34) +End Function + +randomize + +strComputer = "." +Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") + +'--------------------------------------------------------------------- +' Parses the pandora_agent configuration file to extract the +' fields agent_name, parent_agent_name and group +'--------------------------------------------------------------------- +Sub parse_conf_file () + + If WScript.Arguments.Count = 0 Then + pandora_agent_base_path = AGENT_HOME_DIR + Else + pandora_agent_base_path = WScript.Arguments(0) + End If + + Set objFSO = CreateObject("Scripting.FileSystemObject") + + If (Not objFSO.FileExists(pandora_agent_base_path & "pandora_agent.conf" ) ) Then + Exit Sub + End If + + Set objFile = objFSO.OpenTextFile(pandora_agent_base_path & "pandora_agent.conf", 1) + + name_flag = 1 + do until objFile.AtEndOfStream + + '"agent_name", "agent_name" + '"parent", "parent_agent_name" + '"group", "group" + line = objFile.ReadLine + If (Not "#" = Left(line, 1) ) Then + + lc = InStr(4, line," ") + If (lc > 0 ) Then + field = Left(line, lc -1) + value = Mid(line, lc +1, Len(line)) + + Select Case field + Case "agent_name" + If (Not value = "") Then + Wscript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + name_flag = 0 + End If + + Case "parent_agent_name","group" + Wscript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + End Select + End If + End If + loop + + If (name_flag = 1) Then + + Wscript.StdOut.WriteLine "" + Wscript.StdOut.WriteLine "" + Set cols = objWMIService.ExecQuery("SELECT caption FROM Win32_ComputerSystem") + + on error resume next + flag = cols.Count + If (err.number <> 0) Then + flag = true + Else + flag = false + End If + on error goto 0 + + If (NOT flag) Then + For Each data In cols + Wscript.StdOut.WriteLine "" + Next + End If + Wscript.StdOut.WriteLine "" + End If + + objFile.Close + + If objFSO.FileExists(OUT_FILE) Then + objFSO.DeleteFile OUT_FILE + End If + +End Sub + + + +' FILE STARTS +WScript.StdOut.WriteLine "" + +'-------------------------------- +' Custom Field: os_version +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT version from win32_operatingsystem") + +For Each data In cols + Wscript.StdOut.WriteLine "" +Next + +Wscript.StdOut.WriteLine "" +'-------------------------------- + + +'-------------------------------- +' Custom Field: Domain +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT Domain FROM Win32_ComputerSystem") + +For Each data In cols + Wscript.StdOut.WriteLine "" +Next + +Wscript.StdOut.WriteLine "" +'-------------------------------- + + + +'-------------------------------- +' Custom Field: Architecture +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT osarchitecture FROM Win32_OperatingSystem") + +on error resume next +flag = cols.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + + +If flag Then + Wscript.StdOut.WriteLine "" +Else + For Each data In cols + If ( NOT IsNull(data.osarchitecture) ) Then + Wscript.StdOut.WriteLine "" + Else + Wscript.StdOut.WriteLine "" + End If + Next +End If + + +Wscript.StdOut.WriteLine "" +'-------------------------------- + + +'-------------------------------- +' Extract info +'-------------------------------- +parse_conf_file +'-------------------------------- + + +'---------------------------------------------------- +' Custom Field: IP, IPv6 AND MAC -> XXX First found. +'---------------------------------------------------- +Set cols = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter " & _ + "Where not PNPDeviceID like 'ROOT%%' " & _ + "and not PNPDeviceID like 'SW%%' " & _ + "and not ServiceName is null " & _ + "and not ServiceName like 'vwifimp' ") +on error resume next +flag = cols.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + + +If (NOT flag) Then + For Each iface In cols + ' return model MACAddress IPAddress + set ifaces_cfg = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'") + for each iface_cfg in ifaces_cfg + if ( NOT IsNull(iface_cfg.IPAddress) ) then + on error resume next + IP = trim(iface_cfg.IPAddress(0)) + If ( err.number <> 0 ) Then + IP = NULL + End If + MAC = iface.MACAddress + If ( err.number <> 0 ) Then + MAC = NULL + End If + on error goto 0 + end if + next + Next +End If +If (NOT IsNull(IP)) Then + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" +End If + +If (NOT IsNull(MAC)) Then + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" + WScript.StdOut.WriteLine "" +End If + +'-------------------------------- + + +'-------------------------------- +' Custom Field: Hostname +'-------------------------------- +Wscript.StdOut.WriteLine "" +Wscript.StdOut.WriteLine "" + +Set cols = objWMIService.ExecQuery("SELECT caption FROM Win32_ComputerSystem") + +on error resume next +flag = cols.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + +If (NOT flag) Then + For Each data In cols + Wscript.StdOut.WriteLine "" + Next +End If + +Wscript.StdOut.WriteLine "" + + +'-------------------------------- + +WScript.StdOut.WriteLine "" + +' FILE ENDS From 970be457d679f7c4b4da5dee686ebb026699eb4f Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 15 Jul 2015 18:39:47 +0200 Subject: [PATCH 13/29] Minos changes and improvements --- .../agentes/planned_downtime.export_csv.php | 172 +++++++----------- 1 file changed, 61 insertions(+), 111 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.export_csv.php b/pandora_console/godmode/agentes/planned_downtime.export_csv.php index 0fb2bcd354..ea320fddc6 100644 --- a/pandora_console/godmode/agentes/planned_downtime.export_csv.php +++ b/pandora_console/godmode/agentes/planned_downtime.export_csv.php @@ -20,6 +20,7 @@ require_once ("../../include/functions.php"); require_once ("../../include/functions_db.php"); require_once ("../../include/functions_users.php"); require_once ("../../include/functions_groups.php"); +require_once ("../../include/functions_reporting.php"); $config["id_user"] = $_SESSION["id_usuario"]; if (! check_acl ($config['id_user'], 0, "AR")) { @@ -43,79 +44,81 @@ $module_name = !empty($module_id) ? (string) get_parameter('module_name') : ""; $separator = (string) get_parameter("separator", ";"); $items_separator = (string) get_parameter("items_separator", ","); -// SQL QUERY CREATION -$where_values = "1=1"; - $groups = users_get_groups(); -$groups_string = implode (",", array_keys ($groups)); -$where_values .= " AND id_group IN ($groups_string)"; +if (!empty($groups)) { + // SQL QUERY CREATION + $where_values = "1=1"; -if (!empty($search_text)) { - $where_values .= " AND (name LIKE '%$search_text%' OR description LIKE '%$search_text%')"; -} + $groups_string = implode (",", array_keys ($groups)); + $where_values .= " AND id_group IN ($groups_string)"; -if (!empty($execution_type)) { - $where_values .= " AND type_execution = '$execution_type'"; -} + if (!empty($search_text)) { + $where_values .= " AND (name LIKE '%$search_text%' OR description LIKE '%$search_text%')"; + } -if (!empty($date_from)) { - $where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_from >= '".strtotime("$date_from 00:00:00")."'))"; -} + if (!empty($execution_type)) { + $where_values .= " AND type_execution = '$execution_type'"; + } -if (!empty($date_to)) { - $periodically_monthly_w = "type_periodicity = 'monthly' + if (!empty($date_from)) { + $where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_from >= '".strtotime("$date_from 00:00:00")."'))"; + } + + if (!empty($date_to)) { + $periodically_monthly_w = "type_periodicity = 'monthly' AND ((periodically_day_from <= '".date('d', strtotime($date_from))."' AND periodically_day_to >= '".date('d', strtotime($date_to))."') OR (periodically_day_from > periodically_day_to AND (periodically_day_from <= '".date('d', strtotime($date_from))."' OR periodically_day_to >= '".date('d', strtotime($date_to))."')))"; - - $periodically_weekly_days = array(); - $date_from_aux = strtotime($date_from); - $date_end = strtotime($date_to); - $days_number = 0; - - while ($date_from_aux <= $date_end && $days_number < 7) { - $weekday_actual = strtolower(date('l', $date_from_aux)); - $periodically_weekly_days[] = "$weekday_actual = 1"; + $periodically_weekly_days = array(); + $date_from_aux = strtotime($date_from); + $date_end = strtotime($date_to); + $days_number = 0; - $date_from_aux = $date_from_aux + SECONDS_1DAY; - $days_number++; + while ($date_from_aux <= $date_end && $days_number < 7) { + $weekday_actual = strtolower(date('l', $date_from_aux)); + + $periodically_weekly_days[] = "$weekday_actual = 1"; + + $date_from_aux = $date_from_aux + SECONDS_1DAY; + $days_number++; + } + + $periodically_weekly_w = "type_periodicity = 'weekly' AND (".implode(" OR ", $periodically_weekly_days).")"; + + $periodically_w = "type_execution = 'periodically' AND (($periodically_monthly_w) OR ($periodically_weekly_w))"; + + $once_w = "type_execution = 'once' AND date_to <= '".strtotime("$date_to 23:59:59")."'"; + + $where_values .= " AND (($periodically_w) OR ($once_w))"; } - $periodically_weekly_w = "type_periodicity = 'weekly' AND (".implode(" OR ", $periodically_weekly_days).")"; - - $periodically_w = "type_execution = 'periodically' AND (($periodically_monthly_w) OR ($periodically_weekly_w))"; - - $once_w = "type_execution = 'once' AND date_to <= '".strtotime("$date_to 23:59:59")."'"; - - $where_values .= " AND (($periodically_w) OR ($once_w))"; -} + if (!$show_archived) { + $where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_to >= '".time()."'))"; + } -if (!$show_archived) { - $where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_to >= '".time()."'))"; -} + if (!empty($agent_id)) { + $where_values .= " AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = $agent_id)"; + } -if (!empty($agent_id)) { - $where_values .= " AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = $agent_id)"; -} + if (!empty($module_id)) { + $where_values .= " AND (id IN (SELECT id_downtime + FROM tplanned_downtime_modules + WHERE id_agent_module = $module_id) + OR id IN (SELECT id_downtime + FROM tplanned_downtime_agents tpda, tagente_modulo tam + WHERE tpda.id_agent = tam.id_agente + AND tam.id_agente_modulo = $module_id + AND tpda.all_modules = 1))"; + } -if (!empty($module_id)) { - $where_values .= " AND (id IN (SELECT id_downtime - FROM tplanned_downtime_modules - WHERE id_agent_module = $module_id) - OR id IN (SELECT id_downtime - FROM tplanned_downtime_agents tpda, tagente_modulo tam - WHERE tpda.id_agent = tam.id_agente - AND tam.id_agente_modulo = $module_id - AND tpda.all_modules = 1))"; + $sql = "SELECT * + FROM tplanned_downtime + WHERE $where_values + ORDER BY type_execution DESC, date_from DESC"; + $downtimes = @db_get_all_rows_sql($sql); } -$sql = "SELECT * - FROM tplanned_downtime - WHERE $where_values - ORDER BY type_execution DESC, date_from DESC"; -$downtimes = @db_get_all_rows_sql($sql); - if (!empty($downtimes)) { ob_clean(); // Show contentype header @@ -142,61 +145,8 @@ if (!empty($downtimes)) { $group = ucfirst(io_safe_output(groups_get_name($downtime['id_group']))); $type = ucfirst(io_safe_output($downtime['type_downtime'])); $execution_type = ucfirst(io_safe_output($downtime['type_execution'])); - - switch ($downtime['type_execution']) { - case 'once': - $execution_date = date ("Y-m-d H:i", $downtime['date_from']) . - " " . __('to') . " ". - date ("Y-m-d H:i", $downtime['date_to']); - break; - case 'periodically': - switch ($downtime['type_periodicity']) { - case 'weekly': - $execution_date = __('Weekly:'); - $execution_date .= " "; - if ($downtime['monday']) { - $execution_date .= __('Mon'); - $execution_date .= " "; - } - if ($downtime['tuesday']) { - $execution_date .= __('Tue'); - $execution_date .= " "; - } - if ($downtime['wednesday']) { - $execution_date .= __('Wed'); - $execution_date .= " "; - } - if ($downtime['thursday']) { - $execution_date .= __('Thu'); - $execution_date .= " "; - } - if ($downtime['friday']) { - $execution_date .= __('Fri'); - $execution_date .= " "; - } - if ($downtime['saturday']) { - $execution_date .= __('Sat'); - $execution_date .= " "; - } - if ($downtime['sunday']) { - $execution_date .= __('Sun'); - $execution_date .= " "; - } - $execution_date .= " (" . $downtime['periodically_time_from']; - $execution_date .= "-" . $downtime['periodically_time_to'] . ")"; - break; - case 'monthly': - $execution_date = __('Monthly:'); - $execution_date .= __('From day') . " " . $downtime['periodically_day_from']; - $execution_date .= "/" . __('To day') . " "; - $execution_date .= $downtime['periodically_day_to']; - $execution_date .= " (" . $downtime['periodically_time_from']; - $execution_date .= "-" . $downtime['periodically_time_to'] . ")"; - break; - } - break; - } - $execution_date = io_safe_output($execution_date); + + $execution_date = io_safe_output(reporting_format_planned_downtime_dates($downtime)); $affected_items = array(); From e8d68739b73e515703d3d4609d66dd05775ccf43 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 15 Jul 2015 18:41:58 +0200 Subject: [PATCH 14/29] Added a function to stop a planned downtime (once type) and recover the agent and modules status --- .../include/functions_planned_downtimes.php | 138 +++++++++++++++++- 1 file changed, 137 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index a4476651b6..b377c630d5 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -25,7 +25,7 @@ global $config; /** * Include the usual functions */ -// require_once($config["homedir"] . "/include/functions.php"); +require_once($config["homedir"] . "/include/functions_ui.php"); // enterprise_include_once('include/functions_inventory.php'); function planned_downtimes_check_dates ($type_execution = 'once', $type_periodicity = '', $datetime_from = false, $datetime_to = false, $periodically_time_from = false, $periodically_time_to = false, $periodically_day_from = false, $periodically_day_to = false) { @@ -518,4 +518,140 @@ function planned_downtimes_migrate_malformed_downtimes_copy_items ($original_dow return $new_planned_downtimes_exists; } +/** + * Stop a planned downtime. + * + * @param array Planned downtime data. + * + * @return mixes False on error or an array with the result and a message of the operation. + */ +function planned_downtimes_stop ($downtime) { + $result = false; + $message = ''; + + if (empty($downtime)) + return false; + + switch ($downtime['type_execution']) { + case 'once': + $values = array( + 'executed' => 0, + 'date_to' => time() + ); + + $result = db_process_sql_update('tplanned_downtime', + $values, array ('id' => $id_downtime)); + break; + case 'periodically': + return false; + break; + } + + $message .= ui_print_result_message($result, + __('Succesful stopped the Downtime'), + __('Unsuccesful stopped the Downtime'), + true); + + if ($result) { + events_create_event ("Manual stop downtime ". + $downtime['name'] . " (" . $downtime['id'] . ") by " . + $config['id_user'], 0, 0, EVENT_STATUS_NEW, $config["id_user"], + "system", 1); + db_pandora_audit("Planned Downtime management", + "Manual stop downtime " . $downtime['name'] . " (ID " . $downtime['id'] . ")", + false, true); + + //Reenabled the Agents or Modules or alerts...depends of type + switch ($downtime['type_downtime']) { + case 'quiet': + $agents = db_get_all_rows_filter( + 'tplanned_downtime_agents', + array('id_downtime' => $id_downtime)); + if (empty($agents)) + $agents = array(); + + $count = 0; + foreach ($agents as $agent) { + if ($agent['all_modules']) { + $result = db_process_sql_update('tagente', + array('quiet' => 0), + array('id_agente' => $agent['id_agent'])); + + if ($result) + $count++; + } + else { + $modules = db_get_all_rows_filter( + 'tplanned_downtime_modules', + array('id_agent' => $agent['id_agent'], + 'id_downtime' => $id_downtime)); + if (empty($modules)) + $modules = array(); + + foreach ($modules as $module) { + $result = db_process_sql_update( + 'tagente_modulo', + array('quiet' => 0), + array('id_agente_modulo' => + $module['id_agent_module'])); + + if ($result) + $count++; + } + } + } + break; + case 'disable_agents': + $agents = db_get_all_rows_filter( + 'tplanned_downtime_agents', + array('id_downtime' => $id_downtime)); + if (empty($agents)) + $agents = array(); + + $count = 0; + foreach ($agents as $agent) { + $result = db_process_sql_update('tagente', + array('disabled' => 0), + array('id_agente' => $agent['id_agent'])); + + if ($result) + $count++; + } + break; + case 'disable_agents_alerts': + $agents = db_get_all_rows_filter( + 'tplanned_downtime_agents', + array('id_downtime' => $id_downtime)); + if (empty($agents)) + $agents = array(); + + $count = 0; + foreach ($agents as $agent) { + $modules = db_get_all_rows_filter( + 'tagente_modulo', + array('id_agente' => $agent['id_agent'])); + if (empty($modules)) + $modules = array(); + + foreach ($modules as $module) { + $result = db_process_sql_update( + 'talert_template_modules', + array('disabled' => 0), + array('id_agent_module' => + $module['id_agente_modulo'])); + + if ($result) + $count++; + } + } + break; + } + + $message .= ui_print_info_message( + sprintf(__('Enabled %s elements from the downtime'), $count), true); + } + + return array('result' => $result, 'message' => $message); +} + ?> \ No newline at end of file From 95d0794ae0c537dfa7301e93fbb9eace37b5f99e Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 15 Jul 2015 18:47:58 +0200 Subject: [PATCH 15/29] Fixed syntax and ACL errors and improved some pieces of code Some of the ACL checks added are: -Permission check before stopping. -Running check before deleting. -Permission check before deleting. -Permission check before adding specific table columns. --- .../godmode/agentes/planned_downtime.list.php | 375 ++++++------------ 1 file changed, 116 insertions(+), 259 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 5d7794ec6f..592850167a 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -18,7 +18,10 @@ global $config; check_login(); -if (! check_acl ($config['id_user'], 0, "AR")) { +$read_permisson = check_acl ($config['id_user'], 0, "AR"); +$write_permisson = check_acl ($config['id_user'], 0, "AW"); + +if (! $read_permisson) { db_pandora_audit("ACL Violation", "Trying to access downtime scheduler"); require ("general/noaccess.php"); @@ -28,6 +31,7 @@ if (! check_acl ($config['id_user'], 0, "AR")) { require_once ('include/functions_users.php'); require_once ('include/functions_events.php'); require_once ('include/functions_planned_downtimes.php'); +require_once ('include/functions_reporting.php'); $malformed_downtimes = planned_downtimes_get_malformed(); $malformed_downtimes_exist = !empty($malformed_downtimes) ? true : false; @@ -52,7 +56,6 @@ ui_print_page_header( true, ""); -$delete_downtime = (int) get_parameter ('delete_downtime'); $id_downtime = (int) get_parameter ('id_downtime', 0); $stop_downtime = (bool) get_parameter ('stop_downtime'); @@ -60,138 +63,47 @@ $stop_downtime = (bool) get_parameter ('stop_downtime'); if ($stop_downtime) { $downtime = db_get_row('tplanned_downtime', 'id', $id_downtime); - switch ($downtime['type_execution']) { - case 'once': - $date_stop = date ("Y-m-j", get_system_time ()); - $time_stop = date ("h:iA", get_system_time ()); - - $values = array( - 'executed' => 0, - 'date_to' => strtotime($date_stop . ' ' . $time_stop) - ); - - $result = db_process_sql_update('tplanned_downtime', - $values, array ('id' => $id_downtime)); - break; - case 'periodically': - break; + // Check AW permission on the downtime + if (empty($downtime) || ! check_acl ($config['id_user'], $downtime['id_group'], "AW")) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; } - ui_print_result_message($result, - __('Succesful stopped the Downtime'), - __('Unsuccesful stopped the Downtime')); + $result = planned_downtimes_stop($downtime); - if ($result) { - events_create_event ("Manual stop downtime ". - $downtime['name'] . " (" . $downtime['id'] . ") by " . - $config['id_user'], 0, 0, EVENT_STATUS_NEW, $config["id_user"], - "system", 1); - db_pandora_audit("Planned Downtime management", - "Manual stop downtime " . $downtime['name'] . " (ID " . $downtime['id'] . ")", - false, true); - - //Reenabled the Agents or Modules or alerts...depends of type - $downtime = db_get_row('tplanned_downtime', 'id', $id_downtime); - - switch ($downtime['type_downtime']) { - case 'quiet': - $agents = db_get_all_rows_filter( - 'tplanned_downtime_agents', - array('id_downtime' => $id_downtime)); - if (empty($agents)) - $agents = array(); - - $count = 0; - foreach ($agents as $agent) { - if ($agent['all_modules']) { - $result = db_process_sql_update('tagente', - array('quiet' => 0), - array('id_agente' => $agent['id_agent'])); - - if ($result) - $count++; - } - else { - $modules = db_get_all_rows_filter( - 'tplanned_downtime_modules', - array('id_agent' => $agent['id_agent'], - 'id_downtime' => $id_downtime)); - if (empty($modules)) - $modules = array(); - - foreach ($modules as $module) { - $result = db_process_sql_update( - 'tagente_modulo', - array('quiet' => 0), - array('id_agente_modulo' => - $module['id_agent_module'])); - - if ($result) - $count++; - } - } - } - break; - case 'disable_agents': - $agents = db_get_all_rows_filter( - 'tplanned_downtime_agents', - array('id_downtime' => $id_downtime)); - if (empty($agents)) - $agents = array(); - - $count = 0; - foreach ($agents as $agent) { - $result = db_process_sql_update('tagente', - array('disabled' => 0), - array('id_agente' => $agent['id_agent'])); - - if ($result) - $count++; - } - break; - case 'disable_agents_alerts': - $agents = db_get_all_rows_filter( - 'tplanned_downtime_agents', - array('id_downtime' => $id_downtime)); - if (empty($agents)) - $agents = array(); - - $count = 0; - foreach ($agents as $agent) { - $modules = db_get_all_rows_filter( - 'tagente_modulo', - array('id_agente' => $agent['id_agent'])); - if (empty($modules)) - $modules = array(); - - foreach ($modules as $module) { - $result = db_process_sql_update( - 'talert_template_modules', - array('disabled' => 0), - array('id_agent_module' => - $module['id_agente_modulo'])); - - if ($result) - $count++; - } - } - break; - } - - ui_print_info_message( - sprintf(__('Enabled %s elements from the downtime'), $count)); + if ($result === false) { + ui_print_error_message(__('An error occurred stopping the planned downtime')); + } + else { + echo $result['message']; } } +$delete_downtime = (int) get_parameter ('delete_downtime'); // DELETE WHOLE DOWNTIME! if ($delete_downtime) { - $result = db_process_sql_delete('tplanned_downtime', array('id' => $id_downtime)); + $downtime = db_get_row('tplanned_downtime', 'id', $id_downtime); - if ($result === false) { - ui_print_error_message(__('Not deleted. Error deleting data')); + // Check AW permission on the downtime + if (empty($downtime) || ! check_acl ($config['id_user'], $downtime['id_group'], "AW")) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + + // The downtime shouldn't be running!! + if ($downtime['executed']) { + ui_print_error_message(__('This planned downtime is running')); } else { - ui_print_success_message(__('Successfully deleted')); + $result = db_process_sql_delete('tplanned_downtime', array('id' => $id_downtime)); + + ui_print_result_message($result, + __('Successfully deleted'), + __('Not deleted. Error deleting data')); } } @@ -263,31 +175,7 @@ $row[] = __('Module') . ' ' . html_print_autocomplete_modules('module_name' $row[] = html_print_submit_button('Search', 'search', false, 'class="sub search"', true); $table_form->data[] = $row; - - -// View available downtimes present in database (if any of them) -$table = new StdClass(); -$table->class = 'databox data'; -//Start Overview of existing planned downtime -$table->width = '100%'; -$table->cellstyle = array(); -$table->data = array(); -$table->head = array(); -$table->head[0] = __('Name #Ag.'); -$table->head[1] = __('Description'); -$table->head[2] = __('Group'); -$table->head[3] = __('Type'); -$table->head[4] = __('Execution'); -$table->head[5] = __('Configuration'); -$table->head[6] = __('Running'); -$table->head[7] = __('Stop downtime'); -$table->head[8] = __('Edit'); -$table->head[9] = __('Delete'); -$table->align[2] = "center"; -$table->align[6] = "center"; -$table->align[7] = "center"; -$table->align[8] = "center"; -$table->align[9] = "center"; +// End of table filter $groups = users_get_groups (); if (!empty($groups)) { @@ -443,149 +331,115 @@ else { echo ""; ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset); - - $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); + + // User groups with AW permission + $groupsAW = users_get_groups($config['id_user'], 'AW'); $groupsAW = array_keys($groupsAW); - - if (empty($groupsAW)){ - $groupsAW = -1; + + // View available downtimes present in database (if any of them) + $table = new StdClass(); + $table->class = 'databox data'; + $table->width = '100%'; + $table->cellstyle = array(); + + $table->head = array(); + $table->head['name'] = __('Name #Ag.'); + $table->head['description'] = __('Description'); + $table->head['group'] = __('Group'); + $table->head['type'] = __('Type'); + $table->head['execution'] = __('Execution'); + $table->head['configuration'] = __('Configuration'); + $table->head['running'] = __('Running'); + + if ($write_permisson) { + $table->head['stop'] = __('Stop downtime'); + $table->head['edit'] = __('Edit'); + $table->head['delete'] = __('Delete'); } - + + $table->align = array(); + $table->align['group'] = "center"; + $table->align['running'] = "center"; + + if ($write_permisson) { + $table->align['stop'] = "center"; + $table->align['edit'] = "center"; + $table->align['delete'] = "center"; + } + + $table->data = array(); + foreach ($downtimes as $downtime) { $data = array(); $total = db_get_sql ("SELECT COUNT(id_agent) FROM tplanned_downtime_agents WHERE id_downtime = ".$downtime["id"]); - $data[0] = $downtime['name']. " ($total)"; - $data[1] = $downtime['description']; - $data[2] = ui_print_group_icon ($downtime['id_group'], true); + $data['name'] = $downtime['name']. " ($total)"; + $data['description'] = $downtime['description']; + $data['group'] = ui_print_group_icon ($downtime['id_group'], true); $type_text = array('quiet' => __('Quiet'), 'disable_agents' => __('Disabled Agents'), 'disable_agents_alerts' => __('Disabled only Alerts')); - $data[3] = $type_text[$downtime['type_downtime']]; + $data['type'] = $type_text[$downtime['type_downtime']]; $execution_text = array('once' => __('once'), 'periodically' => __('Periodically')); - $data[4] = $execution_text[$downtime['type_execution']]; + $data['execution'] = $execution_text[$downtime['type_execution']]; - switch ($downtime['type_execution']) { - case 'once': - $data[5] = date ("Y-m-d H:i:s", $downtime['date_from']) . - " " . __('to') . " ". - date ("Y-m-d H:i:s", $downtime['date_to']); - break; - case 'periodically': - switch ($downtime['type_periodicity']) { - case 'weekly': - $data[5] = __('Weekly:'); - $data[5] .= " "; - if ($downtime['monday']) { - $data[5] .= __('Mon'); - $data[5] .= " "; - } - if ($downtime['tuesday']) { - $data[5] .= __('Tue'); - $data[5] .= " "; - } - if ($downtime['wednesday']) { - $data[5] .= __('Wed'); - $data[5] .= " "; - } - if ($downtime['thursday']) { - $data[5] .= __('Thu'); - $data[5] .= " "; - } - if ($downtime['friday']) { - $data[5] .= __('Fri'); - $data[5] .= " "; - } - if ($downtime['saturday']) { - $data[5] .= __('Sat'); - $data[5] .= " "; - } - if ($downtime['sunday']) { - $data[5] .= __('Sun'); - $data[5] .= " "; - } - $data[5] .= " (" . $downtime['periodically_time_from']; - $data[5] .= "-" . $downtime['periodically_time_to'] . ")"; - break; - case 'monthly': - $data[5] = __('Monthly:'); - $data[5] .= __('From day') . " " . $downtime['periodically_day_from']; - $data[5] .= "/" . __('To day') . " "; - $data[5] .= $downtime['periodically_day_to']; - $data[5] .= " (" . $downtime['periodically_time_from']; - $data[5] .= "-" . $downtime['periodically_time_to'] . ")"; - break; - } - break; - } + $data['configuration'] = reporting_format_planned_downtime_dates($downtime); if ($downtime["executed"] == 0) { - $data[6] = html_print_image ("images/pixel_red.png", true, - array ('width' => 20, 'height' => 20, 'alt' => __('Executed'))); + $data['running'] = html_print_image ("images/pixel_red.png", true, + array ('width' => 20, 'height' => 20, 'title' => __('Not running'))); } else { - $data[6] = html_print_image ("images/pixel_green.png", true, - array ('width' => 20, 'height' => 20, 'alt' => __('Not executed'))); + $data['running'] = html_print_image ("images/pixel_green.png", true, + array ('width' => 20, 'height' => 20, 'title' => __('Running'))); } - $downtimeGroup = $downtime['id_group']; - //If user have writting permissions - if ( in_array($downtimeGroup, $groupsAW) ){ + // If user have writting permissions + if (in_array($downtime['id_group'], $groupsAW)) { + // Stop button if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { - $data[7] .= '' . - html_print_image("images/cancel.png", true, array("border" => '0', "alt" => __('Stop downtime'))); + html_print_image("images/cancel.png", true, array("title" => __('Stop downtime'))); } else { - $data[7] = ""; + $data['stop'] = ""; } + // Edit & delete buttons if ($downtime["executed"] == 0) { - $data[8] = '' . - html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; - if (check_acl ($config['id_user'], 0, "AW")) { - $data[9] = '' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); - } + // Edit + $data['edit'] = '' . + html_print_image("images/config.png", true, array("title" => __('Update'))) . ''; + // Delete + $data['delete'] = '' . + html_print_image("images/cross.png", true, array("title" => __('Delete'))); } - elseif ($downtime["executed"] == 1 - && $downtime['type_execution'] == 'once') { - - $data[8] = '' . - html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; - $data[9]= "N/A"; + else if ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once') { + // Edit + $data['edit'] = '' . + html_print_image("images/config.png", true, array("title" => __('Update'))) . ''; + // Delete + $data['delete']= __('N/A'); } else { - $data[8]= "N/A"; - $data[9]= "N/A"; + $data['edit']= ''; + $data['delete']= ''; } } - else{ - if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { - $data[7] .= ''; - } - } - elseif ($downtime["executed"] == 1 - && $downtime['type_execution'] == 'once') { - - if ($downtime["executed"] == 0) { - $data[8] = ''; - $data[9] = ''; - } - elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once') { - $data[8] = ''; - $data[9]= ''; - } + else { + $data['stop'] = ''; + $data['edit'] = ''; + $data['delete'] = ''; } if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) { @@ -599,25 +453,28 @@ else { array_push ($table->data, $data); } + html_print_table ($table); echo '
'; echo '
'; + // CSV export button echo '
'; html_print_button(__('Export to CSV'), 'csv_export', false, "location.href='godmode/agentes/planned_downtime.export_csv.php?$filter_params_str'", 'class="sub next"'); echo '
'; - echo ' '; - if (check_acl ($config['id_user'], 0, "AW")) { + + // Create button + if ($write_permisson) { + echo ' '; echo '
'; html_print_submit_button (__('Create'), 'create', false, 'class="sub next"'); + echo '
'; } - echo ''; + echo '
'; } - - ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/"); ?> From f94c6668e0d41ae2288430acfcb624e61c9f20dd Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 16 Jul 2015 00:01:15 +0200 Subject: [PATCH 16/29] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/bin/pandora_agent.conf | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 4db5cb2610..b98881ea45 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150715 +Version: 6.0dev-150716 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 64f0aaa969..338fd4f29d 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150715" +pandora_version="6.0dev-150716" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 912b32bb52..bacca134ae 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150715'; +use constant AGENT_BUILD => '150716'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index c3bdc5b0c5..69edba0001 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150715 +%define release 150716 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 6eea023299..f02d88cf0a 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150715 +%define release 150716 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index f4ea2ccb05..93fc29cf44 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2014 Artica Soluciones Tecnologicas -# Version 6.0dev +# Version 6.0dev # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f7d78c0fd2..049b020557 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150715} +{150716} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index a92f833501..ceb697ec21 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.0dev(Build 150715)") +#define PANDORA_VERSION ("6.0dev(Build 150716)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index fd97bce259..50dbc6acd1 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.0dev(Build 150715))" + VALUE "ProductVersion", "(6.0dev(Build 150716))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 12613ea0da..d392dd4d64 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150715 +Version: 6.0dev-150716 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 81a37eb6fe..06774279b9 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150715" +pandora_version="6.0dev-150716" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index d0044b7a4e..b849f2f11d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150715'; +$build_version = 'PC150716'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 7e0c48f299..d0b7c3ea92 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
Date: Thu, 16 Jul 2015 11:47:44 +0200 Subject: [PATCH 17/29] Fixed the xml reports with & in the values. --- pandora_console/include/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index ef73eca18c..2622ffa0ef 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2443,7 +2443,7 @@ function array2XML($data, $root = null, $xml = NULL) { } } - return html_entity_decode($xml->asXML()); + return $xml->asXML(); } /** From cbd4b60aca965bfd8a05b8c07df2ee7907cf4331 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 16 Jul 2015 13:27:11 +0200 Subject: [PATCH 18/29] Fixed an error in the function 'extract_column' --- pandora_console/include/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index ef73eca18c..efba4b030d 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2457,7 +2457,7 @@ function array2XML($data, $root = null, $xml = NULL) { function extract_column ($array, $column) { $column_is_arr = is_array($column); - return array_map(function($item) { + return array_map(function($item) use ($column_is_arr, $column) { if ($column_is_arr) { return array_reduce($column, function($carry, $col) use ($item) { $carry[$col] = $item[$col]; From 4d43033d466fd9ba52594162c9aa24fd7dce8e91 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 16 Jul 2015 13:53:57 +0200 Subject: [PATCH 19/29] Fixed some general and ACL errors and improved some pieces of code Downtime editor. Some of the ACL checks added are: -Permission check on downtime before adding an agent -Permission check on agent before adding an agent -Permission check on downtime before deleting an agent -Permission check on agent before deleting an agent -Permission check on downtime before creating or updating the downtime -Removed the ACL check for every result item (it is done before, into the query) -Permission check on the query for the agents added to the downtime Downtime editor ajax. Some of the ACL checks added are: -Permission check on downtime before retrieving the modules -Permission check on agent before retrieving the modules -Permission check on downtime before deleting the modules -Permission check on agent before deleting the modules -Permission check on downtime before adding the modules -Permission check on agent before adding the modules --- .../agentes/planned_downtime.editor.php | 281 +++++++++++------- .../include/ajax/planned_downtime.ajax.php | 172 +++++++---- 2 files changed, 293 insertions(+), 160 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 1945f6a7b1..e78088e7b0 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -25,7 +25,8 @@ if (! check_acl ($config['id_user'], 0, "AW")) { return; } -$config["past_planned_downtimes"] = isset($config["past_planned_downtimes"]) ? $config["past_planned_downtimes"] : 1; +// Default +set_unless_defined ($config["past_planned_downtimes"], 1); require_once ('include/functions_users.php'); @@ -81,43 +82,59 @@ $id_agent = (int) get_parameter ('id_agent'); $insert_downtime_agent = (int) get_parameter ('insert_downtime_agent'); $delete_downtime_agent = (int) get_parameter ('delete_downtime_agent'); +// User groups with AW permission for ACL checks +$user_groups_aw = array_keys(users_get_groups($config['id_user'], 'AW')); + // INSERT A NEW DOWNTIME_AGENT ASSOCIATION if ($insert_downtime_agent === 1) { + + // Check AW permission on downtime + $downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime); + + if ($downtime_group === false || !in_array($downtime_group, $user_groups_aw)) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + $agents = (array) get_parameter ('id_agents'); $module_names = (array) get_parameter ('module'); - $all_modules = false; - if (empty($module_names)) { - $all_modules = true; - } - else { - //It is empty. - if ($module_names[0] == "0") - $all_modules = true; - } + $all_modules = (empty($module_names) || in_array(0, $module_names)); - $executed = db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); - if ($executed == 1) { + // 'Is running' check + $is_running = (bool) db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); + if ($is_running) { ui_print_error_message(__("This elements cannot be modified while the downtime is being executed")); } else { - $num_agents = count($agents); - for ($a = 0; $a < $num_agents; $a++) { - $id_agente_dt = $agents[$a]; + foreach ($agents as $agent_id) { + + // Check AW permission on agent + $agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id); + + if ($agent_group === false || !in_array($agent_group, $user_groups_aw)) { + continue; + } $values = array( 'id_downtime' => $id_downtime, - 'id_agent' => $id_agente_dt, + 'id_agent' => $agent_id, 'all_modules' => $all_modules ); - $result = db_process_sql_insert('tplanned_downtime_agents', $values); + if ($result && !$all_modules) { foreach ($module_names as $module_name) { - $module = modules_get_agentmodule_id($module_name, $id_agente_dt); + $module = modules_get_agentmodule_id($module_name, $agent_id); + + if (empty($module)) + continue; + $values = array( 'id_downtime' => $id_downtime, - 'id_agent' => $id_agente_dt, + 'id_agent' => $agent_id, 'id_agent_module' => $module["id_agente_modulo"] ); $result = db_process_sql_insert('tplanned_downtime_modules', $values); @@ -138,8 +155,29 @@ if ($delete_downtime_agent === 1) { $id_da = (int) get_parameter ('id_downtime_agent'); - $executed = db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); - if ($executed == 1) { + // Check AW permission on downtime + $downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime); + + if ($downtime_group === false || !in_array($downtime_group, $user_groups_aw)) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + + // Check AW permission on agent + $agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent); + + if ($agent_group === false || !in_array($agent_group, $user_groups_aw)) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + + // 'Is running' check + $is_running = (bool) db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); + if ($is_running) { ui_print_error_message(__("This elements cannot be modified while the downtime is being executed")); } else { @@ -158,11 +196,11 @@ if ($delete_downtime_agent === 1) { // UPDATE OR CREATE A DOWNTIME (MAIN DATA, NOT AGENT ASSOCIATION) if ($create_downtime || $update_downtime) { - $check = db_get_value ('name', 'tplanned_downtime', 'name', $name); + $check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $name); $datetime_from = strtotime ($once_date_from . ' ' . $once_time_from); $datetime_to = strtotime ($once_date_to . ' ' . $once_time_to); - $now = strtotime(date(DATE_FORMAT). ' ' . date(TIME_FORMAT)); + $now = time(); if ($type_execution == 'once' && !$config["past_planned_downtimes"] && $datetime_from < $now) { ui_print_error_message(__('Not created. Error inserting data. Start time must be higher than the current time' )); @@ -184,6 +222,15 @@ if ($create_downtime || $update_downtime) { else { $sql = ''; if ($create_downtime) { + + // Check AW permission on new downtime + if (!in_array($id_group, $user_groups_aw)) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + if (trim(io_safe_output($name)) != '') { if (!$check) { $values = array( @@ -228,44 +275,65 @@ if ($create_downtime || $update_downtime) { } } else if ($update_downtime) { - $has_been_executed = db_get_value ('executed', 'tplanned_downtime', 'name', $name); + $old_downtime = db_get_row('tplanned_downtime', 'id', $id_downtime); + + // Check AW permission on OLD downtime + if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_aw)) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + + // Check AW permission on NEW downtime group + if (!in_array($id_group, $user_groups_aw)) { + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + + // 'Is running' check + $is_running = (bool) $old_downtime['executed']; + $values = array(); if (trim(io_safe_output($name)) == '') { ui_print_error_message(__('Planned downtime must have a name')); } - else if ($has_been_executed == 1 && $type_execution == 'once') { + // When running only certain items can be modified for the 'once' type + else if ($is_running && $type_execution == 'once') { $values = array( 'description' => $description, 'date_to' => $datetime_to, 'id_user' => $config['id_user'] ); } - else if ($has_been_executed == 1) { - ui_print_error_message(__('No updates. Planned Downtime has been executed')); + else if ($is_running) { + ui_print_error_message(__('Cannot be modified while the downtime is being executed')); } else { $values = array( - 'name' => $name, - 'description' => $description, - 'date_from' => $datetime_from, - 'date_to' => $datetime_to, - 'id_group' => $id_group, - 'only_alerts' => 0, - 'monday' => $monday, - 'tuesday' => $tuesday, - 'wednesday' => $wednesday, - 'thursday' => $thursday, - 'friday' => $friday, - 'saturday' => $saturday, - 'sunday' => $sunday, - 'periodically_time_from' => $periodically_time_from, - 'periodically_time_to' => $periodically_time_to, - 'periodically_day_from' => $periodically_day_from, - 'periodically_day_to' => $periodically_day_to, - 'type_downtime' => $type_downtime, - 'type_execution' => $type_execution, - 'type_periodicity' => $type_periodicity, - 'id_user' => $config['id_user'] + 'name' => $name, + 'description' => $description, + 'date_from' => $datetime_from, + 'date_to' => $datetime_to, + 'id_group' => $id_group, + 'only_alerts' => 0, + 'monday' => $monday, + 'tuesday' => $tuesday, + 'wednesday' => $wednesday, + 'thursday' => $thursday, + 'friday' => $friday, + 'saturday' => $saturday, + 'sunday' => $sunday, + 'periodically_time_from' => $periodically_time_from, + 'periodically_time_to' => $periodically_time_to, + 'periodically_day_from' => $periodically_day_from, + 'periodically_day_to' => $periodically_day_to, + 'type_downtime' => $type_downtime, + 'type_execution' => $type_execution, + 'type_periodicity' => $type_periodicity, + 'id_user' => $config['id_user'] ); if ($config["dbtype"] == 'oracle') { $values['periodically_time_from'] = '1970/01/01 ' . $values['periodically_time_from']; @@ -354,11 +422,16 @@ if ($id_downtime > 0) { break; } - $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); - $groupsAW = array_keys($groupsAW); - $result = db_get_row_sql ($sql); + // Permission check for the downtime with the AW user groups + if (empty($result) || !in_array($result['id_group'], $user_groups_aw) ){ + db_pandora_audit("ACL Violation", + "Trying to access downtime scheduler"); + require ("general/noaccess.php"); + return; + } + $name = (string) $result["name"]; $id_group = (int) $result['id_group']; @@ -386,18 +459,11 @@ if ($id_downtime > 0) { $saturday = (bool) $result['saturday']; $sunday = (bool) $result['sunday']; - $executed = (bool) $result['executed']; - - if ( !in_array($id_group, $groupsAW) ){ - db_pandora_audit("ACL Violation", - "Trying to access downtime scheduler"); - require ("general/noaccess.php"); - return; - } + $running = (bool) $result['executed']; } -// when the planned down time is in execution, only action to postpone on once type is enabled and the other are disabled. -$disabled_in_execution = $executed ? 1 : 0; +// when the planned downtime is in execution, only action to postpone on once type is enabled and the other are disabled. +$disabled_in_execution = (int) $running; $table = new StdClass(); $table->class = 'databox filters'; @@ -564,42 +630,42 @@ if ($id_downtime > 0) { // Show available agents to include into downtime echo '

' . __('Available agents') . ':

'; - $filter_group = get_parameter("filter_group", 0); + $filter_group = (int) get_parameter("filter_group", 0); - $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); - $groupsAW = array_keys($groupsAW); - $id_groups_list = implode(",", $groupsAW); - - if (empty($id_groups_list)){ - $id_groups_list = -1; + // User AW groups to str for the filter + $id_groups_str = implode(",", $user_groups_aw); + + if (empty($id_groups_str)) { + // Restrictive filter on error. This will filter all the downtimes + $id_groups_str = '-1'; } - + $filter_cond = ''; if ($filter_group > 0) $filter_cond = " AND id_grupo = $filter_group "; - $sql = sprintf ("SELECT tagente.id_agente, tagente.nombre, - tagente.id_grupo + $sql = sprintf("SELECT tagente.id_agente, tagente.nombre FROM tagente WHERE tagente.id_agente NOT IN ( SELECT tagente.id_agente FROM tagente, tplanned_downtime_agents WHERE tplanned_downtime_agents.id_agent = tagente.id_agente AND tplanned_downtime_agents.id_downtime = %d - ) AND disabled = 0 $filter_cond + ) AND disabled = 0 %s AND tagente.id_grupo IN (%s) - ORDER by tagente.nombre", $id_downtime, $id_groups_list); - $downtimes = db_get_all_rows_sql ($sql); - $data = array (); - if ($downtimes) { - foreach ($downtimes as $downtime) { - if (check_acl ($config["id_user"], $downtime['id_grupo'], "AW")) { - $data[$downtime['id_agente']] = $downtime['nombre']; - } - } - } + ORDER BY tagente.nombre", $id_downtime, $filter_cond, $id_groups_str); + $agents = db_get_all_rows_sql ($sql); + if (empty($agents)) + $agents = array(); + + $agent_ids = extract_column($agents, 'id_agente'); + $agent_names = extract_column($agents, 'nombre'); + // item[] = ; + $agents = array_combine($agent_ids, $agent_names); + if ($agents === false) + $agents = array(); $disabled_add_button = false; - if (empty($data) || $disabled_in_execution) { + if (empty($agents) || $disabled_in_execution) { $disabled_add_button = true; } @@ -613,7 +679,7 @@ if ($id_downtime > 0) { echo "
"; - echo html_print_select ($data, "id_agents[]", '', '', '', 0, false, true, true, '', false, 'width: 180px;'); + echo html_print_select ($agents, "id_agents[]", '', '', '', 0, false, true, true, '', false, 'width: 180px;'); echo '

' . __('Available modules:') . ui_print_help_tip (__('Only for type Quiet for downtimes.'), true) . '

'; @@ -631,17 +697,20 @@ if ($id_downtime > 0) { //Start Overview of existing planned downtime echo '

'.__('Agents planned for this downtime').':

'; - $sql = sprintf ("SELECT tagente.nombre, tplanned_downtime_agents.id, - tagente.id_os, tagente.id_agente, tagente.id_grupo, - tagente.ultimo_contacto, tplanned_downtime_agents.all_modules - FROM tagente, tplanned_downtime_agents - WHERE tplanned_downtime_agents.id_agent = tagente.id_agente - AND tplanned_downtime_agents.id_downtime = %d ", $id_downtime); + // User the $id_groups_str built before + $sql = sprintf("SELECT ta.nombre, tpda.id, + ta.id_os, ta.id_agente, ta.id_grupo, + ta.ultimo_contacto, tpda.all_modules + FROM tagente ta + INNER JOIN tplanned_downtime_agents tpda + ON ta.id_agente = tpda.id_agent + AND tpda.id_downtime = %d + WHERE ta.id_grupo IN (%s)", + $id_downtime, $id_groups_str); + $downtimes_agents = db_get_all_rows_sql ($sql); - $downtimes = db_get_all_rows_sql ($sql); - if ($downtimes === false) { - echo '
' . - __('There are no scheduled downtimes') . '
'; + if (empty($downtimes_agents)) { + echo '
' . __('There are no agents') . '
'; } else { $table = new stdClass(); @@ -656,24 +725,24 @@ if ($id_downtime > 0) { $table->head[3] = __('Last contact'); $table->head['count_modules'] = __('Modules'); - if (!$executed) { + if (!$running) { $table->head[5] = __('Actions'); $table->align[5] = "center"; $table->size[5] = "5%"; } - foreach ($downtimes as $downtime) { + foreach ($downtimes_agents as $downtime_agent) { $data = array (); - $data[0] = $downtime['nombre']; + $data[0] = $downtime_agent['nombre']; $data[1] = db_get_sql ("SELECT nombre FROM tgrupo - WHERE id_grupo = " . $downtime["id_grupo"]); + WHERE id_grupo = " . $downtime_agent["id_grupo"]); - $data[2] = ui_print_os_icon($downtime["id_os"], true, true); + $data[2] = ui_print_os_icon($downtime_agent["id_os"], true, true); - $data[3] = $downtime["ultimo_contacto"]; + $data[3] = $downtime_agent["ultimo_contacto"]; if ($type_downtime == 'disable_agents_alerts') { $data['count_modules'] = __("All alerts"); @@ -682,7 +751,7 @@ if ($id_downtime > 0) { $data['count_modules'] = __("Entire agent"); } else { - if ($downtime["all_modules"]) { + if ($downtime_agent["all_modules"]) { $data['count_modules'] = __("All modules"); } else { @@ -690,19 +759,19 @@ if ($id_downtime > 0) { } } - if (!$executed) { + if (!$running) { $data[5] = ''; if ($type_downtime != 'disable_agents_alerts' && $type_downtime != 'disable_agents') { - $data[5] = '' . + $data[5] = '' . html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Delete'))) . ""; } - $data[5] .= '' . + $data[5] .= '' . html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ""; } - $table->data['agent_' . $downtime["id_agente"]] = $data; + $table->data['agent_' . $downtime_agent["id_agente"]] = $data; } html_print_table ($table); } diff --git a/pandora_console/include/ajax/planned_downtime.ajax.php b/pandora_console/include/ajax/planned_downtime.ajax.php index bf032431c9..c8bf78ddd4 100644 --- a/pandora_console/include/ajax/planned_downtime.ajax.php +++ b/pandora_console/include/ajax/planned_downtime.ajax.php @@ -17,10 +17,16 @@ include_once($config['homedir'] . "/include/functions_io.php"); include_once($config['homedir'] . "/include/functions_db.php"); include_once($config['homedir'] . "/include/functions_modules.php"); +include_once($config['homedir'] . "/include/functions_groups.php"); -$get_modules_downtime = (bool)get_parameter('get_modules_downtime', 0); -$delete_module_from_downtime = (bool)get_parameter('delete_module_from_downtime', 0); -$add_module_into_downtime = (bool)get_parameter('add_module_into_downtime', 0); +ob_clean(); + +$get_modules_downtime = (bool)get_parameter('get_modules_downtime', 0); +$delete_module_from_downtime = (bool)get_parameter('delete_module_from_downtime', 0); +$add_module_into_downtime = (bool)get_parameter('add_module_into_downtime', 0); + +// User groups with AW permission for ACL checks +$user_groups_aw = array_keys(users_get_groups($config['id_user'], 'AW')); if ($get_modules_downtime) { $return = array(); @@ -28,38 +34,58 @@ if ($get_modules_downtime) { $return['in_agent'] = array(); $return['in_downtime'] = array(); - $id_agent = (int)get_parameter('id_agent', 0); - $id_downtime = (int)get_parameter('id_downtime', 0); - $none_value = (bool)get_parameter('none_value', false); + $id_agent = (int) get_parameter('id_agent', 0); + $id_downtime = (int) get_parameter('id_downtime', 0); + $none_value = (bool) get_parameter('none_value', false); - $rows = db_get_all_rows_filter('tplanned_downtime_modules', - array('id_agent' => $id_agent, 'id_downtime' => $id_downtime)); - if (empty($rows)) - $rows = array(); - $id_modules_downtime = array(); - foreach ($rows as $row) { - $id_modules_downtime[$row['id_agent_module']] = true; + // Check AW permission on downtime + $downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime); + + if ($downtime_group === false || !in_array($downtime_group, $user_groups_aw)) { + $return['correct'] = 0; + echo json_encode($return); + return; } - $modules = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent)); + // Check AW permission on agent + $agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent); + + if ($agent_group === false || !in_array($agent_group, $user_groups_aw)) { + $return['correct'] = 0; + echo json_encode($return); + return; + } + + $filter = array( + 'id_agent' => $id_agent, + 'id_downtime' => $id_downtime + ); + $downtime_modules = db_get_all_rows_filter('tplanned_downtime_modules', $filter); + if (empty($downtime_modules)) + $downtime_modules = array(); + + $downtime_module_ids = extract_column($downtime_modules, 'id_agent_module'); + $downtime_modules = array_fill_keys($downtime_module_ids, true); + + $filter = array( + 'id_agente' => $id_agent + ); + $modules = db_get_all_rows_filter('tagente_modulo', $filter); if (empty($modules)) $modules = array(); - foreach ($modules as $module) { - if (empty($id_modules_downtime[$module['id_agente_modulo']])) { - $return['in_agent'][$module['id_agente_modulo']] = io_safe_output($module['nombre']); - } - else { - $return['in_downtime'][$module['id_agente_modulo']] = io_safe_output($module['nombre']); - } - } + $module_ids = extract_column($modules, 'id_agente_modulo'); + $module_names = extract_column($modules, 'nombre'); + $modules = array_combine($module_ids, $module_names); - if ($none_value) { + $return['in_downtime'] = array_intersect_key($modules, $downtime_modules); + $return['in_agent'] = array_diff($modules, $return['in_downtime']); + + if ($none_value) $return['in_agent'][0] = __('None'); - } echo json_encode($return); - exit; + return; } if ($delete_module_from_downtime) { @@ -68,45 +94,65 @@ if ($delete_module_from_downtime) { $return['all_modules'] = 0; $return['id_agent'] = 0; - $id_module = (int)get_parameter('id_module', 0); - $id_downtime = (int)get_parameter('id_downtime', 0); + $id_module = (int) get_parameter('id_module', 0); + $id_downtime = (int) get_parameter('id_downtime', 0); + $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module); - $executed = db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); - if ($executed) { + // Check AW permission on downtime + $downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime); + + if ($downtime_group === false || !in_array($downtime_group, $user_groups_aw)) { + $return['correct'] = 0; + echo json_encode($return); + return; + } + + // Check AW permission on agent + $agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent); + + if ($id_agent === false || $agent_group === false || !in_array($agent_group, $user_groups_aw)) { + $return['correct'] = 0; + echo json_encode($return); + return; + } + + $is_running = db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); + if ($is_running) { $return['executed'] = 1; echo json_encode($return); - exit; + return; } - - $row = db_get_row_filter('tplanned_downtime_modules', - array('id_agent_module' => $id_module, - 'id_downtime' => $id_downtime)); - $return['id_agent'] = $row['id_agent']; - $result = db_process_sql_delete('tplanned_downtime_modules', - array('id_downtime' => $id_downtime, - 'id_agent_module' => $id_module)); + $return['id_agent'] = $id_agent; + + $filter = array( + 'id_agent_module' => $id_module, + 'id_downtime' => $id_downtime + ); + $result = db_process_sql_delete('tplanned_downtime_modules', $filter); if ($result) { - $rows = db_get_all_rows_filter('tplanned_downtime_modules', - array('id_downtime' => $id_downtime, - 'id_agent' => $row['id_agent'])); + db_clean_cache(); + + $filter = array( + 'id_agent' => $id_agent, + 'id_downtime' => $id_downtime + ); + $rows = db_get_all_rows_filter('tplanned_downtime_modules', $filter); if (empty($rows)) { - db_process_sql_update('tplanned_downtime_agents', - array('all_modules' => 1), - array('id_agent' => $row['id_agent'], - 'id_downtime' => $id_downtime)); + $values = array('all_modules' => 1); + db_process_sql_update('tplanned_downtime_agents', $values, $filter); $return['all_modules'] = 1; - $return['id_agent'] = $row['id_agent']; + $return['id_agent'] = $id_agent; } $return['correct'] = 1; } echo json_encode($return); - exit; + return; } if ($add_module_into_downtime) { @@ -114,15 +160,33 @@ if ($add_module_into_downtime) { $return['correct'] = 0; $return['name'] = ''; - $id_agent = (int)get_parameter('id_agent', 0); - $id_module = (int)get_parameter('id_module', 0); - $id_downtime = (int)get_parameter('id_downtime', 0); + $id_agent = (int) get_parameter('id_agent', 0); + $id_module = (int) get_parameter('id_module', 0); + $id_downtime = (int) get_parameter('id_downtime', 0); - $executed = db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); - if ($executed) { + // Check AW permission on downtime + $downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime); + + if ($downtime_group === false || !in_array($downtime_group, $user_groups_aw)) { + $return['correct'] = 0; + echo json_encode($return); + return; + } + + // Check AW permission on agent + $agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent); + + if ($agent_group === false || !in_array($agent_group, $user_groups_aw)) { + $return['correct'] = 0; + echo json_encode($return); + return; + } + + $is_running = db_get_value ('executed', 'tplanned_downtime', 'id', $id_downtime); + if ($is_running) { $return['executed'] = 1; echo json_encode($return); - exit; + return; } $values = array(); @@ -144,7 +208,7 @@ if ($add_module_into_downtime) { } echo json_encode($return); - exit; + return; } ?> From 8b608a43f51d96525c3b3ea14464042eba6978c4 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 16 Jul 2015 14:59:29 +0200 Subject: [PATCH 20/29] Fixed the javascript bug with lines in the visualmap. TICKET: #2464 --- pandora_console/operation/visual_console/render_view.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index e4ae5c1d82..848df0332c 100755 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -271,10 +271,5 @@ ui_require_javascript_file ('pandora_visual_console'); ?> }); - $(window).load(function() { - if (typeof(lines) != 'undefined') { - draw_lines (lines, 'layout_map'); - } - }); /* ]]> */ From 75873b02d466f0fccee9c96942dba02c31ce61a5 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 16 Jul 2015 15:12:47 +0200 Subject: [PATCH 21/29] Some fixes in the visualmap. --- pandora_console/godmode/reporting/map_builder.php | 5 +++-- pandora_console/include/functions_visual_map.php | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 47c098619a..61d13dda52 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -43,7 +43,7 @@ if (!defined('METACONSOLE')) { $id_layout = (int) get_parameter ('id_layout'); $copy_layout = (bool) get_parameter ('copy_layout'); $delete_layout = (bool) get_parameter ('delete_layout'); -$refr = (int) get_parameter('refr'); +$refr = (int) get_parameter('refr', 60); $offset = (int) get_parameter('offset', 0); $pagination = (int) get_parameter ("pagination", $config["block_size"]); @@ -238,7 +238,8 @@ else { if ($own_info['is_admin'] || $vconsoles_read) { $maps = visual_map_get_user_layouts (0,false,$filters); $total_maps = count(visual_map_get_user_layouts()); -} else { +} +else { $maps = visual_map_get_user_layouts ($config['id_user'], false, $filters, false); $total_maps = count(visual_map_get_user_layouts ($config['id_user'], false, diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 4d2fa1c870..95e8b7f4ad 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1894,6 +1894,9 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter $groups = users_get_groups ($id_user, 'RR', false); if (!empty($groups)) { + if (empty($where)) + $where = ""; + if ($where != '') { $where .= ' AND '; } From df27567592dac10c96387d3388adc8ca32a6e9e1 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 16 Jul 2015 15:51:05 +0200 Subject: [PATCH 22/29] Fixed an error in the function 'planned_downtimes_stop' (cherry picked from commit f01c021b14136dcc85b26bb1fa806f20c305ce24) --- pandora_console/include/functions_planned_downtimes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index b377c630d5..a819d87aeb 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -532,6 +532,8 @@ function planned_downtimes_stop ($downtime) { if (empty($downtime)) return false; + $id_downtime = $downtime['id']; + switch ($downtime['type_execution']) { case 'once': $values = array( From cde2fb5a7b065390d0c67ae5ed2fd048b5e9fb58 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 17 Jul 2015 00:01:39 +0200 Subject: [PATCH 23/29] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b98881ea45..01445ac556 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150716 +Version: 6.0dev-150717 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 338fd4f29d..3d7bff9204 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150716" +pandora_version="6.0dev-150717" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index bacca134ae..dc43c2f805 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150716'; +use constant AGENT_BUILD => '150717'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 69edba0001..2e15cde877 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150716 +%define release 150717 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index f02d88cf0a..77111a61e8 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150716 +%define release 150717 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 049b020557..d1c57d4f56 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150716} +{150717} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index ceb697ec21..4e82492bec 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.0dev(Build 150716)") +#define PANDORA_VERSION ("6.0dev(Build 150717)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 50dbc6acd1..a9a1d441b8 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.0dev(Build 150716))" + VALUE "ProductVersion", "(6.0dev(Build 150717))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index d392dd4d64..95c5f1d0ca 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150716 +Version: 6.0dev-150717 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 06774279b9..29149edf5a 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150716" +pandora_version="6.0dev-150717" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b849f2f11d..f741eca953 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150716'; +$build_version = 'PC150717'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index d0b7c3ea92..4965f80d43 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
Date: Fri, 17 Jul 2015 09:49:44 +0200 Subject: [PATCH 24/29] Fixed heigth in pure view when view services map. Tiquet: #2470 --- pandora_console/include/styles/pandora.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 3b20ea9b03..df23f1692e 100755 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1507,10 +1507,10 @@ div#main_pure { background-color: #fefefe; text-align: left; margin-bottom: 25px; - margin-top: 10px; + margin-top: 30px; margin-left: 10px; margin-right: 10px; - height: auto; + height: 1000px; width: 98%; position: static; } @@ -2592,9 +2592,10 @@ div#agent_wizard_subtabs { #container_servicemap_legend { position: absolute; width: 200px; - background: #F4F4F4; + background: #FFF; margin-top: 10px; right: 2px; + border: 1px solid #E2E2E2; border-radius: 5px; padding: 10px; opacity: .90; From a90111ac1895962bd7ce9ae0a7d98f9d45d54950 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 17 Jul 2015 10:02:11 +0200 Subject: [PATCH 25/29] Restored the call 'get_agent_modules_json_for_multiple_agents' and improved their performance --- pandora_console/include/ajax/module.php | 108 --------- pandora_console/include/javascript/pandora.js | 2 +- .../operation/agentes/ver_agente.php | 214 ++++++++++++++++++ 3 files changed, 215 insertions(+), 109 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 98a9a8ab6c..74b828036a 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -32,114 +32,6 @@ $change_module_relation_updates = (bool) get_parameter('change_module_relation_u $get_id_tag = (bool) get_parameter('get_id_tag', 0); $list_modules = (bool) get_parameter('list_modules', 0); -$get_agent_modules_json_for_multiple_agents = (bool)get_parameter( - "get_agent_modules_json_for_multiple_agents"); - -if ($get_agent_modules_json_for_multiple_agents) { - $idAgents = (array)get_parameter('id_agent'); - $custom_condition = get_parameter('custom_condition', ''); - $selection_mode = get_parameter('selection_mode', 'common'); - $serialized = get_parameter('serialized', ''); - $id_server = (int)get_parameter('id_server', 0); - $metaconsole_server_name = null; - - $all = (string)get_parameter('all', 'all'); - switch ($all) { - default: - case 'all': - $enabled = '1 = 1'; - break; - case 'enabled': - $enabled = 'disabled = 0'; - break; - } - - $result = array(); - - - if (is_metaconsole()) { - - $rows = db_get_all_rows_filter('tmetaconsole_agent', - array("id_tagente" => $idAgents), - array('id_agente', 'id_tmetaconsole_setup')); - - $agents = array(); - foreach ($rows as $row) { - $agents[$row['id_tmetaconsole_setup']][] = - $row['id_agente']; - } - - foreach ($idAgents as $id_agent) { - $id_tmetaconsole_setup = db_get_value_filter( - 'id_tmetaconsole_setup', 'tmetaconsole_agent', - array("id_tagente" => $idAgents)); - - if (metaconsole_connect(null, $id_tmetaconsole_setup) != NOERR) { - continue; - } - - - - metaconsole_restore_db(); - } - } - else { - $agents[0] = $idAgents; - } - - $result = array(); - foreach ($agents as $id_server => $agents) { - if ($id_server) { - if (metaconsole_connect(null, $id_server) != NOERR) { - continue; - } - } - - $sql = 'SELECT DISTINCT(nombre) - FROM tagente_modulo t1 - WHERE ' . $enabled . - io_safe_output($custom_condition) . ' - AND delete_pending = 0 - AND id_agente IN (' . implode(',', $idAgents) . ')'; - - if ($selection_mode == 'common') { - $sql .= ' AND ( - SELECT count(nombre) - FROM tagente_modulo t2 - WHERE delete_pending = 0 AND t1.nombre = t2.nombre - AND id_agente IN (' . implode(',', $idAgents) . ')) = (' . count($idAgents) . ')'; - } - - $sql .= ' ORDER BY nombre'; - - $nameModules = db_get_all_rows_sql($sql); - - if ($nameModules == false) { - $nameModules = array(); - } - - $temp = array(); - foreach ($nameModules as $nameModule) { - if (empty($serialized)) - $temp[io_safe_output($nameModule['nombre'])] = - ui_print_truncate_text( - io_safe_output($nameModule['nombre']), 'module_medium', false, true); - else - $temp[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true); - } - - if ($id_server) { - metaconsole_restore_db(); - } - - foreach ($temp as $i => $t) { - $result[$i] = $t; - } - } - - echo json_encode($result); - return; -} if ($get_plugin_macros) { $id_plugin = get_parameter('id_plugin', 0); diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index c63dc2df8d..dbb20a339f 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -201,7 +201,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { jQuery.post (homedir + '/ajax.php', { - "page": "include/ajax/module", + "page": "operation/agentes/ver_agente", "get_agent_modules_json_for_multiple_agents": 1, "id_agent[]": idAgents, "all": find_modules, diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 1d41e3ef62..a3a384c246 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -35,6 +35,7 @@ if (is_ajax ()) { $get_agent_modules_json = (bool) get_parameter ('get_agent_modules_json'); $get_agent_status_tooltip = (bool) get_parameter ("get_agent_status_tooltip"); $get_agents_group_json = (bool) get_parameter ("get_agents_group_json"); + $get_agent_modules_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_json_for_multiple_agents"); $get_agent_modules_alerts_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_alerts_json_for_multiple_agents"); $get_agents_json_for_multiple_modules = (bool) get_parameter("get_agents_json_for_multiple_modules"); $get_agent_modules_json_for_multiple_agents_id = (bool) get_parameter("get_agent_modules_json_for_multiple_agents_id"); @@ -171,6 +172,219 @@ if (is_ajax ()) { return; } + if ($get_agent_modules_alerts_json_for_multiple_agents) { + $idAgents = get_parameter('id_agent'); + $id_template = get_parameter('template'); + + $selection_mode = get_parameter('selection_mode','common'); + + $sql = 'SELECT DISTINCT(nombre) + FROM tagente_modulo t1, talert_template_modules t2 + WHERE t2.id_agent_module = t1.id_agente_modulo + AND delete_pending = 0 + AND id_alert_template = '.$id_template.' + AND id_agente IN (' . implode(',', $idAgents) . ')'; + + if ($selection_mode == 'common') { + $sql .= ' AND ( + SELECT count(nombre) + FROM tagente_modulo t3, talert_template_modules t4 + WHERE t4.id_agent_module = t3.id_agente_modulo + AND delete_pending = 0 AND t1.nombre = t3.nombre + AND id_agente IN (' . implode(',', $idAgents) . ') + AND id_alert_template = '.$id_template.') = (' . count($idAgents) . ')'; + } + + $sql .= ' ORDER BY t1.nombre'; + + $nameModules = db_get_all_rows_sql($sql); + + if ($nameModules == false) { + $nameModules = array(); + } + + $result = array(); + foreach($nameModules as $nameModule) { + $result[] = io_safe_output($nameModule['nombre']); + } + + echo json_encode($result); + return; + } + + if ($get_agent_modules_json_for_multiple_agents) { + $idAgents = get_parameter('id_agent'); + $custom_condition = get_parameter('custom_condition', ''); + $selection_mode = get_parameter('selection_mode', 'common'); + $serialized = get_parameter('serialized', ''); + $id_server = (int) get_parameter('id_server', 0); + $metaconsole_server_name = null; + if ($id_server != 0) { + $metaconsole_server_name = db_get_value('server_name', + 'tmetaconsole_setup', 'id', $id_server); + } + + $all = (string)get_parameter('all', 'all'); + switch ($all) { + default: + case 'all': + $enabled = '1 = 1'; + break; + case 'enabled': + $enabled = 'disabled = 0'; + break; + } + + if (is_metaconsole()) { + $result = array(); + $nameModules = array(); + $temp = array(); + $first = true; + $temp_element = array(); + $counter = 0; + $first_elements = array(); + + $array_mapped = array_map(function($item) use ($metaconsole_server_name) { + if (empty($metaconsole_server_name)) { + if (strstr($item, "|@_@|")) { + $row = explode ('|@_@|', $item); + } + else { + $row = explode ('|', $item); + } + $server_name = array_shift($row); + $id_agent = array_shift($row); + } + else { + $server_name = $metaconsole_server_name; + $id_agent = $item; + } + + return array( + 'server_name' => $server_name, + 'id_agent' => $id_agent + ); + + }, $idAgents); + + $array_reduced = array_reduce($array_mapped, function($carry, $item) { + + if (!isset($carry[$item['server_name']])) + $carry[$item['server_name']] = array(); + + $carry[$item['server_name']][] = $item['id_agent']; + + return $carry; + + }, array()); + + $last_modules_set = array(); + + foreach ($array_reduced as $server_name => $id_agents) { + //Metaconsole db connection + $connection = metaconsole_get_connection($server_name); + if (metaconsole_load_external_db($connection) != NOERR) { + continue; + } + + //Get agent's modules + $sql = sprintf('SELECT t1.id_agente, t1.id_agente_modulo, t1.nombre + FROM tagente_modulo t1 + WHERE %s + AND t1.delete_pending = 0 + AND t1.id_agente IN (%s) + AND ( + SELECT COUNT(nombre) + FROM tagente_modulo t2 + WHERE t2.delete_pending = 0 + AND t1.nombre = t2.nombre + AND t2.id_agente IN (%s)) = (%d)', + $enabled, implode(',', $id_agents), + implode(',', $id_agents), count($id_agents)); + + $modules = db_get_all_rows_sql($sql); + if (empty($modules)) + $modules = array(); + + $modules_aux = array(); + foreach ($modules as $key => $module) { + // Don't change this order, is used in the serialization + $module_data = array( + 'id_module' => $module['id_agente_modulo'], + 'id_agent' => $module['id_agente'], + 'server_name' => $server_name + ); + if (!isset($modules_aux[$module['nombre']])) + $modules_aux[$module['nombre']] = array(); + $modules_aux[$module['nombre']][] = $module_data; + } + $modules = $modules_aux; + + // Build the next array using the common values + if (!empty($last_modules_set)) { + $modules = array_intersect_key($modules, $last_modules_set); + + array_walk($modules, function(&$module_data, $module_name) use ($last_modules_set) { + $module_data = array_merge($module_data, $last_modules_set[$module_name]); + }); + } + $last_modules_set = $modules; + + //Restore db connection + metaconsole_restore_db(); + } + + $result = array(); + foreach ($last_modules_set as $module_name => $module_data) { + $value = ui_print_truncate_text(io_safe_output($module_name), 'module_medium', false, true); + + $module_data_processed = array_map(function($item) { + // data: -> id_module | id_agent | server_name; + return implode('|', $item); + }, $module_data); + $key = implode(';', $module_data_processed); + + $result[$key] = $value; + } + } + else { + $sql = 'SELECT DISTINCT(nombre) + FROM tagente_modulo t1 + WHERE ' . $enabled . + io_safe_output($custom_condition) . ' + AND delete_pending = 0 + AND id_agente IN (' . implode(',', $idAgents) . ')'; + + if ($selection_mode == 'common') { + $sql .= ' AND ( + SELECT count(nombre) + FROM tagente_modulo t2 + WHERE delete_pending = 0 AND t1.nombre = t2.nombre + AND id_agente IN (' . implode(',', $idAgents) . ')) = (' . count($idAgents) . ')'; + } + + $sql .= ' ORDER BY nombre'; + + $nameModules = db_get_all_rows_sql($sql); + + if ($nameModules == false) { + $nameModules = array(); + } + + $result = array(); + foreach ($nameModules as $nameModule) { + if (empty($serialized)) + $result[io_safe_output($nameModule['nombre'])] = + ui_print_truncate_text( + io_safe_output($nameModule['nombre']), 'module_medium', false, true); + else + $result[io_safe_output($nameModule['nombre']).'$*$'.implode('|', $idAgents)] = ui_print_truncate_text(io_safe_output($nameModule['nombre']), 'module_medium', false, true); + } + } + + echo json_encode($result); + return; + } if ($get_agent_modules_json) { $id_agent = (int) get_parameter ('id_agent'); From 8bdc11a00c33f70735463a5a38248c554e58363e Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Fri, 17 Jul 2015 10:47:30 +0200 Subject: [PATCH 26/29] Reorganizate requiere_once for see correct Snapshot view. Tiquet:#2452 --- .../operation/agentes/snapshot_view.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pandora_console/operation/agentes/snapshot_view.php b/pandora_console/operation/agentes/snapshot_view.php index f219b28120..b8b50857c2 100644 --- a/pandora_console/operation/agentes/snapshot_view.php +++ b/pandora_console/operation/agentes/snapshot_view.php @@ -14,19 +14,20 @@ // GNU General Public License for more details. - -// Global & session management -require_once ('../../include/config.php'); -require_once ('../../include/auth/mysql.php'); - if (! isset($_SESSION['id_usuario'])) { session_start(); - session_write_close(); + //session_write_close(); } +require_once ('../../include/config.php'); +require_once ($config['homedir'] . '/include/auth/mysql.php'); require_once ($config['homedir'] . '/include/functions.php'); require_once ($config['homedir'] . '/include/functions_db.php'); -require_once ($config['homedir'] . '/include/functions_ui.php'); +require_once ($config['homedir'] . '/include/functions_reporting.php'); +require_once ($config['homedir'] . '/include/functions_graph.php'); +require_once ($config['homedir'] . '/include/functions_modules.php'); +require_once ($config['homedir'] . '/include/functions_agents.php'); +require_once ($config['homedir'] . '/include/functions_tags.php'); check_login (); From 362f9863cf97dc5c59fbd397e955f5b8c120a3ed Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 18 Jul 2015 00:01:12 +0200 Subject: [PATCH 27/29] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 01445ac556..a839768645 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150717 +Version: 6.0dev-150718 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 3d7bff9204..65abc8eee7 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150717" +pandora_version="6.0dev-150718" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index dc43c2f805..4dcedaf84f 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150717'; +use constant AGENT_BUILD => '150718'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 2e15cde877..9432419886 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150717 +%define release 150718 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 77111a61e8..61580e6a6d 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150717 +%define release 150718 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index d1c57d4f56..7f2ecd0e34 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150717} +{150718} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 4e82492bec..c489926184 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.0dev(Build 150717)") +#define PANDORA_VERSION ("6.0dev(Build 150718)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a9a1d441b8..11c1654199 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.0dev(Build 150717))" + VALUE "ProductVersion", "(6.0dev(Build 150718))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 95c5f1d0ca..bfc256901c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150717 +Version: 6.0dev-150718 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 29149edf5a..b621e639e4 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150717" +pandora_version="6.0dev-150718" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index f741eca953..d2f1dd307f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150717'; +$build_version = 'PC150718'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 4965f80d43..21d6b4c086 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
Date: Sun, 19 Jul 2015 00:01:09 +0200 Subject: [PATCH 28/29] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index a839768645..fbcc00b3f5 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150718 +Version: 6.0dev-150719 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 65abc8eee7..d85d6ad0ff 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150718" +pandora_version="6.0dev-150719" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 4dcedaf84f..e209f02dc8 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150718'; +use constant AGENT_BUILD => '150719'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 9432419886..6edf302996 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150718 +%define release 150719 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 61580e6a6d..41e6852646 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150718 +%define release 150719 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 7f2ecd0e34..bee96e2313 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150718} +{150719} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index c489926184..0385b9a1ee 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.0dev(Build 150718)") +#define PANDORA_VERSION ("6.0dev(Build 150719)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 11c1654199..2b5e30f0eb 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.0dev(Build 150718))" + VALUE "ProductVersion", "(6.0dev(Build 150719))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index bfc256901c..314ee510bc 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150718 +Version: 6.0dev-150719 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index b621e639e4..bdaf8e47f4 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150718" +pandora_version="6.0dev-150719" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index d2f1dd307f..7415fa401d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150718'; +$build_version = 'PC150719'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 21d6b4c086..6e888624f7 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
Date: Mon, 20 Jul 2015 00:01:09 +0200 Subject: [PATCH 29/29] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index fbcc00b3f5..a92af2c896 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150719 +Version: 6.0dev-150720 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index d85d6ad0ff..871830ae60 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150719" +pandora_version="6.0dev-150720" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index e209f02dc8..397d62196e 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150719'; +use constant AGENT_BUILD => '150720'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 6edf302996..4cd1a8b682 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150719 +%define release 150720 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 41e6852646..e14a5d460f 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.0dev -%define release 150719 +%define release 150720 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index bee96e2313..717062af4c 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150719} +{150720} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 0385b9a1ee..8e5243ad46 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.0dev(Build 150719)") +#define PANDORA_VERSION ("6.0dev(Build 150720)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 2b5e30f0eb..87e37b80d5 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.0dev(Build 150719))" + VALUE "ProductVersion", "(6.0dev(Build 150720))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 314ee510bc..3eee0dda6b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150719 +Version: 6.0dev-150720 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index bdaf8e47f4..cb6dd63dad 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.0dev-150719" +pandora_version="6.0dev-150720" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7415fa401d..79f43a660f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150719'; +$build_version = 'PC150720'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 6e888624f7..7ed405c3a5 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@