diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 2bb95eb5fd..fc76f261af 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150625 +Version: 6.0dev-150626 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 980e36efd3..63cc21b32a 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-150625" +pandora_version="6.0dev-150626" 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 24e3e46ac0..ec93c3bc00 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 => '150625'; +use constant AGENT_BUILD => '150626'; # 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 e162d9a773..538424c0fc 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 150625 +%define release 150626 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 33e2b0ff6d..fb2da2e26f 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 150625 +%define release 150626 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 14a2db8ea9..fac56b0040 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150625} +{150626} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 70b0f2a97e..e7e0f56fa7 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 150625)") +#define PANDORA_VERSION ("6.0dev(Build 150626)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 59e56f2502..9116877346 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 150625))" + VALUE "ProductVersion", "(6.0dev(Build 150626))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ad637741db..46557959a8 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150625 +Version: 6.0dev-150626 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 6c1ccb6739..8811dad569 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-150625" +pandora_version="6.0dev-150626" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 439f3b03b5..6f634c6250 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -185,13 +185,13 @@ switch ($config["dbtype"]) { render_info_data ("SELECT value FROM tupdate_settings - WHERE key = 'customer_key'", "Update Key"); + WHERE \"key\" = 'customer_key'", "Update Key"); render_info_data ("SELECT value FROM tupdate_settings - WHERE key = 'updating_code_path'", "Updating code path"); + WHERE \"key\" = 'updating_code_path'", "Updating code path"); render_info_data ("SELECT value FROM tupdate_settings - WHERE key = 'current_update'", "Current Update #"); + WHERE \"key\" = 'current_update'", "Current Update #"); break; } diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 234518f6c8..0a1594ad92 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -33,7 +33,7 @@ switch ($config['dbtype']) { $type_escaped = "type"; break; case "oracle": - $type_escaped = db_encapsule_fields_with_same_name_to_instructions( + $type_escaped = db_escape_key_identifier( "type"); break; } diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index e74b6c1c04..0335a12543 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1077,7 +1077,7 @@ switch ($action) { case "oracle": if (isset($values['type'])) { $values[ - db_encapsule_fields_with_same_name_to_instructions( + db_escape_key_identifier( "type")] = $values['type']; unset($values['type']); } @@ -1335,7 +1335,7 @@ switch ($action) { case "oracle": if (isset($values['type'])) { $values[ - db_encapsule_fields_with_same_name_to_instructions( + db_escape_key_identifier( "type")] = $values['type']; unset($values['type']); } diff --git a/pandora_console/godmode/setup/license.php b/pandora_console/godmode/setup/license.php index 7c8f98ff67..70375aa7e9 100644 --- a/pandora_console/godmode/setup/license.php +++ b/pandora_console/godmode/setup/license.php @@ -28,8 +28,10 @@ ui_print_page_header (__('License management'), "images/extensions.png", false, if ($update_settings) { foreach ($_POST['keys'] as $key => $value) { - db_process_sql_update('tupdate_settings', - array('value' => $value), array('key' => $key)); + db_process_sql_update( + 'tupdate_settings', + array('value' => $value), + array(db_escape_key_identifier('key') => $key)); } ui_print_success_message(__('License updated')); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 3a4c35c594..48e244ab56 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 = 'PC150625'; +$build_version = 'PC150626'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 5a3c1c4065..3a37a861e4 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -44,6 +44,9 @@ function config_create_value ($token, $value) { function config_update_value ($token, $value) { global $config; + // Include functions_io to can call __() function + include_once($config['homedir'] . '/include/functions_io.php'); + if ($token == 'list_ACL_IPs_for_API') { $value = str_replace(array("\r\n", "\r", "\n"), ";", io_safe_output($value)); @@ -167,7 +170,7 @@ function config_update_config () { $license_info_key = get_parameter('license_info_key', ''); if (!empty($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); if ($update_manage_settings_result === false) $error_update[] = __('License information'); diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 810e70e213..58671db15c 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -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) * diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index 1c03d65912..4b579f9fa7 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -24,31 +24,14 @@ function update_manager_get_config_values() { global $build_version; global $pandora_version; - switch ($config["dbtype"]) { - case "postgresql": - case "mysql": - $license = db_get_value( - db_encapsule_fields_with_same_name_to_instructions('value'), - '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; - } + $license = db_get_value( + 'value', + 'tupdate_settings', + db_escape_key_identifier('key'), + 'customer_key'); $limit_count = db_get_value_sql("SELECT count(*) FROM tagente"); - - - - - return array( 'license' => $license, 'current_update' => update_manager_get_current_package(), @@ -497,8 +480,8 @@ function update_manager_set_current_package($current_package) { $token = 'current_package'; } - $col_value = db_encapsule_fields_with_same_name_to_instructions('value'); - $col_key = db_encapsule_fields_with_same_name_to_instructions('key'); + $col_value = 'value'; + $col_key = db_escape_key_identifier('key'); $value = db_get_value($col_value, 'tupdate_settings', $col_key, $token); @@ -523,26 +506,11 @@ function update_manager_get_current_package() { else { $token = 'current_package'; } - - switch ($config["dbtype"]) { - case "postgresql": - case "mysql": - $current_update = db_get_value( - 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; - } - - + $current_update = db_get_value( + 'value', + 'tupdate_settings', + db_escape_key_identifier('key'), + $token); if ($current_update === false) { $current_update = 0; diff --git a/pandora_console/install.php b/pandora_console/install.php index 36712369b8..1e8b8f2727 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@