From fd6d830de3e8c2ded48075f8cd28c2b534795cfc Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 21 Nov 2018 00:01:25 +0100 Subject: [PATCH 1/3] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 5eef9f541d..86b23fdb7a 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.729-181120 +Version: 7.0NG.729-181121 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 2061e94ba1..9c23f55258 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="7.0NG.729-181120" +pandora_version="7.0NG.729-181121" 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 7f39327851..7950a9ac3b 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.729'; -use constant AGENT_BUILD => '181120'; +use constant AGENT_BUILD => '181121'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 0d1535b1de..36ab5fd73a 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 7.0NG.729 -%define release 181120 +%define release 181121 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 1e8f153a2c..e40aa2d331 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 7.0NG.729 -%define release 181120 +%define release 181121 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 9606604f15..4472239b6e 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.729" -PI_BUILD="181120" +PI_BUILD="181121" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 19cd2c6a60..474db7ba2c 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{181120} +{181121} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 3f99c929f4..6e4ccb69da 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 ("7.0NG.729(Build 181120)") +#define PANDORA_VERSION ("7.0NG.729(Build 181121)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index c8e617ac33..839789b48d 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", "(7.0NG.729(Build 181120))" + VALUE "ProductVersion", "(7.0NG.729(Build 181121))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 1cf6b8da0a..e82acca4ce 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.729-181120 +Version: 7.0NG.729-181121 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 fd16b309e5..bd4a3bd65d 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="7.0NG.729-181120" +pandora_version="7.0NG.729-181121" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7ad7bf70b2..6a94587686 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 = 'PC181120'; +$build_version = 'PC181121'; $pandora_version = 'v7.0NG.729'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 36d3926c37..5459cb7d3f 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index d8eded4f2f..290a90f1a5 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.729 -%define release 181120 +%define release 181121 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 9ba292053a..c0b3a82f13 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.729 -%define release 181120 +%define release 181121 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 1d46177b7e..7cbab42c65 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.729" -PI_BUILD="181120" +PI_BUILD="181121" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index bb801c88d8..843b90bbf6 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.729 PS181120"; +my $version = "7.0NG.729 PS181121"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 85389d02d3..a3d53df2fe 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.729 PS181120"; +my $version = "7.0NG.729 PS181121"; # save program name for logging my $progname = basename($0); From 054546fd0f70426dad20264a2cf8e4700a823e64 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 21 Nov 2018 12:05:20 +0100 Subject: [PATCH 2/3] Add support for offline licenses. Ref pandora_enterprise#3098. --- pandora_server/lib/PandoraFMS/Tools.pm | 23 +++++++++++++++++++++-- pandora_server/util/pandora_db.pl | 26 +++++++++++++++++++------- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 5e5f58c4a8..195443656f 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -68,6 +68,7 @@ our @EXPORT = qw( PROVISIONINGSERVER MIGRATIONSERVER METACONSOLE_LICENSE + OFFLINE_LICENSE $DEVNULL $OS $OS_VERSION @@ -93,6 +94,7 @@ our @EXPORT = qw( sqlWrap is_numeric is_metaconsole + is_offline to_number clean_blank pandora_sendmail @@ -152,9 +154,12 @@ use constant MODULE_WARNING => 2; use constant MODULE_UNKNOWN => 3; use constant MODULE_NOTINIT => 4; -# Value for a metaconsole license type +# Mask for a metaconsole license type use constant METACONSOLE_LICENSE => 0x01; +# Mask for an offline license type +use constant OFFLINE_LICENSE => 0x02; + # Alert modes use constant RECOVERED_ALERT => 0; use constant FIRED_ALERT => 1; @@ -1639,7 +1644,7 @@ sub is_metaconsole ($) { my ($pa_config) = @_; if (defined($pa_config->{"license_type"}) && - $pa_config->{"license_type"} == METACONSOLE_LICENSE && + ($pa_config->{"license_type"} & METACONSOLE_LICENSE) && $pa_config->{"node_metaconsole"} == 0) { return 1; } @@ -1647,6 +1652,20 @@ sub is_metaconsole ($) { return 0; } +############################################################################### +# Returns 1 if a valid offline license is configured, 0 otherwise. +############################################################################### +sub is_offline ($) { + my ($pa_config) = @_; + + if (defined($pa_config->{"license_type"}) && + ($pa_config->{"license_type"} & OFFLINE_LICENSE)) { + return 1; + } + + return 0; +} + ############################################################################### # Check if a given variable contents a number ############################################################################### diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 5d877a8921..04a1f7657f 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -1042,8 +1042,20 @@ else { # Connect to the DB my $dbh = db_connect ($conf{'dbengine'}, $conf{'dbname'}, $conf{'dbhost'}, $conf{'dbport'}, $conf{'dbuser'}, $conf{'dbpass'}); -my $history_dbh = ($conf{'_history_db_enabled'} eq '1') ? db_connect ($conf{'dbengine'}, $conf{'_history_db_name'}, - $conf{'_history_db_host'}, $conf{'_history_db_port'}, $conf{'_history_db_user'}, $conf{'_history_db_pass'}) : undef; +my $history_dbh = undef; +is_metaconsole(\%conf); +if ($conf{'_history_db_enabled'} eq '1') { + eval { + $history_dbh = db_connect ($conf{'dbengine'}, $conf{'_history_db_name'}, $conf{'_history_db_host'}, $conf{'_history_db_port'}, $conf{'_history_db_user'}, $conf{'_history_db_pass'}); + }; + if ($@) { + if (is_offline(\%conf)) { + log_message ('!', "Cannot connect to the history database. Skipping."); + } else { + die ("$@\n"); + } + } +} # Get a lock my $lock = db_get_lock ($dbh, 'pandora_db'); @@ -1055,13 +1067,13 @@ if ($lock == 0 && $conf{'_force'} == 0) { # Main pandoradb_main(\%conf, $dbh, $history_dbh); -# Cleanup and exit -db_disconnect ($history_dbh) if defined ($history_dbh); -db_disconnect ($dbh); - # Release the lock if ($lock == 1) { db_release_lock ($dbh, 'pandora_db'); } -exit 0; \ No newline at end of file +# Cleanup and exit +db_disconnect ($history_dbh) if defined ($history_dbh); +db_disconnect ($dbh); + +exit 0; From d9128121276b11451b4c0bbb501250b496937378 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 21 Nov 2018 12:17:22 +0100 Subject: [PATCH 3/3] Include Encode::CN, needed for cp936 support. Ref pandora_enterprise#3031. --- pandora_server/lib/PandoraFMS/Core.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 5f4a574832..bcb08a23ae 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -111,6 +111,7 @@ use warnings; use DBI; use Encode; +use Encode::CN; use XML::Simple; use HTML::Entities; use Time::Local;