Former-commit-id: dcf81c584d7d2dc8ee8def3e8786d7e67f92da46
This commit is contained in:
marcos.alconada 2019-04-24 16:20:42 +02:00
commit e543b64833
58 changed files with 665 additions and 210 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, AIX version
# Version 7.0NG.734, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, FreeBSD Version
# Version 7.0NG.734, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, HP-UX Version
# Version 7.0NG.734, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, GNU/Linux
# Version 7.0NG.734, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, GNU/Linux
# Version 7.0NG.734, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, Solaris Version
# Version 7.0NG.734, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.733
# Version 7.0NG.734
# 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

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.733, AIX version
# Version 7.0NG.734, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.733
# Version 7.0NG.734
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.733, HPUX Version
# Version 7.0NG.734, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733
# Version 7.0NG.734
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733
# Version 7.0NG.734
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733
# Version 7.0NG.734
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.733, Solaris version
# Version 7.0NG.734, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, AIX version
# Version 7.0NG.734, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, GNU/Linux
# Version 7.0NG.734, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, FreeBSD Version
# Version 7.0NG.734, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, HP-UX Version
# Version 7.0NG.734, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, GNU/Linux
# Version 7.0NG.734, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, GNU/Linux
# Version 7.0NG.734, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, NetBSD Version
# Version 7.0NG.734, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.733, Solaris Version
# Version 7.0NG.734, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -41,7 +41,7 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.733';
use constant AGENT_VERSION => '7.0NG.734';
use constant AGENT_BUILD => '190424';
# Agent log default file size maximum and instances

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.733
%define release 190424
%define version 7.0NG.734
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.733
%define release 190424
%define version 7.0NG.734
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,7 +9,7 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.733"
PI_VERSION="7.0NG.734"
PI_BUILD="190424"
OS_NAME=`uname -s`

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.733
# Version 7.0NG.734
# 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

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.733}
{Pandora FMS Windows Agent v7.0NG.734}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No}
Windows,Executable
{<%AppName%>-<%Version%>-Setup<%Ext%>}
{<%AppName%>-Setup<%Ext%>}
Windows,FileDescription
{<%AppName%> <%Version%> Setup}

View File

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

View File

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

View File

@ -1205,4 +1205,6 @@ ui_require_javascript_file('pandora_modules');
$('.command_macro').click(macros_click_locked_event);
}
</script>

View File

