Merge remote-tracking branch 'origin/develop' into 3170-Cambios_custom_fields_view

Former-commit-id: eeb7679e966ce7ed9e1dfe925d64dbbe21a2a752
This commit is contained in:
daniel 2018-12-11 10:00:23 +01:00
commit 0fd61cb31e
36 changed files with 231 additions and 69 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.729-181210
Version: 7.0NG.729-181211
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="7.0NG.729-181210"
pandora_version="7.0NG.729-181211"
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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.729';
use constant AGENT_BUILD => '181210';
use constant AGENT_BUILD => '181211';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
%define release 181210
%define release 181211
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
%define release 181210
%define release 181211
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.729"
PI_BUILD="181210"
PI_BUILD="181211"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{181210}
{181211}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.729(Build 181210)")
#define PANDORA_VERSION ("7.0NG.729(Build 181211)")
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", "(7.0NG.729(Build 181210))"
VALUE "ProductVersion", "(7.0NG.729(Build 181211))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.729-181210
Version: 7.0NG.729-181211
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="7.0NG.729-181210"
pandora_version="7.0NG.729-181211"
package_pear=0
package_pandora=1

View File

@ -228,11 +228,11 @@ foreach ($result as $row) {
$rowPair = !$rowPair;
$data = array();
$data[0] = $row["id_usuario"];
$data[0] = io_safe_output($row["id_usuario"]);
$data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"];
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
. ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"];
$data[3] = io_safe_output($row["ip_origen"]);
$data[4] = io_safe_output($row["descripcion"]);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {

View File

@ -924,9 +924,8 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook ('update_agent', array ($id_agente));
ui_print_success_message (__('Successfully updated'));
$unsafe_alias = io_safe_output($alias);
db_pandora_audit("Agent management",
"Updated agent $unsafe_alias", false, false, $info);
"Updated agent $alias", false, false, $info);
}
}
@ -1427,7 +1426,7 @@ if ($update_module) {
$edit_module = true;
db_pandora_audit("Agent management",
"Fail to try update module '".io_safe_output($name)."' for agent " . io_safe_output($agent["alias"]));
"Fail to try update module '$name' for agent " . $agent["alias"]);
}
else {
if ($prediction_module == 3) {
@ -1445,7 +1444,7 @@ if ($update_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Updated module '".io_safe_output($name)."' for agent ". io_safe_output($agent["alias"]), false, false, io_json_mb_encode($values));
"Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
}
}
@ -1586,7 +1585,7 @@ if ($create_module) {
$edit_module = true;
$moduletype = $id_module;
db_pandora_audit("Agent management",
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]));
"Fail to try added module '$name' for agent ".$agent["alias"]);
}
else {
if ($prediction_module == 3) {
@ -1604,7 +1603,7 @@ if ($create_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]), false, true, io_json_mb_encode($values));
"Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
}
}
@ -1727,7 +1726,7 @@ if ($delete_module) { // DELETE agent module !
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Deleted module '".io_safe_output($module_data["nombre"])."' for agent ".io_safe_output($agent["alias"]));
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
}
@ -1760,11 +1759,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
if ($result) {
db_pandora_audit("Agent management",
"Duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]) . " with the new id for clon " . $result);
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
}
else {
db_pandora_audit("Agent management",
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]));
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
}
}

View File

