Merge branch 'pandora_5.1' of https://github.com/pandorafms/pandorafms into pandora_5.1

This commit is contained in:
m-lopez-f 2015-01-28 10:14:28 +01:00
commit cf90acb05a
25 changed files with 114 additions and 24 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 5.1SP2-150127
Version: 5.1SP2-150128
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="5.1SP2-150127"
pandora_version="5.1SP2-150128"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '5.1SP2';
use constant AGENT_BUILD => '150127';
use constant AGENT_BUILD => '150128';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 5.1SP2
%define release 150127
%define release 150128
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 5.1SP2
%define release 150127
%define release 150128
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150127}
{150128}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("5.1SP2(Build 150127)")
#define PANDORA_VERSION ("5.1SP2(Build 150128)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(5.1SP2(Build 150127))"
VALUE "ProductVersion", "(5.1SP2(Build 150128))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 5.1SP2-150127
Version: 5.1SP2-150128
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="5.1SP2-150127"
pandora_version="5.1SP2-150128"
package_pear=0
package_pandora=1

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150127';
$build_version = 'PC150128';
$pandora_version = 'v5.1SP2';
// Do not overwrite default timezone set if defined.

View File

@ -2679,4 +2679,28 @@ function events_get_count_events_validated ($filter, $period, $date,
return $return;
}
function events_checks_event_tags($event_data, $acltags) {
global $config;
if (empty($acltags[$event_data['id_grupo']])) {
return true;
} else {
$tags_arr_acl = explode(',',$acltags[$event_data['id_grupo']]);
$tags_arr_event = explode(',',$event_data['tags']);
foreach ($tags_arr_acl as $tag) {
$tag_name = tags_get_name($tag);
if (in_array($tag_name, $tags_arr_event)) {
return true;
} else {
$has_tag = false;
}
}
if (!$has_tag) {
return false;
}
}
return false;
}
?>

View File

@ -901,7 +901,8 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
if ($force_group_and_tag) {
if (!empty($all_tags[$tag])) {
$tags_condition .= sprintf('(tags = "%s"',io_safe_input($all_tags[$tag]));
//~ $tags_condition .= sprintf('(tags = "%s"',io_safe_input($all_tags[$tag]));
$tags_condition .= "(tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
$childrens = groups_get_childrens($group_id, null, true);
if (empty($childrens)) {
@ -919,7 +920,8 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
$tags_condition .= "id_grupo = ".$group_id;
}
} else {
$tags_condition .= sprintf('tags = "%s"',io_safe_input($all_tags[$tag]));
//~ $tags_condition .= sprintf('tags = "%s"',io_safe_input($all_tags[$tag]));
$tags_condition .= "tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
}
}
}
@ -1338,4 +1340,56 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c
return false;
}
/* Return array with groups and their tags */
function tags_get_user_module_and_tags ($id_user = false, $access = 'AR') {
global $config;
if ($id_user == false) {
$id_user = $config['id_user'];
}
$acl_column = get_acl_column($access);
$query = sprintf("SELECT tags, id_grupo
FROM tusuario_perfil, tperfil
WHERE tperfil.id_perfil = tusuario_perfil.id_perfil AND
tusuario_perfil.id_usuario = '%s' AND
tperfil.%s = 1
ORDER BY id_grupo", $id_user, $acl_column);
$tags_and_groups = db_get_all_rows_sql($query);
if ($tags_and_groups == false) {
$tags_and_groups = array();
}
$acltags = array();
if ((count($tags_and_groups) == 1) && ($tags_and_groups[0]['id_grupo'] == 0) && ($tags_and_groups[0]['tags'] == '')){ //user with all groups without tags
$all_groups = groups_get_all();
foreach ($all_groups as $id => $name) {
$acltags[$id] = '';
}
} else {
foreach ($tags_and_groups as $group_tag) {
$acltags[$group_tag['id_grupo']] = $group_tag['tags'];
$propagate = db_get_value('propagate', 'tgrupo', 'id_grupo', $group_tag['id_grupo']);
if ($propagate) {
$sql = "SELECT id_grupo FROM tgrupo WHERE parent = " .$group_tag['id_grupo'];
$children = db_get_all_rows_sql($sql);
if ($children == false) {
$children = array();
}
foreach ($children as $group) {
$acltags[$group['id_grupo']] = $group_tag['tags'];
}
}
}
}
return $acltags;
}
?>

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '5.1SP2';
$build = '150127';
$build = '150128';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -564,6 +564,18 @@ else {
$history);
}
if (!empty($result)) {
//~ Checking the event tags exactly. The event query filters approximated tags to keep events
//~ with several tags
$acltags = tags_get_user_module_and_tags ($config['id_user'],'ER', true);
foreach ($result as $key=>$event_data) {
$has_tags = events_checks_event_tags($event_data, $acltags);
if (!$has_tags) {
unset($result[$key]);
}
}
}
if (!empty($result)) {
$graph = '<div style="width: 350px; margin: 0 auto;">' .

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 5.1SP2
%define release 150127
%define release 150128
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 5.1SP2
%define release 150127
%define release 150128
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'),
('step_compact','1'),
('db_scheme_version','5.1SP2'),
('db_scheme_build','PD150127'),
('db_scheme_build','PD150128'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 5.1SP2-150127
Version: 5.1SP2-150128
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="5.1SP2-150127"
pandora_version="5.1SP2-150128"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "5.1SP2";
my $pandora_build = "150127";
my $pandora_build = "150128";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 5.1SP2
%define release 150127
%define release 150128
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 5.1SP2
%define release 150127
%define release 150128
Summary: Pandora FMS Server
Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "5.1SP2 PS150127";
my $version = "5.1SP2 PS150128";
# Pandora server configuration
my %conf;

View File

@ -34,7 +34,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "5.1SP2 PS150127";
my $version = "5.1SP2 PS150128";
# save program name for logging
my $progname = basename($0);