@ -416,15 +416,30 @@ class DiscoveryTaskList extends Wizard
// Exceptions: IPAM.
$ipam = false;
if ($task['id_recon_script'] != null) {
$recon_script_name = db_get_value('name', 'trecon_script', 'id_recon_script', $task['id_recon_script']);
if (io_safe_output($recon_script_name) == 'IPAM Recon'
&& enterprise_installed()
) {
$subnet_obj = json_decode($task['macros'], true);
$subnet = $subnet_obj['1']['value'];
$tipam_task_id = db_get_value('id', 'tipam_network', 'id_recon_task', $task['id_rt']);
$ipam = true;
$recon_script_data = db_get_row(
'trecon_script',
'id_recon_script',
$task['id_recon_script']
);
if ($recon_script_data !== false) {
$recon_script_name = $recon_script_data['name'];
if (io_safe_output($recon_script_name) == 'IPAM Recon'
&& enterprise_installed()
) {
$subnet_obj = json_decode($task['macros'], true);
$subnet = $subnet_obj['1']['value'];
$tipam_task_id = db_get_value(
'id',
'tipam_network',
'id_recon_task',
$task['id_rt']
);
$ipam = true;
}
}
} else {
$recon_script_data = false;
$recon_script_name = false;
}
if ($task['disabled'] == 0 && $server_name !== '') {
@ -476,7 +491,18 @@ class DiscoveryTaskList extends Wizard
}
if ($task['id_recon_script'] == 0) {
// Internal discovery task.
switch ($task['type']) {
case DISCOVERY_CLOUD_AWS_RDS:
// Discovery Applications MySQL.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Cloud RDS')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.Cloud.Aws.RDS');
break;
case DISCOVERY_APP_MYSQL:
// Discovery Applications MySQL.
$data[6] = html_print_image(
@ -594,7 +620,7 @@ class DiscoveryTaskList extends Wizard
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task),
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
).'">'.html_print_image(
@ -654,12 +680,30 @@ class DiscoveryTaskList extends Wizard
/**
* Return target url sub-string to edit target task.
*
* @param array $task With all data.
* @param array $task With all data.
* @param array $script With all script data or false if undefined.
*
* @return string
*/
public function getTargetWiz($task)
public function getTargetWiz($task, $script=false)
{
if ($script !== false) {
switch ($script['type']) {
case DISCOVERY_SCRIPT_CLOUD_AWS:
return 'wiz=cloud&mode=amazonws&page=1';
case DISCOVERY_SCRIPT_APP_VMWARE:
return 'wiz=app&mode=vmware&page=0';
case DISCOVERY_SCRIPT_IPAM_RECON:
return '';
case DISCOVERY_SCRIPT_IPMI_RECON:
default:
return 'wiz=hd&mode=customnetscan';
}
}
switch ($task['type']) {
case DISCOVERY_APP_MYSQL:
return 'wiz=app&mode=mysql&page=0';
@ -667,23 +711,18 @@ class DiscoveryTaskList extends Wizard
case DISCOVERY_APP_ORACLE:
return 'wiz=app&mode=oracle&page=0';
case DISCOVERY_APP_VMWARE:
return 'wiz=app&mode=vmware&page=0';
case DISCOVERY_CLOUD_AWS:
case DISCOVERY_CLOUD_AWS_EC2:
return 'wiz=cloud&mode=amazonws&page=1';
case DISCOVERY_CLOUD_AWS_RDS:
return 'wiz=cloud&mode=amazonws&sub=rds&page=0';
case 'console_task':
return 'wiz=ctask';
default:
if (empty($task['id_recon_script']) === true) {
return 'wiz=hd&mode=netscan';
if ($task['description'] == 'console_task') {
return 'wiz=ctask';
} else {
return 'wiz=hd&mode=customnetscan';
return 'wiz=hd&mode=netscan';
}
break;
}

View File

@ -594,11 +594,11 @@ class HostDevices extends Wizard
if (isset($this->page) === false
|| $this->page == 0
) {
// Comment input
$comment_input ='<div class="label_select"><label>'.__('Comment').':</label></div>';
$comment_input = '<div class="label_select"><label>'.__('Comment').':</label></div>';
$comment_input .= $this->printInput([
$comment_input .= $this->printInput(
[
'name' => 'comment',
'rows' => 1,
'columns' => 1,
@ -606,49 +606,55 @@ class HostDevices extends Wizard
'type' => 'textarea',
'size' => 25,
'class' => 'discovery_textarea_input',
'return' => true
]);
'return' => true,
]
);
// Task input
$taskname_input_label = '<div class="label_select"><label>'.__('Task name').':</label></div>';
$taskname_input = $this->printInput([
$taskname_input = $this->printInput(
[
'name' => 'taskname',
'value' => $this->task['name'],
'type' => 'text',
'size' => 25,
'class' => 'discovery_full_width_input'
]);
'class' => 'discovery_full_width_input',
]
);
// Network input
$network_input_label .= '<div class="label_select discovery_label_hint"><label>'.__('Network').':</label>'.ui_print_help_tip(__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), true).'</div>';
$network_input = $this->printInput([
$network_input = $this->printInput(
[
'name' => 'network',
'value' => $this->task['subnet'],
'type' => 'text',
'size' => 25,
'class' => 'discovery_full_width_input',
]);
]
);
// Discovery server input
$discovery_server_select_label = '<div class="label_select discovery_label_hint"><label>'.__('Discovery server').':</label>'.ui_print_help_tip(__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true).'</div>';
$discovery_server_select = $this->printInput([
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_server, name
$discovery_server_select = $this->printInput(
[
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_server, name
FROM tserver
WHERE server_type = %d
ORDER BY name',
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'return' => true,
'style' => 'width: 100%',
]);
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'return' => true,
'style' => 'width: 100%',
]
);
// Interval input
$interv_manual = 0;
@ -658,55 +664,61 @@ class HostDevices extends Wizard
$interval_input_label = '<div class="label_select discovery_label_hint" style="padding-top: 6px;"><label>'.__('Interval').':</label>'.ui_print_help_tip(__('Manual interval means that it will run only on demand.'), true).'</div>';
$interval_input = $this->printInput([
'type' => 'select',
'selected' => $interv_manual,
'fields' => [
0 => __('Defined'),
1 => __('Manual'),
],
'name' => 'interval_manual_defined',
'return' => true,
'style' => 'float: right;'
]);
$interval_input = $this->printInput(
[
'type' => 'select',
'selected' => $interv_manual,
'fields' => [
0 => __('Defined'),
1 => __('Manual'),
],
'name' => 'interval_manual_defined',
'return' => true,
'style' => 'float: right;',
]
);
$interval_input_extra = '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval',
$this->task['interval_sweep'],
'',
'',
'0',
false,
true,
false,
false
).ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'),
true
).'</span>';
'interval',
$this->task['interval_sweep'],
'',
'',
'0',
false,
true,
false,
false
).ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'),
true
).'</span>';
// Group select
$group_select = '<div class="label_select"><label>'.__('Group').':</label></div>';
$group_select .= $this->printInput([
'name' => 'id_group',
'returnAllGroup' => false,
'privilege' => 'PM',
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'return' => true,
'class' => 'discovery_list_input',
'size' => 9,
]);
$group_select .= $this->printInput(
[
'name' => 'id_group',
'returnAllGroup' => false,
'privilege' => 'PM',
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'return' => true,
'class' => 'discovery_list_input',
'size' => 9,
'simple_multiple_options' => true,
]
);
if (isset($this->task['id_rt']) === true) {
//Propagate ID
$task_hidden = $this->printInput([
'name' => 'task',
'value' => $this->task['id_rt'],
'type' => 'hidden'
]);
if (isset($this->task['id_rt']) === true) {
// Propagate ID
$task_hidden = $this->printInput(
[
'name' => 'task',
'value' => $this->task['id_rt'],
'type' => 'hidden',
]
);
}
$task_url = '';
@ -724,32 +736,20 @@ class HostDevices extends Wizard
// XXX: Could be improved validating inputs before continue (JS)
// Print NetScan page 0.
//$this->printForm($form);
// $this->printForm($form);
echo '<form action="'.$this->url.'&mode=netscan&page='.($this->page + 1).$task_url.'" method="POST">';
echo $task_hidden;
echo '<div class="white_box">
<div class="edit_discovery_info" style="margin-bottom: 15px;">
<div style="width: 25%; padding: 9px;">'
.'<div style="height: 50%; margin-bottom: 35px;">'.html_print_image ("images/wizard/netscan_green.png", true, array ("title" => __('Close'), "style" => 'width: 60%;'), false).'</div>'
.'<div class="edit_discovery_input"><div style="display: flex;">'.$interval_input_label.'<div style="margin-left: 15 px; width: 50%;">'.$interval_input.'</div></div>'.$interval_input_extra.'</div>'
.'</div>
<div style="width: 25%; padding: 9px;">'.'<div style="height: 50%; margin-bottom: 35px;">'.html_print_image('images/wizard/netscan_green.png', true, ['title' => __('Close'), 'style' => 'width: 60%;'], false).'</div>'.'<div class="edit_discovery_input"><div style="display: flex;">'.$interval_input_label.'<div style="margin-left: 15 px; width: 50%;">'.$interval_input.'</div></div>'.$interval_input_extra.'</div>'.'</div>
<div style="width: 40%; padding-left: 5%; padding-right: 12%;">
<div class="edit_discovery_input">'.$taskname_input_label.'<div class="discovery_text_input">'.$taskname_input.'</div></div>'
.'<div class="edit_discovery_input discovery_select_input">'.$discovery_server_select_label.$discovery_server_select.'<div class="discovery_hint"></div></div>'
.'<div class="edit_discovery_input">'.$network_input_label.'<div class="discovery_text_input">'.$network_input.'</div></div>'
.'</div>'
.'<div style="width: 35%;">'.$group_select.'</div>'
.'</div>'
.'<div class="edit_discovery_info">
<div class="edit_discovery_input">'.$taskname_input_label.'<div class="discovery_text_input">'.$taskname_input.'</div></div>'.'<div class="edit_discovery_input discovery_select_input">'.$discovery_server_select_label.$discovery_server_select.'<div class="discovery_hint"></div></div>'.'<div class="edit_discovery_input">'.$network_input_label.'<div class="discovery_text_input">'.$network_input.'</div></div>'.'</div>'.'<div style="width: 35%;">'.$group_select.'</div>'.'</div>'.'<div class="edit_discovery_info">
<div style="width: 100%;">
'.$comment_input.'
</div>
</div>'
.'</div>';
</div>'.'</div>';
$str = __('Next');
@ -777,7 +777,6 @@ class HostDevices extends Wizard
}).change();
</script>';
}
}

