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

This commit is contained in:
m-lopez-f 2015-06-26 11:46:58 +02:00
commit 440687c0d7
30 changed files with 54 additions and 76 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.0dev-150625 Version: 6.0dev-150626
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0dev'; use constant AGENT_VERSION => '6.0dev';
use constant AGENT_BUILD => '150625'; use constant AGENT_BUILD => '150626';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0dev %define version 6.0dev
%define release 150625 %define release 150626
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0dev %define version 6.0dev
%define release 150625 %define release 150626
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{150625} {150626}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0dev(Build 150625)") #define PANDORA_VERSION ("6.0dev(Build 150626)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0dev(Build 150625))" VALUE "ProductVersion", "(6.0dev(Build 150626))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 6.0dev-150625 Version: 6.0dev-150626
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0dev-150625" pandora_version="6.0dev-150626"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -185,13 +185,13 @@ switch ($config["dbtype"]) {
render_info_data ("SELECT value render_info_data ("SELECT value
FROM tupdate_settings FROM tupdate_settings
WHERE key = 'customer_key'", "Update Key"); WHERE \"key\" = 'customer_key'", "Update Key");
render_info_data ("SELECT value render_info_data ("SELECT value
FROM tupdate_settings FROM tupdate_settings
WHERE key = 'updating_code_path'", "Updating code path"); WHERE \"key\" = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value render_info_data ("SELECT value
FROM tupdate_settings FROM tupdate_settings
WHERE key = 'current_update'", "Current Update #"); WHERE \"key\" = 'current_update'", "Current Update #");
break; break;
} }

View File

@ -33,7 +33,7 @@ switch ($config['dbtype']) {
$type_escaped = "type"; $type_escaped = "type";
break; break;
case "oracle": case "oracle":
$type_escaped = db_encapsule_fields_with_same_name_to_instructions( $type_escaped = db_escape_key_identifier(
"type"); "type");
break; break;
} }

View File