@ -16,6 +16,8 @@
global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login ();
if (! check_acl($config['id_user'], 0, "PM")) {

View File

@ -48,7 +48,7 @@ if ($create_profiles) {
// If the profile doesnt exist, we create it
if ($profile_data === false) {
db_pandora_audit("User management",
"Added profile for user ".io_safe_output($user));
"Added profile for user ".io_safe_input($user));
$return = profile_create_user_profile ($user, $profile, $group);
if ($return !== false) {
$n_added ++;

View File

@ -242,7 +242,7 @@ if ($create_user) {
}
db_pandora_audit("User management",
"Created user ".io_safe_output($id), false, false, $info);
"Created user ".io_safe_input($id), false, false, $info);
ui_print_result_message ($result,
__('Successfully created'),
@ -392,7 +392,7 @@ if ($update_user) {
}
db_pandora_audit("User management", "Updated user ".io_safe_output($id),
db_pandora_audit("User management", "Updated user ".io_safe_input($id),
false, false, $info);
ui_print_result_message ($res1,
@ -450,7 +450,7 @@ if ($add_profile) {
$tags = implode(',', $tags);
db_pandora_audit("User management",
"Added profile for user ".io_safe_output($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
"Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
ui_print_result_message ($return,
__('Profile added successfully'),
@ -466,7 +466,7 @@ if ($delete_profile) {
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
db_pandora_audit("User management",
"Deleted profile for user ".io_safe_output($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
"Deleted profile for user ".io_safe_input($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
$return = profile_delete_user_profile ($id2, $id_up);
ui_print_result_message ($return,

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC181210';
$build_version = 'PC181211';
$pandora_version = 'v7.0NG.729';
// Do not overwrite default timezone set if defined.

View File

@ -485,8 +485,6 @@ define("OPTION_AGENT_AUTOCOMPLETE", 9);
define("OPTION_SELECT_MULTISELECTION", 10);
define("OPTION_COLOR_PICKER", 11);
define("DASHBOARD_WIDGET_ID_VISUAL_CONSOLE", 22);
/* Transactional map constants */
define("NODE_TYPE", 0);
define("ARROW_TYPE", 1);

View File

@ -159,7 +159,8 @@ function reporting_make_reporting_data($report = null, $id_report,
true);
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo";
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo
LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent";
$sql = sprintf('SELECT count(*) FROM tagente_modulo t1
%s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '. $content["id_agent_module"] .'

View File

@ -808,8 +808,11 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
$tags_condition = $group_condition . " AND (" . implode(" OR ", $tags_condition_array) . ")";
$condition[] = "($tags_condition)\n";
}
if (!empty($condition)) {
$condition = implode(' OR ', $condition);
} else {
$condition = '';
}
if (!empty($without_tags)) {

View File

@ -252,7 +252,7 @@ div.installation_step {
.popup-button-green{
background-color: #82B92E;
border: 1px solid transparent;
color: blue;
color: #FFF;
}
.popup-button-green span{
@ -262,7 +262,7 @@ div.installation_step {
.popup-button-green:hover{
background-color: transparent !important;
border: 1px solid #82B92E;
color: red !important;
color: #82B92E !important;
}
.popup-button-green:hover span{

View File

@ -360,7 +360,7 @@ if (! isset ($config['id_user'])) {
if ($blocked) {
require_once ('general/login_page.php');
db_pandora_audit("Password expired", "Password expired: ".io_safe_output($nick), io_safe_output($nick));
db_pandora_audit("Password expired", "Password expired: ".$nick, $nick);
while (@ob_end_flush ());
exit ("</html>");
}
@ -383,7 +383,7 @@ if (! isset ($config['id_user'])) {
require_once ('general/login_page.php');
db_pandora_audit("Password expired",
"Password expired: " . io_safe_output($nick), $nick);
"Password expired: " . $nick, $nick);
while (@ob_end_flush ());
exit ("</html>");
}
@ -541,20 +541,20 @@ if (! isset ($config['id_user'])) {
if ((!is_user_admin($nick) || $config['enable_pass_policy_admin']) && file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
$blocked = login_check_blocked($nick);
}
$nick_usable = io_safe_output($nick);
if (!$blocked) {
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
login_check_failed($nick); //Checks failed attempts
}
$login_failed = true;
require_once ('general/login_page.php');
db_pandora_audit("Logon Failed", "Invalid login: ".$nick_usable, $nick_usable);
db_pandora_audit("Logon Failed", "Invalid login: ".$nick, $nick);
while (@ob_end_flush ());
exit ("</html>");
}
else {
require_once ('general/login_page.php');
db_pandora_audit("Logon Failed", "Invalid login: ".$nick_usable, $nick_usable);
db_pandora_audit("Logon Failed", "Invalid login: ".$nick, $nick);
while (@ob_end_flush ());
exit ("</html>");
}

View File

@ -33,6 +33,9 @@
<script type="text/javascript">
options_text = new Array('An existing Database','A new Database');
options_values = new Array('db_exist','db_new');
var userHasConfirmed = false;
function ChangeDBDrop(causer) {
if (causer.value != 'db_exist') {
window.document.step2_form.drop.checked = 0;
@ -79,6 +82,19 @@
document.getElementById('open_popup').style["display"] = "none";
document.getElementById('open_popup').style["visibility"] = "hidden";
}
function handleConfirmClick (event) {
userHasConfirmed = true;
var step3_form = document.getElementsByName('step2_form')[0];
step3_form.submit();
}
function handleStep3FormSubmit (event) {
var dbOverride = document.getElementById("drop").checked;
if (dbOverride && !userHasConfirmed) {
event.preventDefault();
popupShow();
return false;
}
}
</script>
<body>
<div id='add-lightbox' onclick='popupClose();' class='popup-lightbox'></div>
@ -87,12 +103,12 @@
<span id='title_popup'>Warning</span>
<a href='#' onclick='popupClose();'><img src='./images/icono_cerrar.png' alt='close' title='Close' style='float:right;'/></a>
</div>
<div id='editor_section' class='popup-inner' style='padding: 20px 40px;'>
<div class='popup-inner' style='padding: 20px 40px;'>
<?php
echo "<p><strong>Attention</strong>, you are going to <strong>overwrite the data</strong> of your current installation.</p><p>This means that if you do not have a backup <strong>you will irremissibly LOSE ALL THE STORED DATA</strong>, the configuration and everything relevant to your installation.</p><p><strong>Are you sure of what you are going to do?</strong></p>";
echo "<div style='text-align:right;';>";
echo "<a id='step4popup' href='install.php?step=4'><button type='submit' class='btn_install_next'><span class='btn_install_next_text'>Yes, I'm sure I want to delete everything</span></button></a>";
echo "<a href='javascript:popupClose();'><button type='submit' class='btn_install_next popup-button-green'><span class='btn_install_next_text'>Cancel</span></button></a>";
echo "<button type='button' class='btn_install_next' onclick='javascript:handleConfirmClick();'><span class='btn_install_next_text'>Yes, I'm sure I want to delete everything</span></button>";
echo "<button type='button' class='btn_install_next popup-button-green' onclick='javascript:popupClose();'><span class='btn_install_next_text'>Cancel</span></button>";
echo "</div>";
?>
</div>
@ -100,7 +116,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.729';
$build = '181210';
$build = '181211';
$banner = "v$version Build $build";
error_reporting(0);
@ -670,17 +686,8 @@ function install_step3() {
echo "</div>";
?>
<script type="text/javascript">
var checkDrop = document.getElementById('step4button').addEventListener("click", function(event){
if(document.getElementById("drop").checked){
popupShow();
}
else{
document.getElementsByName('step2_form')[0].submit();
}
event.preventDefault();
});
var step3_form = document.getElementsByName('step2_form')[0];
step3_form.addEventListener("submit", checkDrop, true);
step3_form.addEventListener("submit", handleStep3FormSubmit);
</script>
<?php
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.729
%define release 181210
%define release 181211
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.729
%define release 181210
%define release 181211
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.729-181210
Version: 7.0NG.729-181211
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="7.0NG.729-181210"
pandora_version="7.0NG.729-181211"
package_cpan=0
package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.729";
my $pandora_build = "181210";
my $pandora_build = "181211";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3060,7 +3060,8 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$) {
'custom_id' => $custom_id,
'url_address' => $url_address,
'timezone_offset' => $timezone_offset,
'alias' => $alias
'alias' => $alias,
'update_module_count' => 1, # Force to replicate in metaconsole
});
my $agent_id = db_insert ($dbh, 'id_agente', "INSERT INTO tagente $columns", @{$values});

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.729";
my $pandora_build = "181210";
my $pandora_build = "181211";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -35,6 +35,8 @@ use threads;
# Used to calculate the MD5 checksum of a string
use constant MOD232 => 2**32;
# 2 to the power of 32.
use constant POW232 => 2**32;
# UTF-8 flags deletion from multibyte characters when files are opened.
use open OUT => ":utf8";
@ -122,6 +124,7 @@ our @EXPORT = qw(
check_server_threads
start_server_thread
stop_server_threads
generate_agent_name_hash
);
# ID of the different servers
@ -1813,6 +1816,146 @@ sub stop_server_threads {
@ServerThreads = ();
}
################################################################################
# Generate random hash as agent name.
################################################################################
sub generate_agent_name_hash {
my ($agent_alias, $server_ip) = @_;
return sha256(join('|', ($agent_alias, $server_ip, time(), sprintf("%04d", rand(10000)))));
}
###############################################################################
# Return the SHA256 checksum of the given string as a hex string.
# Pseudocode from: http://en.wikipedia.org/wiki/SHA-2#Pseudocode
###############################################################################
my @K2 = (
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
);
sub sha256 {
my $str = shift;
# No input!
if (!defined($str)) {
return "";
}
# Note: All variables are unsigned 32 bits and wrap modulo 2^32 when
# calculating.
# First 32 bits of the fractional parts of the square roots of the first 8
# primes.
my $h0 = 0x6a09e667;
my $h1 = 0xbb67ae85;
my $h2 = 0x3c6ef372;
my $h3 = 0xa54ff53a;
my $h4 = 0x510e527f;
my $h5 = 0x9b05688c;
my $h6 = 0x1f83d9ab;
my $h7 = 0x5be0cd19;
# Pre-processing.
my $msg = unpack ("B*", pack ("A*", $str));
my $bit_len = length ($msg);
# Append "1" bit to message.
$msg .= '1';
# Append "0" bits until message length in bits = 448 (mod 512).
$msg .= '0' while ((length ($msg) % 512) != 448);
# Append bit /* bit, not byte */ length of unpadded message as 64-bit
# big-endian integer to message.
$msg .= unpack ("B32", pack ("N", $bit_len >> 32));
$msg .= unpack ("B32", pack ("N", $bit_len));
# Process the message in successive 512-bit chunks.
for (my $i = 0; $i < length ($msg); $i += 512) {
my @w;
my $chunk = substr ($msg, $i, 512);
# Break chunk into sixteen 32-bit big-endian words.
for (my $j = 0; $j < length ($chunk); $j += 32) {
push (@w, unpack ("N", pack ("B32", substr ($chunk, $j, 32))));
}
# Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array:
for (my $i = 16; $i < 64; $i++) {
my $s0 = rightrotate($w[$i - 15], 7) ^ rightrotate($w[$i - 15], 18) ^ ($w[$i - 15] >> 3);
my $s1 = rightrotate($w[$i - 2], 17) ^ rightrotate($w[$i - 2], 19) ^ ($w[$i - 2] >> 10);
$w[$i] = ($w[$i - 16] + $s0 + $w[$i - 7] + $s1) % POW232;
}
# Initialize working variables to current hash value.
my $a = $h0;
my $b = $h1;
my $c = $h2;
my $d = $h3;
my $e = $h4;
my $f = $h5;
my $g = $h6;
my $h = $h7;
# Compression function main loop.
for (my $i = 0; $i < 64; $i++) {
my $S1 = rightrotate($e, 6) ^ rightrotate($e, 11) ^ rightrotate($e, 25);
my $ch = ($e & $f) ^ ((0xFFFFFFFF & (~ $e)) & $g);
my $temp1 = ($h + $S1 + $ch + $K2[$i] + $w[$i]) % POW232;
my $S0 = rightrotate($a, 2) ^ rightrotate($a, 13) ^ rightrotate($a, 22);
my $maj = ($a & $b) ^ ($a & $c) ^ ($b & $c);
my $temp2 = ($S0 + $maj) % POW232;
$h = $g;
$g = $f;
$f = $e;
$e = ($d + $temp1) % POW232;
$d = $c;
$c = $b;
$b = $a;
$a = ($temp1 + $temp2) % POW232;
}
# Add the compressed chunk to the current hash value.
$h0 = ($h0 + $a) % POW232;
$h1 = ($h1 + $b) % POW232;
$h2 = ($h2 + $c) % POW232;
$h3 = ($h3 + $d) % POW232;
$h4 = ($h4 + $e) % POW232;
$h5 = ($h5 + $f) % POW232;
$h6 = ($h6 + $g) % POW232;
$h7 = ($h7 + $h) % POW232;
}
# Produce the final hash value (big-endian).
return unpack ("H*", pack ("N", $h0)) .
unpack ("H*", pack ("N", $h1)) .
unpack ("H*", pack ("N", $h2)) .
unpack ("H*", pack ("N", $h3)) .
unpack ("H*", pack ("N", $h4)) .
unpack ("H*", pack ("N", $h5)) .
unpack ("H*", pack ("N", $h6)) .
unpack ("H*", pack ("N", $h7));
}
###############################################################################
# Rotate a 32-bit number a number of bits to the right.
###############################################################################
sub rightrotate {
my ($x, $c) = @_;
return (0xFFFFFFFF & ($x << (32 - $c))) | ($x >> $c);
}
# End of function declaration
# End of defined Code

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.729
%define release 181210
%define release 181211
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.729
%define release 181210
%define release 181211
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.729"
PI_BUILD="181210"
PI_BUILD="181211"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.729 PS181210";
my $version = "7.0NG.729 PS181211";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.729 PS181210";
my $version = "7.0NG.729 PS181211";
# save program name for logging
my $progname = basename($0);
@ -103,7 +103,7 @@ sub help_screen{
print "Available options by category:\n\n" unless $param ne '';
print "Available options for $param:\n\n" unless $param eq '';
print "AGENTS:\n\n" unless $param ne '';
help_screen_line('--create_agent', "<agent_name> <operating_system> <group> <server_name> \n\t [<address> <description> <interval>]", 'Create agent');
help_screen_line('--create_agent', "<agent_name> <operating_system> <group> <server_name> \n\t [<address> <description> <interval> <alias_as_name>]", 'Create agent');
help_screen_line('--update_agent', '<agent_name> <field_to_change> <new_value>', "Update an agent field. The fields can be \n\t the following: agent_name, address, description, group_name, interval, os_name, disabled (0-1), \n\t parent_name, cascade_protection (0-1), icon_path, update_gis_data (0-1), custom_id");
help_screen_line('--delete_agent', '<agent_name>', 'Delete agent');
help_screen_line('--disable_group', '<group_name>', 'Disable agents from an entire group');
@ -996,21 +996,29 @@ sub cli_enable_group() {
##############################################################################
sub cli_create_agent() {
my ($agent_name,$os_name,$group_name,$server_name,$address,$description,$interval) = @ARGV[2..8];
my ($agent_name,$os_name,$group_name,$server_name,$address,$description,$interval, $alias_as_name) = @ARGV[2..9];
print_log "[INFO] Creating agent '$agent_name'\n\n";
$address = '' unless defined ($address);
$description = (defined ($description) ? safe_input($description) : '' ); # safe_input() might be better at pandora_create_agent() (when passing 'description' to db_insert())
$interval = 300 unless defined ($interval);
$alias_as_name = 1 unless defined ($alias_as_name);
my $agent_alias = undef;
if (!$alias_as_name) {
$agent_alias = $agent_name;
$agent_name = generate_agent_name_hash($agent_alias, $conf{'dbhost'});
}
my $id_group = get_group_id($dbh,$group_name);
exist_check($id_group,'group',$group_name);
my $os_id = get_os_id($dbh,$os_name);
exist_check($id_group,'operating system',$group_name);
my $agent_exists = get_agent_id($dbh,$agent_name);
non_exist_check($agent_exists, 'agent name', $agent_name);
pandora_create_agent ($conf, $server_name, $agent_name, $address, $id_group, 0, $os_id, $description, $interval, $dbh);
pandora_create_agent ($conf, $server_name, $agent_name, $address, $id_group, 0, $os_id, $description, $interval, $dbh,
undef, undef, undef, undef, undef, undef, undef, undef, $agent_alias);
}
##############################################################################
@ -5697,7 +5705,7 @@ sub pandora_manage_main ($$$) {
cli_enable_group();
}
elsif ($param eq '--create_agent') {
param_check($ltotal, 7, 3);
param_check($ltotal, 8, 4);
cli_create_agent();
}
elsif ($param eq '--delete_agent') {