View File

@ -474,7 +474,8 @@ class Wizard
((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
((isset($data['include_groups']) === true) ? $data['include_groups'] : false),
((isset($data['size']) === true) ? $data['size'] : false)
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false)
);
case 'submit':
@ -660,22 +661,25 @@ class Wizard
$output_submit = '';
$output = '';
if ($print_white_box === true)
if ($print_white_box === true) {
$output .= '<div class="white_box">';
}
$output .= '<ul class="wizard">';
foreach ($inputs as $input) {
if ($input['arguments']['type']!='submit')
if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlock($input, true);
else
} else {
$output_submit .= $this->printBlock($input, true);
}
}
$output .= '</ul>';
if ($print_white_box === true)
if ($print_white_box === true) {
$output .= '</div>';
}
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';

View File

@ -40,10 +40,10 @@ $info = get_parameter('info', '');
$other = parseOtherParameter($otherSerialize, $otherMode);
$other = parseOtherParameter($otherSerialize, $otherMode);
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
$correctLogin = false;
$user_in_db = null;
$no_login_msg = '';
// Clean unwanted output
@ -149,6 +149,44 @@ if ($correctLogin) {
}
break;
case 'delete_user_permission':
if ($user_db === '') {
returnError(__('User or group not specified'), __('User, group not specified'));
return;
}
$id_os = api_set_delete_user_profiles($thrash1, $thrash2, $other, $returnType);
if ($id_os != 100) {
return;
}
if ($id_os == false) {
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
case 'add_permission_user_to_group':
if ($user_db == null || $group_db == null || $id_up == null) {
returnError(__('User, group or profile not specified'), __('User, group or profile status not specified'));
return;
}
$id_os = api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType);
if ($id_os != 100) {
return;
}
if ($id_os == false) {
returnError('not_allowed_operation_cluster', $returnType);
return false;
}
break;
default:
// break;