@ -1077,7 +1077,7 @@ switch ($action) {
case "oracle": case "oracle":
if (isset($values['type'])) { if (isset($values['type'])) {
$values[ $values[
db_encapsule_fields_with_same_name_to_instructions( db_escape_key_identifier(
"type")] = $values['type']; "type")] = $values['type'];
unset($values['type']); unset($values['type']);
} }
@ -1335,7 +1335,7 @@ switch ($action) {
case "oracle": case "oracle":
if (isset($values['type'])) { if (isset($values['type'])) {
$values[ $values[
db_encapsule_fields_with_same_name_to_instructions( db_escape_key_identifier(
"type")] = $values['type']; "type")] = $values['type'];
unset($values['type']); unset($values['type']);
} }

View File

@ -28,8 +28,10 @@ ui_print_page_header (__('License management'), "images/extensions.png", false,
if ($update_settings) { if ($update_settings) {
foreach ($_POST['keys'] as $key => $value) { foreach ($_POST['keys'] as $key => $value) {
db_process_sql_update('tupdate_settings', db_process_sql_update(
array('value' => $value), array('key' => $key)); 'tupdate_settings',
array('value' => $value),
array(db_escape_key_identifier('key') => $key));
} }
ui_print_success_message(__('License updated')); ui_print_success_message(__('License updated'));

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC150625'; $build_version = 'PC150626';
$pandora_version = 'v6.0dev'; $pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -44,6 +44,9 @@ function config_create_value ($token, $value) {
function config_update_value ($token, $value) { function config_update_value ($token, $value) {
global $config; global $config;
// Include functions_io to can call __() function
include_once($config['homedir'] . '/include/functions_io.php');
if ($token == 'list_ACL_IPs_for_API') { if ($token == 'list_ACL_IPs_for_API') {
$value = str_replace(array("\r\n", "\r", "\n"), ";", $value = str_replace(array("\r\n", "\r", "\n"), ";",
io_safe_output($value)); io_safe_output($value));
@ -167,7 +170,7 @@ function config_update_config () {
$license_info_key = get_parameter('license_info_key', ''); $license_info_key = get_parameter('license_info_key', '');
if (!empty($license_info_key)) { if (!empty($license_info_key)) {
$values = array("value" => $license_info_key); $values = array("value" => $license_info_key);
$where = array("key" => 'customer_key'); $where = array(db_escape_key_identifier('key') => 'customer_key');
$update_manage_settings_result = db_process_sql_update('tupdate_settings', $values, $where); $update_manage_settings_result = db_process_sql_update('tupdate_settings', $values, $where);
if ($update_manage_settings_result === false) if ($update_manage_settings_result === false)
$error_update[] = __('License information'); $error_update[] = __('License information');

View File

@ -125,6 +125,11 @@ function db_encapsule_fields_with_same_name_to_instructions($field) {
} }
} }
// Alias for 'db_encapsule_fields_with_same_name_to_instructions'
function db_escape_key_identifier($field) {
return db_encapsule_fields_with_same_name_to_instructions($field);
}
/** /**
* Adds an audit log entry (new function in 3.0) * Adds an audit log entry (new function in 3.0)
* *

View File

@ -24,31 +24,14 @@ function update_manager_get_config_values() {
global $build_version; global $build_version;
global $pandora_version; global $pandora_version;
switch ($config["dbtype"]) { $license = db_get_value(
case "postgresql": 'value',
case "mysql": 'tupdate_settings',
$license = db_get_value( db_escape_key_identifier('key'),
db_encapsule_fields_with_same_name_to_instructions('value'), 'customer_key');
'tupdate_settings',
db_encapsule_fields_with_same_name_to_instructions('key'),
'customer_key');
break;
case 'oracle':
$license = db_get_value(
'value',
'tupdate_settings',
'key',
'customer_key');
break;
}
$limit_count = db_get_value_sql("SELECT count(*) FROM tagente"); $limit_count = db_get_value_sql("SELECT count(*) FROM tagente");
return array( return array(
'license' => $license, 'license' => $license,
'current_update' => update_manager_get_current_package(), 'current_update' => update_manager_get_current_package(),
@ -497,8 +480,8 @@ function update_manager_set_current_package($current_package) {
$token = 'current_package'; $token = 'current_package';
} }
$col_value = db_encapsule_fields_with_same_name_to_instructions('value'); $col_value = 'value';
$col_key = db_encapsule_fields_with_same_name_to_instructions('key'); $col_key = db_escape_key_identifier('key');
$value = db_get_value($col_value, $value = db_get_value($col_value,
'tupdate_settings', $col_key, $token); 'tupdate_settings', $col_key, $token);
@ -523,26 +506,11 @@ function update_manager_get_current_package() {
else { else {
$token = 'current_package'; $token = 'current_package';
} }
$current_update = db_get_value(
switch ($config["dbtype"]) { 'value',
case "postgresql": 'tupdate_settings',
case "mysql": db_escape_key_identifier('key'),
$current_update = db_get_value( $token);
db_encapsule_fields_with_same_name_to_instructions('value'),
'tupdate_settings',
db_encapsule_fields_with_same_name_to_instructions('key'),
$token);
break;
case "oracle":
$current_update = db_get_value(
'value',
'tupdate_settings',
'key',
$token);
break;
}
if ($current_update === false) { if ($current_update === false) {
$current_update = 0; $current_update = 0;

View File

@ -63,7 +63,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.0dev'; $version = '6.0dev';
$build = '150625'; $build = '150626';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0dev %define version 6.0dev
%define release 150625 %define release 150626
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0dev %define version 6.0dev
%define release 150625 %define release 150626
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1956,7 +1956,7 @@ CREATE OR REPLACE TRIGGER tcategory_inc BEFORE INSERT ON tcategory REFERENCING N
-- Table `tupdate_settings` -- Table `tupdate_settings`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
CREATE TABLE tupdate_settings ( CREATE TABLE tupdate_settings (
key VARCHAR2(255) DEFAULT '' PRIMARY KEY, "key" VARCHAR2(255) DEFAULT '' PRIMARY KEY,
value VARCHAR2(255) DEFAULT '' value VARCHAR2(255) DEFAULT ''
); );

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'), ('graph_res','5'),
('step_compact','1'), ('step_compact','1'),
('db_scheme_version','6.0dev'), ('db_scheme_version','6.0dev'),
('db_scheme_build','PD150625'), ('db_scheme_build','PD150626'),
('show_unknown','0'), ('show_unknown','0'),
('show_lastalerts','1'), ('show_lastalerts','1'),
('style','pandora'), ('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 6.0dev-150625 Version: 6.0dev-150626
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0dev-150625" pandora_version="6.0dev-150626"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0dev %define version 6.0dev
%define release 150625 %define release 150626
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0dev %define version 6.0dev
%define release 150625 %define release 150626
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "6.0dev PS150625"; my $version = "6.0dev PS150626";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "6.0dev PS150625"; my $version = "6.0dev PS150626";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);