View File

@ -21,7 +21,7 @@
* Pandora build version and version
*/
$build_version = 'PC190424';
$pandora_version = 'v7.0NG.733';
$pandora_version = 'v7.0NG.734';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -14685,3 +14685,365 @@ function api_set_reset_agent_counts($id, $thrash1, $thrash2, $thrash3)
}
}
/**
* Functions por get all user to new feature for Carrefour
* It depends of returnType, the method will return csv or json data
*
* @param string $thrash1 don't use
* @param string $thrash2 don't use
* @param array $other don't use
* *@param string $returnType
* Example:
* api.php?op=get&op2=list_all_user&return_type=json&apipass=1234&user=admin&pass=pandora
* @return
*/
function api_get_list_all_user($thrash1, $thrash2, $other, $returnType)
{
global $config;
if (!check_acl($config['id_user'], 0, 'AR')) {
returnError('forbidden', 'string');
return;
}
$sql = 'SELECT
tup.id_usuario AS user_id,
tu.fullname AS fullname,
tp.id_perfil AS profile_id,
tup.id_up AS id_up,
tp.name AS profile_name,
tup.id_grupo AS group_id,
tgp.nombre AS group_name
FROM tperfil tp
INNER JOIN tusuario_perfil tup
ON tp.id_perfil = tup.id_perfil
LEFT OUTER JOIN tgrupo tgp
ON tup.id_grupo = tgp.id_grupo
LEFT OUTER JOIN tusuario tu
ON tu.id_user = tup.id_usuario';
$users = db_get_all_rows_sql($sql);
$i = 0;
foreach ($users as $up) {
$group_name = $up['group_name'];
if ($up['group_name'] === null) {
$group_name = 'All';
}
$values[$i] = [
'id_usuario' => $up['user_id'],
'fullname' => $up['fullname'],
'id_up' => $up['id_up'],
'id_perfil' => $up['profile_id'],
'perfil_name' => $up['profile_name'],
'id_grupo' => $up['group_id'],
'group_name' => $group_name,
];
$i += 1;
}
if ($values === false) {
returnError('Error_user', __('Users could not be found.'));
return;
}
$data = [
'type' => 'array',
'data' => $values,
];
returnData($returnType, $data, ';');
}
/**
* Funtion for get all info user to new feature for Carrefour
* It depends of returnType, the method will return csv or json data
*
* @param string $thrash1 don't use
* @param string $thrash2 don't use
* @param array $other other[0] = user database
* @param string $returnType
* Example
* api.php?op=get&op2=info_user_name&return_type=json&other=admin&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*
* @return
*/
function api_get_info_user_name($thrash1, $thrash2, $other, $returnType)
{
global $config;
if (!check_acl($config['id_user'], 0, 'AR')) {
returnError('forbidden', 'string');
return;
}
$sql = sprintf(
'SELECT tup.id_usuario AS user_id,
tu.fullname AS fullname,
tup.id_up AS id_up,
tp.id_perfil AS profile_id,
tp.name AS profile_name,
tup.id_grupo AS group_id,
tg.nombre AS group_name
FROM tperfil tp
INNER JOIN tusuario_perfil tup
ON tp.id_perfil = tup.id_perfil
LEFT OUTER JOIN tgrupo tg
ON tup.id_grupo = tg.id_grupo
LEFT OUTER JOIN tusuario tu
ON tu.id_user = tup.id_usuario
WHERE tup.id_usuario = "%s"',
io_safe_output($other['data'][0])
);
$user_profile = db_get_all_rows_sql($sql);
$i = 0;
foreach ($user_profile as $up) {
$group_name = $up['group_name'];
if ($up['group_name'] === null) {
$group_name = 'All';
}
$values[$i] = [
'id_usuario' => $up['user_id'],
'fullname' => $up['fullname'],
'id_up' => $up['id_up'],
'id_perfil' => $up['profile_id'],
'perfil_name' => $up['profile_name'],
'id_grupo' => $up['group_id'],
'group_name' => $group_name,
];
$i += 1;
}
$data = [
'type' => 'array',
'data' => $values,
];
returnData($returnType, $data, ';');
}
/**
* Function for get user from a group to new feature for Carrefour.
* It depends of returnType, the method will return csv or json data.
*
* @param string $thrash1 don't use
* @param string $thrash2 don't use
* @param array $other
* $other[0] = id group
* $other[1] = is disabled or not
* @param string $returnType
* Example
* api.php?op=get&op2=filter_user_group&return_type=json&other=0|0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*
* @return
*/
function api_get_filter_user_group($thrash1, $thrash2, $other, $returnType)
{
global $config;
if (!check_acl($config['id_user'], 0, 'AR')) {
returnError('forbidden', 'string');
return;
}
$filter = '';
if ($other['data'][0] !== '' && $other['data'][1] !== '') {
$filter = 'WHERE tup.id_grupo = '.$other['data'][0].' AND tu.disabled = '.$other['data'][1].'';
} else if ($other['data'][0] !== '') {
$filter = 'WHERE tup.id_grupo = '.$other['data'][0].'';
} else if ($other['data'][1] !== '') {
$filter = 'WHERE tu.disabled = '.$other['data'][1].'';
}
$sql = sprintf(
'SELECT DISTINCT
tup.id_usuario AS user_id,
tu.fullname AS fullname,
tup.id_up AS id_up,
tp.id_perfil AS profile_id,
tp.name AS profile_name,
tup.id_grupo AS group_id,
tg.nombre AS group_name
FROM tperfil tp
INNER JOIN tusuario_perfil tup
ON tp.id_perfil = tup.id_perfil
LEFT OUTER JOIN tgrupo tg
ON tup.id_grupo = tg.id_grupo
LEFT OUTER JOIN tusuario tu
ON tu.id_user = tup.id_usuario
'.$filter.''
);
$filter_user = db_get_all_rows_sql($sql);
$i = 0;
foreach ($filter_user as $up) {
$group_name = $up['group_name'];
if ($up['group_name'] === null) {
$group_name = 'All';
}
$values[$i] = [
'id_usuario' => $up['user_id'],
'fullname' => $up['fullname'],
'id_up' => $up['id_up'],
'id_perfil' => $up['profile_id'],
'perfil_name' => $up['profile_name'],
'id_grupo' => $up['group_id'],
'group_name' => $group_name,
];
$i += 1;
}
$data = [
'type' => 'array',
'data' => $values,
];
returnData($returnType, $data, ';');
}
/**
* Function for delete an user permission for Carrefour new feature
* The return of this function its only a message
*
* @param string $thrash1 don't use
* @param string $thrash2 don't use
* @param array $other
* $other[0] = id up
* @param string $returnType
* Example
* api.php?op=set&op2=delete_user_permission&return_type=json&other=user|2&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*
* @return void
*/
function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
{
global $config;
if (!check_acl($config['id_user'], 0, 'AW')) {
returnError('forbidden', 'string');
return;
}
if ($other['data'][0] != '') {
$values = [
'id_up' => io_safe_output($other['data'][0]),
];
} else {
returnError('Error_delete', __('User profile could not be deleted.'));
return;
}
$deleted_permission = db_process_sql_delete('tusuario_perfil', $values);
if ($deleted_permission == false) {
returnError('Error_delete', __('User profile could not be deleted.'));
return;
}
$data = [
'type' => 'string',
'data' => $deleted_permission,
];
returnData('string', ['type' => 'string', 'data' => $data]);
}
/**
* Function for add permission a user to a group for Carrefour new feature
* It depends of returnType, the method will return csv or json data
*
* @param string $thrash1 don't use
* @param string $thrash2 don't use
* @param array $other other[0] = user database
* other[1] = id group
* other[2] = id profile
* other[3] = no_hierarchy ( 0 or 1, if empty = 0)
* other[4] = id from tusuario_perfil table (optional)
* * @param string $returnType
* Example
* api.php?op=set&op2=add_permission_user_to_group&return_type=json&other=admin|0|1|1|20&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*
* @return void
*/
function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType)
{
global $config;
if (!check_acl($config['id_user'], 0, 'AW')) {
returnError('forbidden', 'string');
return;
}
$sql = 'SELECT id_up
FROM tusuario_perfil
WHERE id_up = '.$other['data'][4].'';
$exist_profile = db_get_value_sql($sql);
if ($other['data'][3] < 0 || $other['data'][3] > 1) {
returnError('Error_insert', __('User profile could not be available.'));
return;
}
if ($other['data'][3] == null) {
$other['data'][3] = 0;
}
$values = [
'id_usuario' => $other['data'][0],
'id_perfil' => $other['data'][2],
'id_grupo' => $other['data'][1],
'no_hierarchy' => $other['data'][3],
'assigned_by' => $config['id_user'],
'id_policy' => 0,
'tags' => '',
];
$where_id_up = ['id_up' => $other['data'][4]];
if ($exist_profile === $other['data'][4] && $where_id_up !== null) {
$sucessfull_insert = db_process_sql_update('tusuario_perfil', $values, $where_id_up);
} else {
$sucessfull_insert = db_process_sql_insert('tusuario_perfil', $values);
}
if ($sucessfull_insert == false) {
returnError('Error_insert', __('User profile could not be available.'));
return;
}
$data = [
'type' => 'array',
'data' => $values,
];
returnData($returnType, $data, ';');
}

View File

@ -609,7 +609,7 @@ function filemanager_file_explorer(
if (defined('METACONSOLE')) {
$table->class = 'databox_tactical';
$table->title = '<span>'.__('Index of images').'</span>';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
}
$table->colspan = [];
@ -773,46 +773,42 @@ function filemanager_file_explorer(
if (!$readOnly) {
if (is_writable($real_directory)) {
// The buttons to make actions
if (defined('METACONSOLE')) {
echo "<div style='text-align: left; width: ".$table->width.";'>";
} else {
$tabs_dialog = '<ul id="file_table_modal">
<li class="create_folder">
<a href="javascript: show_form_create_folder();">'.html_print_image(
'images/create_directory.png',
true,
['title' => __('Create directory')]
).'<span>'.__('Create a Directory').'</span>
</a>
</li>
<li class="create_text_file">
<a href="javascript: show_create_text_file();">'.html_print_image(
'images/create_file.png',
true,
['title' => __('Create a Text')]
).'<span>'.__('Create a Text').'</span>
</a>
</li>
<li class="upload_file">
<a href="javascript: show_upload_file();">'.html_print_image(
'images/upload_file.png',
true,
['title' => __('Upload Files')]
).'<span>'.__('Upload Files').'</span>
</a>
</li></ul>';
$tabs_dialog = '<ul id="file_table_modal">
<li class="create_folder">
<a href="javascript: show_form_create_folder();">'.html_print_image(
'images/create_directory.png',
true,
['title' => __('Create directory')]
).'<span>'.__('Create a Directory').'</span>
</a>
</li>
<li class="create_text_file">
<a href="javascript: show_create_text_file();">'.html_print_image(
'images/create_file.png',
true,
['title' => __('Create a Text')]
).'<span>'.__('Create a Text').'</span>
</a>
</li>
<li class="upload_file">
<a href="javascript: show_upload_file();">'.html_print_image(
'images/upload_file.png',
true,
['title' => __('Upload Files')]
).'<span>'.__('Upload Files').'</span>
</a>
</li></ul>';
echo '<div id="create_folder" style="display: none;">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('dirname', '', '', 30, 255, true).html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('create_dir', 1, true).html_print_input_hidden('hash', md5($relative_directory.$config['dbpass']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['dbpass']), true).'</form></div>';
echo '<div id="create_folder" style="display: none;">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('dirname', '', '', 30, 255, true).html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('create_dir', 1, true).html_print_input_hidden('hash', md5($relative_directory.$config['dbpass']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['dbpass']), true).'</form></div>';
echo '<div id="upload_file" style="display: none;"> '.$tabs_dialog.'
<form method="post" action="'.$url.'" enctype="multipart/form-data">'.ui_print_help_tip(__('The zip upload in this dir, easy to upload multiple files.'), true).html_print_input_file('file', true, false).html_print_input_hidden('umask', $umask, true).html_print_checkbox('decompress', 1, false, true).__('Decompress').html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['dbpass']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['dbpass']), true).html_print_input_hidden('upload_file_or_zip', 1, true).'</form></div>';
echo '<div id="upload_file" style="display: none;"> '.$tabs_dialog.'
<form method="post" action="'.$url.'" enctype="multipart/form-data">'.ui_print_help_tip(__('The zip upload in this dir, easy to upload multiple files.'), true).html_print_input_file('file', true, false).html_print_input_hidden('umask', $umask, true).html_print_checkbox('decompress', 1, false, true).__('Decompress').html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['dbpass']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['dbpass']), true).html_print_input_hidden('upload_file_or_zip', 1, true).'</form></div>';
echo ' <div id="create_text_file" style="display: none;">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['dbpass']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
echo ' <div id="create_text_file" style="display: none;">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['dbpass']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
}
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
echo "<a href='javascript: show_form_create_folder();'>";
echo html_print_image(

View File

@ -437,7 +437,8 @@ function html_print_select_groups(
$strict_user=false,
$delete_groups=false,
$include_groups=false,
$size=false
$size=false,
$simple_multiple_options=false
) {
global $config;
@ -483,7 +484,11 @@ function html_print_select_groups(
$disabled,
$style,
$option_style,
$size
$size,
false,
'',
false,
$simple_multiple_options
);
if ($return) {
@ -531,7 +536,8 @@ function html_print_select(
$size=false,
$modal=false,
$message='',
$select_all=false
$select_all=false,
$simple_multiple_options=false
) {
$output = "\n";
@ -551,11 +557,21 @@ function html_print_select(
$attributes .= ' onchange="'.$script.'"';
}
if ($size !== false)
$attributes .= ' size="'.$size.'"';
if (!empty($multiple)) {
if ($size !== false) {
$attributes .= ' multiple="multiple" size="'.$size.'"';
} else {
$attributes .= ' multiple="multiple" size="10"';
}
}
if (!empty($multiple))
$attributes .= ' multiple="multiple"';
if ($simple_multiple_options === true) {
if ($size !== false) {
$attributes .= ' size="'.$size.'"';
} else {
$attributes .= ' size="10"';
}
}
if (!empty($class)) {
$attributes .= ' class="'.$class.'"';
@ -1774,7 +1790,6 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
*/
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='')
{
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.'" class="'.$class.'">';
// $output .= io_safe_input ($value);
$output .= ($value);

View File

@ -128,7 +128,7 @@
</div>
<div style='height: 10px'>
<?php
$version = '7.0NG.733';
$version = '7.0NG.734';
$build = '190424';
$banner = "v$version Build $build";

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.733
%define release 190424
%define version 7.0NG.734
%define release 1
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.733
%define release 190424
%define version 7.0NG.734
%define release 1
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.733
%define release 190424
%define version 7.0NG.734
%define release 1
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -9,7 +9,7 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.733"
PI_VERSION="7.0NG.734"
FORCE=0
DESTDIR=""
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`

View File

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

View File

@ -1,7 +1,7 @@
#############################################################################
# Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System.
# Version 7.0NG.733
# Version 7.0NG.734
# Licensed under GPL license v2,
# (c) 2003-2017 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -44,7 +44,7 @@ our @EXPORT = qw(
);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.733";
my $pandora_version = "7.0NG.734";
my $pandora_build = "190424";
our $VERSION = $pandora_version." ".$pandora_build;

View File

@ -31,7 +31,7 @@ use base 'Exporter';
our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.733";
my $pandora_version = "7.0NG.734";
my $pandora_build = "190424";
our $VERSION = $pandora_version." ".$pandora_build;

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.733
%define release 190424
%define version 7.0NG.734
%define release 1
Summary: Pandora FMS Server
Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.733
%define release 190424
%define version 7.0NG.734
%define release 1
Summary: Pandora FMS Server
Name: %{name}

View File

@ -8,7 +8,7 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.733"
PI_VERSION="7.0NG.734"
PI_BUILD="190424"
MODE=$1

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.733 PS190424";
my $version = "7.0NG.734 PS190424";
# 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.733 PS190424";
my $version = "7.0NG.734 PS190424";
# save program name for logging
my $progname = basename($0);