diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 4bc2cc9ce1..8d978cc213 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -41,6 +41,7 @@ SERVER_DB_FILE="$CODEHOME/pandora_server/util/pandora_db.pl" SERVER_CLI_FILE="$CODEHOME/pandora_server/util/pandora_manage.pl" SERVER_CONF_FILE="$CODEHOME/pandora_server/conf/pandora_server.conf.new" CONSOLE_DB_FILE="$CODEHOME/pandora_console/pandoradb_data.sql" +CONSOLE_DB_FILE_ORACLE="$CODEHOME/pandora_console/pandoradb.data.oracle.sql" CONSOLE_FILE="$CODEHOME/pandora_console/include/config_process.php" CONSOLE_INSTALL_FILE="$CODEHOME/pandora_console/install.php" AGENT_BASE_DIR="$CODEHOME/pandora_agents/" @@ -65,7 +66,7 @@ function update_spec_version { # Update version in debian dirs function update_deb_version { DEBIAN_DIR=$1 - + if [ $NB == 1 ]; then LOCAL_VERSION="$VERSION-$BUILD" else @@ -104,8 +105,12 @@ sed -e "s/\s*use constant SATELLITE_BUILD.*/use constant SATELLITE_BUILD \=\> \" # Pandora Console echo "Updating Pandora Console DB version..." -sed -e "s/\s*[(]\s*'db_scheme_version'\s*\,.*/('db_scheme_version'\,'$VERSION'),/" "$CONSOLE_DB_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE" -sed -e "s/\s*[(]\s*'db_scheme_build'\s*\,.*/('db_scheme_build'\,'PD$BUILD'),/" "$CONSOLE_DB_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE" +sed -e "s/\s*[(]\s*'db_scheme_version'\s*\,.*/('db_scheme_version'\,'$VERSION'),/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE" +sed -e "s/\s*[(]\s*'db_scheme_build'\s*\,.*/('db_scheme_build'\,'PD$BUILD'),/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE" + +sed -e "s/\s*[(]\s*'db_scheme_version'\s*\,.*/('db_scheme_version'\,'$VERSION');/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE" +sed -e "s/\s*[(]\s*'db_scheme_build'\s*\,.*/('db_scheme_build'\,'PD$BUILD');/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE" + echo "Updating Pandora Console version..." sed -e "s/\s*\$pandora_version\s*=.*/\$pandora_version = 'v$VERSION';/" "$CONSOLE_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_FILE" sed -e "s/\s*\$build_version\s*=.*/\$build_version = 'PC$BUILD';/" "$CONSOLE_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_FILE" @@ -137,4 +142,3 @@ for conf in `find $AGENT_BASE_DIR -name pandora_agent.conf`; do done rm -f "$TEMP_FILE" - diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 60de6deabe..21e32f6339 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0RC1-150908 +Version: 6.0RC1-150914 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 cbe7cf8ba1..287a66f6f6 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.0RC1-150908" +pandora_version="6.0RC1-150914" 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 5897e38771..5aa645a065 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.0RC1'; -use constant AGENT_BUILD => '150908'; +use constant AGENT_BUILD => '150914'; # 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 2da795a0f3..0940452d60 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.0RC1 -%define release 150908 +%define release 150914 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 2891afdace..1da34c19f6 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.0RC1 -%define release 150908 +%define release 150914 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 943bfa6239..18fa285d97 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150908} +{150914} ViewReadme {Yes} diff --git a/pandora_agents/win32/modules/pandora_module_exec.cc b/pandora_agents/win32/modules/pandora_module_exec.cc index b501f63cc3..ecac4e248e 100644 --- a/pandora_agents/win32/modules/pandora_module_exec.cc +++ b/pandora_agents/win32/modules/pandora_module_exec.cc @@ -21,6 +21,8 @@ #include "pandora_module_exec.h" #include "../pandora_strutils.h" #include +#include +#include #define BUFSIZE 4096 @@ -39,6 +41,46 @@ Pandora_Module_Exec::Pandora_Module_Exec (string name, string exec) this->module_exec = "cmd.exe /c \"" + exec + "\""; this->proc = 0; this->setKind (module_exec_str); + this->native_encoding = -1; +} + +/** + * Creates a Pandora_Module_Exec object. + * + * @param name Module name + * @param exec Command to be executed. + * @param native indicates an output conversion + */ +Pandora_Module_Exec::Pandora_Module_Exec (string name, string exec, string native) + : Pandora_Module (name) { + this->module_exec = "cmd.exe /c \"" + exec + "\""; + this->proc = 0; + this->setKind (module_exec_str); + + if (native.c_str () != ""){ + getOutputEncoding(); + while (native[0] == ' ') { //remove begin whitespaces + native = native.substr( 1, native.length ()); + } + + if (!native.compare ("ANSI")){ + this->native_encoding = GetACP (); + } else if (!native.compare ("OEM")){ + this->native_encoding = GetOEMCP (); + } else if (!native.compare ("UTFLE")){ + this->native_encoding = 1200; //UTF-16 little-endian code page + } else if (!native.compare ("UTFBE")){ + this->native_encoding = 1201; //UTF-16 big-endian code page + } else { + this->native_encoding = -1; + pandoraDebug("module_native %s in %s module is not a properly encoding", + native.c_str (), name.c_str ()); + } + + } else { + this->output_encoding = ""; + this->native_encoding = -1; + } } void @@ -101,11 +143,14 @@ Pandora_Module_Exec::run () { /* Set up members of the PROCESS_INFORMATION structure. */ ZeroMemory (&pi, sizeof (pi)); pandoraDebug ("Executing: %s", this->module_exec.c_str ()); - + /* Set the working directory of the process. It's "utils" directory to find the GNU W32 tools */ working_dir = getPandoraInstallDir () + "util\\"; - + + /*always change input from UTF-8 to ANSI*/ + changeInputEncoding(); + /* Create the child process. */ if (! CreateProcess (NULL, (CHAR *) this->module_exec.c_str (), NULL, NULL, TRUE, CREATE_SUSPENDED | CREATE_NO_WINDOW, NULL, @@ -136,6 +181,11 @@ Pandora_Module_Exec::run () { output += (char *) buffer; } + /* Change the output encoding */ + if (this->native_encoding != -1){ + changeOutputEncoding(&output); + } + if (dwRet == WAIT_OBJECT_0) { break; } else if(this->getTimeout() < GetTickCount() - tickbase) { @@ -186,3 +236,240 @@ Pandora_Module_Exec::run () { CloseHandle (out_read); } +UINT Pandora_Module_Exec::getNumberEncoding (string encoding){ + + map code_pages; + + //Code page from https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx + //The key has been copied from .NET Name column + + code_pages["IBM037"] = 37; + code_pages["IBM437"] = 437; + code_pages["IBM500"] = 500; + code_pages["ASMO-708"] = 708; + code_pages["ASMO-449+"] = 709; //Name of Information column + //710 not .NET name + code_pages["COD-720"] = 720; + code_pages["IBM737"] = 737; + code_pages["IBM775"] = 775; + code_pages["IBM850"] = 850; + code_pages["IBM852"] = 850; + code_pages["IBM855"] = 855; + code_pages["IBM00858"] = 858; + code_pages["IBM860"] = 860; + code_pages["IBM861"] = 861; + code_pages["DOS-862"] = 862; + code_pages["IBM863"] = 863; + code_pages["IBM864"] = 864; + code_pages["IBM865"] = 865; + code_pages["CP866"] = 866; + code_pages["IBM869"] = 869; + code_pages["IBM870"] = 870; + code_pages["WINDOWS-874"] = 874; + code_pages["CP875"] = 875; + code_pages["SHIFT_JIS"] = 932; + code_pages["GB2312"] = 936; + code_pages["KS_C_5601-1987"] = 949; + code_pages["BIG5"] = 950; + code_pages["IBM1026"] = 1026; + code_pages["IBM1140"] = 1140; + code_pages["IBM1141"] = 1141; + code_pages["IBM1142"] = 1142; + code_pages["IBM1143"] = 1143; + code_pages["IBM1144"] = 1144; + code_pages["IBM1145"] = 1145; + code_pages["IBM1146"] = 1146; + code_pages["IBM1147"] = 1147; + code_pages["IBM1148"] = 1148; + code_pages["IBM1149"] = 1149; + code_pages["UTF-16"] = 1200; + code_pages["UNICODEFFFE"] = 1201; + code_pages["WINDOWS-1250"] = 1250; + code_pages["WINDOWS-1251"] = 1251; + code_pages["WINDOWS-1252"] = 1252; + code_pages["WINDOWS-1253"] = 1253; + code_pages["WINDOWS-1254"] = 1254; + code_pages["WINDOWS-1255"] = 1255; + code_pages["WINDOWS-1256"] = 1256; + code_pages["WINDOWS-1257"] = 1257; + code_pages["WINDOWS-1258"] = 1258; + code_pages["JOHAB"] = 1361; + code_pages["MACINTOSH"] = 10000; + code_pages["X-MAC-JAPANESE"] = 10001; + code_pages["X-MAC-CHINESETRAD"] = 10002; + code_pages["X-MAC-KOREAN"] = 10003; + code_pages["X-MAC-ARABIC"] = 10004; + code_pages["X-MAC-HEBREW"] = 10005; + code_pages["X-MAC-GREEK"] = 10006; + code_pages["X-MAC-CYRILLIC"] = 10007; + code_pages["X-MAC-CHINESESIMP"] = 10008; + code_pages["X-MAC-ROMANIAN"] = 10010; + code_pages["X-MAC-UKRANIAN"] = 10017; + code_pages["X-MAC-THAI"] = 10021; + code_pages["X-MAC-CE"] = 10029; + code_pages["X-MAC-ICELANDIC"] = 10079; + code_pages["X-MAC-TURKISH"] = 10081; + code_pages["X-MAC-CROATIAN"] = 10082; + code_pages["UTF-32"] = 12000; + code_pages["UTF-32BE"] = 12001; + code_pages["X-CHINESE_CNS"] = 20000; + code_pages["X-CP20001"] = 20001; + code_pages["X-CHINESE-ETEN"] = 20002; + code_pages["X-CP20003"] = 20003; + code_pages["X-CP20004"] = 20004; + code_pages["X-CP20005"] = 20005; + code_pages["X-IA5"] = 20105; + code_pages["X-IA5-GERMAN"] = 20106; + code_pages["X-IA5-SWEDISH"] = 20107; + code_pages["X-IA5-NORWEGIAN"] = 20108; + code_pages["US-ASCII"] = 20127; + code_pages["X-IA5-GERMAN"] = 20106; + code_pages["X-CP20261"] = 20261; + code_pages["X-CP20259"] = 20269; + code_pages["IBM273"] = 20273; + code_pages["IBM277"] = 20277; + code_pages["IBM278"] = 20278; + code_pages["IBM280"] = 20280; + code_pages["IBM284"] = 20284; + code_pages["IBM285"] = 20285; + code_pages["IBM290"] = 20290; + code_pages["IBM297"] = 20297; + code_pages["IBM420"] = 20420; + code_pages["IBM423"] = 20423; + code_pages["IBM424"] = 20424; + code_pages["X-EBCDIC-KOREANEXTENDED"]= 20833; + code_pages["IBM-THAI"] = 20838; + code_pages["KOI8-R"] = 20866; + code_pages["IBM871"] = 20871; + code_pages["IBM880"] = 20880; + code_pages["IBM905"] = 20905; + code_pages["IBM00924"] = 20924; + code_pages["EUC-JP"] = 20932; + code_pages["X-CP20936"] = 20936; + code_pages["X-CP20949"] = 20949; + code_pages["CP1025"] = 21025; + //21027 code page is deprecated + code_pages["KOI8-U"] = 21866; + code_pages["ISO-8859-1"] = 28591; + code_pages["ISO-8859-2"] = 28592; + code_pages["ISO-8859-3"] = 28593; + code_pages["ISO-8859-4"] = 28594; + code_pages["ISO-8859-5"] = 28595; + code_pages["ISO-8859-6"] = 28596; + code_pages["ISO-8859-7"] = 28597; + code_pages["ISO-8859-8"] = 28598; + code_pages["ISO-8859-9"] = 28599; + code_pages["ISO-8859-13"] = 28603; + code_pages["ISO-8859-15"] = 28605; + code_pages["X-EUROPA"] = 29001; + code_pages["ISO-8859-8-I"] = 39598; + code_pages["ISO-2022-JP"] = 50220; + code_pages["CSISO2022JP"] = 50221; + code_pages["ISO-2022-JP"] = 50222; + code_pages["ISO-2022-KR"] = 50225; + code_pages["X-CP50227"] = 50227; + //50229 not .NET name + //50930 not .NET name + //50933 not .NET name + //50931 not .NET name + //50935 not .NET name + //50936 not .NET name + //50937 not .NET name + //50939 not .NET name + code_pages["EUC-JP"] = 51932; + code_pages["EUC-CN"] = 51936; + code_pages["EUC-KR"] = 51949; + //51950 not .NET name + code_pages["HZ-GB-2312"] = 52936; + code_pages["X-ISCII-DE"] = 57002; + code_pages["X-ISCII-BE"] = 57003; + code_pages["X-ISCII-TA"] = 57004; + code_pages["X-ISCII-TE"] = 57005; + code_pages["X-ISCII-AS"] = 57006; + code_pages["X-ISCII-OR"] = 57007; + code_pages["X-ISCII-KA"] = 57008; + code_pages["X-ISCII-MA"] = 57009; + code_pages["X-ISCII-GU"] = 57010; + code_pages["X-ISCII-PA"] = 57010; + code_pages["UTF-7"] = 65000; + code_pages["UTF-8"] = 65001; + + for (int i = 0; i < encoding.length(); i++){ + encoding[i] = toupper(encoding[i]); + } + if (code_pages.count(encoding)){ + return code_pages[encoding]; + } else{ + return 0; + } +} + +void Pandora_Module_Exec::getOutputEncoding(){ + + this->output_encoding = "ISO-8859-1"; //initialize with default encoding + string buffer, filename; + int pos; + filename = Pandora::getPandoraInstallDir (); + filename += "pandora_agent.conf"; + + ifstream file; + file.open (filename.c_str ()); + bool token_found = false; + + while (!file.eof () && !token_found) { + /* Set the value from each line */ + getline (file, buffer); + + /* Ignore blank or commented lines */ + if (buffer[0] != '#' && buffer[0] != '\n' && buffer[0] != '\0') { + /*Check if is the encoding line*/ + pos = buffer.find("encoding"); + if (pos != string::npos){ + this->output_encoding = ""; + this->output_encoding = buffer.substr(pos+9); + token_found = true; + } + } + } + file.close(); +} + +void Pandora_Module_Exec::changeInputEncoding(){ + + int size_wchar = MultiByteToWideChar( CP_UTF8 , 0 , this->module_exec.c_str () , -1, NULL , 0 ); + wchar_t* wstr = new wchar_t[size_wchar]; + if (size_wchar != 0){ + MultiByteToWideChar( CP_UTF8 , 0 , this->module_exec.c_str () , -1, wstr , size_wchar ); + char buf[BUFSIZE + 1]; + wcstombs(buf, wstr, size_wchar); + buf[size_wchar] = '\0'; + this->module_exec = buf; + } + delete[] wstr; +} + +void Pandora_Module_Exec::changeOutputEncoding(string * string_change){ + + //first change: from native encoding to system encoding + UINT cp_output = getNumberEncoding(this->output_encoding); + if (cp_output != 0) { + int size_wchar = MultiByteToWideChar( this->native_encoding , 0 , string_change->c_str() , -1, NULL , 0 ); + wchar_t* wstr = new wchar_t[size_wchar]; + if (size_wchar != 0){ + MultiByteToWideChar( this->native_encoding , 0 , string_change->c_str() , -1, wstr , size_wchar ); + //second change: from system encoding to output encoding + int size_schar = WideCharToMultiByte( cp_output, 0, wstr, -1, NULL, 0, NULL, NULL); + char* sstr = new char[size_schar]; + if (size_schar != 0){ + WideCharToMultiByte( cp_output, 0, wstr, -1, sstr, size_schar, NULL, NULL); + * string_change = sstr; + } + delete[] sstr; + } + delete[] wstr; + } else { + pandoraDebug ("Cannot find code page of encoding: %s", this->output_encoding.c_str ()); + } +} + + diff --git a/pandora_agents/win32/modules/pandora_module_exec.h b/pandora_agents/win32/modules/pandora_module_exec.h index 42ec496b3c..1d7c3d08cc 100644 --- a/pandora_agents/win32/modules/pandora_module_exec.h +++ b/pandora_agents/win32/modules/pandora_module_exec.h @@ -34,9 +34,17 @@ namespace Pandora_Modules { class Pandora_Module_Exec : public Pandora_Module { private: string module_exec; + UINT native_encoding; + string output_encoding; + UINT getNumberEncoding(string encoding); + void getOutputEncoding(); + void changeInputEncoding(); + void changeOutputEncoding(string * string_change); public: unsigned char proc; - Pandora_Module_Exec (string name, string exec); + Pandora_Module_Exec (string name, string exec); + //overloaded constructor for module_exec + Pandora_Module_Exec (string name, string exec, string native); void run (); }; diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index 049bf6f152..00f34fcd9e 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -118,6 +118,7 @@ using namespace Pandora_Strutils; #define TOKEN_QUIET ("module_quiet ") #define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ") #define TOKEN_MACRO ("module_macro") +#define TOKEN_NATIVE ("module_native") string parseLine (string line, string token) { @@ -170,6 +171,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical; string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags; string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval; + string module_native; string macro; Pandora_Module *module; bool numeric; @@ -247,6 +249,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_warning_inverse = ""; module_quiet = ""; module_ff_interval = ""; + module_native = ""; macro = ""; stringtok (tokens, definition, "\n"); @@ -489,6 +492,11 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_quiet == "") { module_quiet = parseLine (line, TOKEN_QUIET); } + + if (module_native == "") { + module_native = parseLine (line, TOKEN_NATIVE); + } + if (module_ff_interval == "") { module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL); } @@ -1047,6 +1055,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_quiet.replace(pos_macro, macro_name.size(), macro_value); } } + + if (module_native != "") { + pos_macro = module_native.find(macro_name); + if (pos_macro != string::npos){ + module_native.replace(pos_macro, macro_name.size(), macro_value); + } + } if (module_ff_interval != "") { pos_macro = module_ff_interval.find(macro_name); @@ -1061,7 +1076,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { /* Create module objects */ if (module_exec != "") { module = new Pandora_Module_Exec (module_name, - module_exec); + module_exec, module_native); if (module_timeout != "") { module->setTimeout (atoi (module_timeout.c_str ())); } diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 335e24a7a1..6fe78fe682 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.0RC1(Build 150908)") +#define PANDORA_VERSION ("6.0RC1(Build 150914)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc index 383727f7a2..a517e010f5 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -1028,7 +1028,7 @@ Pandora_Windows_Service::recvTentacleDataFile (string host, ZeroMemory (&pi, sizeof (pi)); if (CreateProcess (NULL , (CHAR *)tentacle_cmd.c_str (), NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0) { - return; + throw Pandora_Exception (); } /* close thread handle, because it won't be used */ @@ -1045,7 +1045,7 @@ Pandora_Windows_Service::recvTentacleDataFile (string host, TerminateProcess(pi.hProcess, STILL_ACTIVE); CloseHandle (pi.hProcess); pandoraLog ("Unable to receive file %s (tentacle timeout)", filename.c_str ()); - return; + throw Pandora_Exception (); } /* Get the return code of the tentacle client*/ @@ -1053,7 +1053,7 @@ Pandora_Windows_Service::recvTentacleDataFile (string host, if (rc != 0) { CloseHandle (pi.hProcess); pandoraLog ("Unable to receive file %s", filename.c_str ()); - return; + throw Pandora_Exception (); } CloseHandle (pi.hProcess); diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index c482e40302..97ff2d9587 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.0RC1(Build 150908))" + VALUE "ProductVersion", "(6.0RC1(Build 150914))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 2f0b90b8c2..bff6709bb6 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0RC1-150908 +Version: 6.0RC1-150914 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 94dc7c9c77..e7c315f245 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.0RC1-150908" +pandora_version="6.0RC1-150914" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql index e4e4fb4204..a5784f65d9 100644 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql @@ -161,5 +161,5 @@ INSERT INTO `tgis_map_has_tgis_map_con` SELECT * FROM `tgis_map_has_tgis_map_con DROP TABLE `tgis_map_has_tgis_map_connection`; ALTER TABLE `tmodule_relationship` - ADD COLUMN `id_rt` int(10) unsigned NOT NULL DEFAULT 0, + --ADD COLUMN `id_rt` int(10) unsigned NOT NULL DEFAULT 0, ADD FOREIGN KEY (`id_rt`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE; diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 22911d9a2a..aeafd08118 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -220,7 +220,16 @@ function update_template ($step) { $wizard_level = (string) get_parameter ('wizard_level'); $priority = (int) get_parameter ('priority'); $id_group = get_parameter ("id_group"); - $name_check = db_get_value ('name', 'talert_templates', 'name', $name); + + switch ($config['dbtype']) { + case "mysql": + case "postgresql": + $name_check = db_get_value ('name', 'talert_templates', 'name', $name); + break; + case "oracle": + $name_check = db_get_value ('name', 'talert_templates', 'to_char(name)', $name); + break; + } $values = array ('name' => $name, 'description' => $description, @@ -371,7 +380,16 @@ if ($create_template) { $priority = (int) get_parameter ('priority'); $wizard_level = (string) get_parameter ('wizard_level'); $id_group = get_parameter ("id_group"); - $name_check = db_get_value ('name', 'talert_templates', 'name', $name); + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + $name_check = db_get_value ('name', 'talert_templates', 'name', $name); + break; + case "oracle": + $name_check = db_get_value ('name', 'talert_templates', 'to_char(name)', $name); + break; + } + $values = array ('description' => $description, 'value' => $value, diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index c437304e3d..caee73a739 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -85,6 +85,10 @@ if (is_ajax ()) { return; } + if ( https_is_running() ) { + header('Content-type: application/json'); + } + if ($filter_agents_json != '') { $filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true); } diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 24e4b13288..cf444020ef 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -277,43 +277,43 @@ function type_change () { // type 1-4 - Generic_xxxxxx if ((document.component.type.value > 0) && (document.component.type.value < 5)) { - $("input[name=snmp_community]").css({backgroundColor: '#ddd'}); + $("input[name=snmp_community]").css({backgroundColor: '#ddd !important'}); $("input[name=snmp_community]").attr("disabled", true); - $("input[name=tcp_rcv]").css({backgroundColor: '#ddd'}); + $("input[name=tcp_rcv]").css({backgroundColor: '#ddd !important'}); $("input[name=tcp_rcv]").attr("disabled", true); - $("input[name=snmp_oid]").css({backgroundColor: '#ddd'}); + $("input[name=snmp_oid]").css({backgroundColor: '#ddd !important'}); $("input[name=snmp_oid]").attr("disabled", true); - $("input[name=tcp_send]").css({backgroundColor: '#ddd'}); + $("input[name=tcp_send]").css({backgroundColor: '#ddd !important'}); $("input[name=tcp_send]").attr("disabled", true); - $("input[name=tcp_port]").css({backgroundColor: '#ddd'}); + $("input[name=tcp_port]").css({backgroundColor: '#ddd !important'}); $("input[name=tcp_port]").attr("disabled", true); - $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); + $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd !important'}); $("input[name=snmp3_auth_user]").attr("disabled", true); - $("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'}); + $("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd !important'}); $("input[name=snmp3_auth_pass]").attr("disabled", true); - $("#snmp3_privacy_method").css({backgroundColor: '#ddd'}); + $("#snmp3_privacy_method").css({backgroundColor: '#ddd !important'}); $("#snmp3_privacy_method").attr("disabled", true); - $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'}); + $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd !important'}); $("input[name=snmp3_privacy_pass]").attr("disabled", true); - $("#snmp3_auth_method").css({backgroundColor: '#ddd'}); + $("#snmp3_auth_method").css({backgroundColor: '#ddd !important'}); $("#snmp3_auth_method").attr("disabled", true); - $("#snmp3_security_level").css({backgroundColor: '#ddd'}); + $("#snmp3_security_level").css({backgroundColor: '#ddd !important'}); $("#snmp3_security_level").attr("disabled", true); } // type 15-18- SNMP @@ -324,9 +324,9 @@ function type_change () { document.component.snmp_community.disabled=false; document.component.snmp_oid.style.background="#fff"; document.component.snmp_oid.disabled=false; - document.component.tcp_send.style.background="#ddd"; + document.component.tcp_send.style.background="#ddd !important"; document.component.tcp_send.disabled=true; - document.component.tcp_rcv.style.background="#ddd"; + document.component.tcp_rcv.style.background="#ddd !important"; document.component.tcp_rcv.disabled=true; document.component.tcp_port.style.background="#fff"; document.component.tcp_port.disabled=false; @@ -350,39 +350,39 @@ function type_change () { } // type 6-7 - ICMP if ((document.component.type.value == 6) || (document.component.type.value == 7)) { - document.component.snmp_oid.style.background="#ddd"; + document.component.snmp_oid.style.background="#ddd !important"; document.component.snmp_oid.disabled=true; - document.component.snmp_community.style.background="#ddd"; + document.component.snmp_community.style.background="#ddd !important"; document.component.snmp_community.disabled=true; - document.component.snmp_oid.style.background="#ddd"; + document.component.snmp_oid.style.background="#ddd !important"; document.component.snmp_oid.disabled=true; - document.component.tcp_send.style.background="#ddd"; + document.component.tcp_send.style.background="#ddd !important"; document.component.tcp_send.disabled=true; - document.component.tcp_rcv.style.background="#ddd"; + document.component.tcp_rcv.style.background="#ddd !important"; document.component.tcp_rcv.disabled=true; - document.component.tcp_port.style.background="#ddd"; + document.component.tcp_port.style.background="#ddd !important"; document.component.tcp_port.disabled=true; - document.component.snmp_version.style.background="#ddd"; + document.component.snmp_version.style.background="#ddd !important"; document.component.snmp_version.disabled=true; - document.component.snmp3_auth_user.style.background="#ddd"; + document.component.snmp3_auth_user.style.background="#ddd !important"; document.component.snmp3_auth_user.disabled=true; - document.component.snmp3_auth_pass.background="#ddd"; + document.component.snmp3_auth_pass.background="#ddd !important"; document.component.snmp3_auth_pass.disabled=true; - document.component.snmp3_privacy_method.style.background="#ddd"; + document.component.snmp3_privacy_method.style.background="#ddd !important"; document.component.snmp3_privacy_method.disabled=true; - document.component.snmp3_privacy_pass.style.background="#ddd"; + document.component.snmp3_privacy_pass.style.background="#ddd !important"; document.component.snmp3_privacy_pass.disabled=true; - document.component.snmp3_auth_method.style.background="#ddd"; + document.component.snmp3_auth_method.style.background="#ddd !important"; document.component.snmp3_auth_method.disabled=true; - document.component.snmp3_security_level.style.background="#ddd"; + document.component.snmp3_security_level.style.background="#ddd !important"; document.component.snmp3_security_level.disabled=true; } // type 8-11 - TCP if ((document.component.type.value > 7) && (document.component.type.value < 12)) { - document.component.snmp_oid.style.background="#ddd"; + document.component.snmp_oid.style.background="#ddd !important"; document.component.snmp_oid.disabled=true; - document.component.snmp_community.style.background="#ddd"; + document.component.snmp_community.style.background="#ddd !important"; document.component.snmp_community.disabled=true; document.component.tcp_send.style.background="#fff"; document.component.tcp_send.disabled=false; @@ -391,26 +391,26 @@ function type_change () { document.component.tcp_port.style.background="#fff"; document.component.tcp_port.disabled=false; - document.component.snmp_version.style.background="#ddd"; + document.component.snmp_version.style.background="#ddd !important"; document.component.snmp_version.disabled=true; - document.component.snmp3_auth_user.style.background="#ddd"; + document.component.snmp3_auth_user.style.background="#ddd !important"; document.component.snmp3_auth_user.disabled=true; - document.component.snmp3_auth_pass.background="#ddd"; + document.component.snmp3_auth_pass.background="#ddd !important"; document.component.snmp3_auth_pass.disabled=true; - document.component.snmp3_privacy_method.style.background="#ddd"; + document.component.snmp3_privacy_method.style.background="#ddd !important"; document.component.snmp3_privacy_method.disabled=true; - document.component.snmp3_privacy_pass.style.background="#ddd"; + document.component.snmp3_privacy_pass.style.background="#ddd !important"; document.component.snmp3_privacy_pass.disabled=true; - document.component.snmp3_auth_method.style.background="#ddd"; + document.component.snmp3_auth_method.style.background="#ddd !important"; document.component.snmp3_auth_method.disabled=true; - document.component.snmp3_security_level.style.background="#ddd"; + document.component.snmp3_security_level.style.background="#ddd !important"; document.component.snmp3_security_level.disabled=true; } // type 12 - UDP if (document.component.type.value == 12) { - document.component.snmp_oid.style.background="#ddd"; + document.component.snmp_oid.style.background="#ddd !important"; document.component.snmp_oid.disabled=true; - document.component.snmp_community.style.background="#ddd"; + document.component.snmp_community.style.background="#ddd !important"; document.component.snmp_community.disabled=true; document.component.tcp_send.style.background="#fff"; document.component.tcp_send.disabled=false; @@ -419,19 +419,19 @@ function type_change () { document.component.tcp_port.style.background="#fff"; document.component.tcp_port.disabled=false; - document.component.snmp_version.style.background="#ddd"; + document.component.snmp_version.style.background="#ddd !important"; document.component.snmp_version.disabled=true; - document.component.snmp3_auth_user.style.background="#ddd"; + document.component.snmp3_auth_user.style.background="#ddd !important"; document.component.snmp3_auth_user.disabled=true; - document.component.snmp3_auth_pass.background="#ddd"; + document.component.snmp3_auth_pass.background="#ddd !important"; document.component.snmp3_auth_pass.disabled=true; - document.component.snmp3_privacy_method.style.background="#ddd"; + document.component.snmp3_privacy_method.style.background="#ddd !important"; document.component.snmp3_privacy_method.disabled=true; - document.component.snmp3_privacy_pass.style.background="#ddd"; + document.component.snmp3_privacy_pass.style.background="#ddd !important"; document.component.snmp3_privacy_pass.disabled=true; - document.component.snmp3_auth_method.style.background="#ddd"; + document.component.snmp3_auth_method.style.background="#ddd !important"; document.component.snmp3_auth_method.disabled=true; - document.component.snmp3_security_level.style.background="#ddd"; + document.component.snmp3_security_level.style.background="#ddd !important"; document.component.snmp3_security_level.disabled=true; } } diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 83b3272a02..3a93750e9e 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -273,7 +273,7 @@ function readFields() { values['module'] = $("select[name=module]").val(); values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); - values['period'] = $("#hidden-period").val(); + values['period'] = $("select[name=period]").val(); values['width'] = $("input[name=width]").val(); values['height'] = $("input[name=height]").val(); values['parent'] = $("select[name=parent]").val(); diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index 22d789694d..05a81df863 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -32,6 +32,9 @@ ob_clean(); $search_agents = (bool) get_parameter ('search_agents'); $get_agents_group = (bool) get_parameter('get_agents_group', false); $force_local = (bool) get_parameter('force_local', false); +if ( https_is_running() ) { + header('Content-type: application/json'); +} if ($get_agents_group) { diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 9a4c04cbcb..36cb189f58 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -34,6 +34,9 @@ $list_modules = (bool) get_parameter('list_modules', 0); if ($get_plugin_macros) { + if ( https_is_running() ) { + header('Content-type: application/json'); + } $id_plugin = get_parameter('id_plugin', 0); $plugin_macros = db_get_value('macros', 'tplugin', 'id', @@ -49,6 +52,9 @@ if ($get_plugin_macros) { if ($search_modules) { + if ( https_is_running() ) { + header('Content-type: application/json'); + } $id_agents = json_decode(io_safe_output(get_parameter('id_agents'))); $filter = '%' . get_parameter('q', '') . '%'; $other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true); diff --git a/pandora_console/include/ajax/networkmap.ajax.php b/pandora_console/include/ajax/networkmap.ajax.php index 5131de9664..3e4849981f 100644 --- a/pandora_console/include/ajax/networkmap.ajax.php +++ b/pandora_console/include/ajax/networkmap.ajax.php @@ -45,28 +45,28 @@ switch($action) { $summary = '
'; if (isset($stats['policies'])) { - $summary .= count($stats['policies']) . " x " . + $summary .= $stats['policies'] . " x " . html_print_image($hack_metaconsole . 'images/policies.png',true) . ' '. __('Policies') . "
"; } if (isset($stats['groups'])) { // TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY - $summary .= count($stats['groups']) . " x " . + $summary .= $stats['groups'] . " x " . html_print_image($hack_metaconsole . 'images/group.png',true) . ' ' . __('Groups') . "
"; } if (isset($stats['agents'])) { // TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY - $summary .= count($stats['agents']) . + $summary .= $stats['agents'] . " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . ' ' . __('Agents') . "
"; } if (isset($stats['modules'])) { // TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY - $summary .= count($stats['modules']) . + $summary .= $stats['modules'] . " x " . html_print_image($hack_metaconsole . 'images/brick.png',true) . ' ' . __('Modules') . "
"; } diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 3aafc8f198..71922f97cf 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 = 'PC150908'; +$build_version = 'PC150914'; $pandora_version = 'v6.0RC1'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/db/oracle.php b/pandora_console/include/db/oracle.php index 65c24409f5..d1079cb3d0 100644 --- a/pandora_console/include/db/oracle.php +++ b/pandora_console/include/db/oracle.php @@ -256,7 +256,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection = if ($type[0] == 'INSERT') { oci_bind_by_name($query, ":table_name", $table_name, 32); oci_bind_by_name($query, ":sql", $sql, -1); - oci_bind_by_name($query, ":out", $id, 32); + oci_bind_by_name($query, ":out", $id, 40); } if (!$autocommit) { @@ -278,6 +278,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection = $error = sprintf ('%s (\'%s\') in %s on line %d', htmlentities($e['message'], ENT_QUOTES), $sql, $backtrace[0]['file'], $backtrace[0]['line']); db_add_database_debug_trace ($sql, htmlentities($e['message'], ENT_QUOTES)); + set_error_handler ('db_sql_error_handler'); trigger_error ($error); restore_error_handler (); @@ -290,7 +291,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection = if ($status !== 'SELECT') { //The query NOT IS a select if ($rettype == "insert_id") { - $result = $result; + $result = $id; } elseif ($rettype == "info") { //TODO: return debug information of the query $result = pg_result_status($result, PGSQL_STATUS_STRING); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index f2038b5395..5fb0292111 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -725,12 +725,12 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, } if (!$avg_only) { - $legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['max']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['max']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['max']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['max']['min'], 2), '.0').' '.$unit; - $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit; - $legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['min']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['min']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['min']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['min']['min'], 2), '.0').' '.$unit; + $legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['max']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['max']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['max']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['max']['min'], 2), '.0').' '.$unit.'--> Seleccionado'; + $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> Seleccionado'; + $legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['min']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['min']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['min']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['min']['min'], 2), '.0').' '.$unit.'--> Seleccionado'; } else - $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit; + $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> Seleccionado'; //Baseline was replaced by compare graph feature /*if ($baseline) { $legend['baseline'.$series_suffix] = __('Baseline'); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 40aa61e54d..dc0dbcb61f 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1775,8 +1775,8 @@ function html_print_checkbox ($name, $value, $checked = false, $return = false, * @return string HTML code if return parameter is true. */ function html_print_image ($src, $return = false, $options = false, - $return_src = false, $relative = false) { - + $return_src = false, $relative = false, $no_in_meta = false) { + global $config; // If metaconsole is in use then don't use skins @@ -1799,7 +1799,10 @@ function html_print_image ($src, $return = false, $options = false, if (is_metaconsole()) { if (!$relative) { $working_dir = str_replace("\\", "/", getcwd()); // Windows compatibility - if (strstr($working_dir, 'enterprise/meta') === false) { + if ($no_in_meta){ + $src = '../../' . $src; + } + else if (strstr($working_dir, 'enterprise/meta') === false) { if ($src[0] !== '/') { $src = '/' . $src; } diff --git a/pandora_console/include/functions_network_components.php b/pandora_console/include/functions_network_components.php index 9426d75664..42ccf22f6a 100644 --- a/pandora_console/include/functions_network_components.php +++ b/pandora_console/include/functions_network_components.php @@ -341,9 +341,18 @@ function network_components_create_network_component ($name, $type, $id_group, $ switch ($config['dbtype']) { case "oracle": - if (empty($values['tcp_rcv'])) - $values['tcp_rcv'] = " "; - return; + switch ($type) { + case 8: + case 9: + case 10: + case 11: + case 12: + if (empty($values['tcp_rcv'])) + $values['tcp_rcv'] = " "; + break; + default: + break; + } break; } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index fd87de93fb..29547ecb47 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1332,7 +1332,24 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s global $hack_networkmap_mobile; global $config; - $stats_json = base64_encode(json_encode($stats)); + //$stats_json = base64_encode(json_encode($stats)); + $summary = array(); + if (isset($stats['policies'])) { + $summary['policies'] = count($stats['policies']); + } + if (isset($stats['groups'])) { + // TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY + $summary['groups'] = count($stats['groups']); + } + if (isset($stats['agents'])) { + // TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY + $summary['agents'] = count($stats['agents']); + } + if (isset($stats['modules'])) { + // TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY + $summary['modules'] = count($stats['modules']) ; + } + $stats_json = base64_encode(json_encode($summary)); $img_src = "images/networkmap/pandora_node.png"; if (defined('METACONSOLE')) { @@ -1343,12 +1360,12 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s 'stats='.$stats_json . '&' . 'metaconsole=1'; $url = ''; - $color = "#052938"; + $color = '#052938'; } else { $url_tooltip = 'ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view'; $url = 'index.php?sec=estado&sec2=operation/agentes/group_view'; - $color = "#373737"; + $color = '#373737'; } if ($hack_networkmap_mobile) { @@ -1357,10 +1374,12 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s ''; } else { - $img = '' . html_print_image("images/networkmap/pandora_node.png", true, false, false, true) . ''; + $image = html_print_image("images/networkmap/pandora_node.png", true, false, false, true); + $image = str_replace('"',"'",$image); + $img = '' . $image . ''; } - $name = '' . $name . ''; - $label = '' . $img.$name . '
'; + $name = "" . $name . ''; + $label = "" . $img.$name . '
'; if ($simple == 1) { $label = ''; } @@ -1385,7 +1404,7 @@ function networkmap_open_group ($id) { $name = groups_get_name ($id); $group = 'subgraph cluster_' . $id . - ' { style=filled; color=darkolivegreen3; label=< + ' { style=filled; color=darkolivegreen3; label=<
' . html_print_image($img, true) . ''.$name.'
>; tooltip="'.$name.'"; URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=' diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 00502ae9ff..657ddf6289 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -716,6 +716,16 @@ input.cancel, input.default, input.filter, input.pdf { } +input:disabled { + background-color: #DDD !important; +} +textarea:disabled { + background-color: #DDD !important; +} +select:disabled { + background-color: #DDD !important; +} + input.next { background-image: url(../../images/input_go.png) !important; } diff --git a/pandora_console/install.php b/pandora_console/install.php index 266651aae5..e6fc47ed9e 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
", tree: data.tree, diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index f855d69263..cea8f6d724 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 6.0RC1 -%define release 150908 +%define release 150914 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 319068f0d4..57e86a2de0 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 6.0RC1 -%define release 150908 +%define release 150914 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index d3bf1a4c77..5e398ee2f2 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -64,8 +64,8 @@ INSERT INTO tconfig (token, value) VALUES ('days_compact','0'); INSERT INTO tconfig (token, value) VALUES ('graph_res','5'); INSERT INTO tconfig (token, value) VALUES ('step_compact','1'); INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc'); -INSERT INTO tconfig (token, value) VALUES ('db_scheme_version','6.0RC1'); -INSERT INTO tconfig (token, value) VALUES ('db_scheme_build','PD150901'); +INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.0RC1'); +INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD150914'); INSERT INTO tconfig (token, value) VALUES ('show_unknown','0'); INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1'); INSERT INTO tconfig (token, value) VALUES ('style','pandora'); diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 976a502e3b..62201737a7 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 6.0RC1-150908 +Version: 6.0RC1-150914 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index a2c9c98280..ed77a15aa6 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.0RC1-150908" +pandora_version="6.0RC1-150914" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 52e271c465..8095c30817 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -43,7 +43,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "6.0RC1"; -my $pandora_build = "150908"; +my $pandora_build = "150914"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index fe64295e40..66cb52b7e6 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 6.0RC1 -%define release 150908 +%define release 150914 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 056bb44529..a74c3ee2a2 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 6.0RC1 -%define release 150908 +%define release 150914 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 22d26cd62d..2344b765e4 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -33,7 +33,7 @@ use PandoraFMS::Tools; use PandoraFMS::DB; # version: define current version -my $version = "6.0RC1 PS150908"; +my $version = "6.0RC1 PS150914"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index c9b423d5bd..15b68f1f8b 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -35,7 +35,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "6.0RC1 PS150908"; +my $version = "6.0RC1 PS150914"; # save program name for logging my $progname = basename($0); diff --git a/pandora_server/util/recon_scripts/snmp-recon.pl b/pandora_server/util/recon_scripts/snmp-recon.pl index 64a2e29db9..071d65884a 100755 --- a/pandora_server/util/recon_scripts/snmp-recon.pl +++ b/pandora_server/util/recon_scripts/snmp-recon.pl @@ -10,6 +10,7 @@ use lib '/usr/lib/perl5'; use POSIX qw/strftime/; use Socket qw/inet_aton/; +use NetAddr::IP; use PandoraFMS::Tools; use PandoraFMS::DB; @@ -1102,14 +1103,6 @@ $DBH = db_connect ('mysql', $CONF{'dbname'}, $CONF{'dbhost'}, $CONF{'dbport'}, $ # 0% update_recon_task($DBH, $TASK_ID, 1); -# Populate ARP caches. -message("Populating ARP caches..."); -my $nmap_args = '-nsP --send-ip --max-retries '.$CONF{'icmp_checks'}.' --host-timeout '.$CONF{'networktimeout'}.'s -T'.$CONF{'recon_timing_template'}; -my $np = new PandoraFMS::NmapParser; -if ($#SUBNETS >= 0) { - $np->parsescan($CONF{'nmap'}, $nmap_args, @SUBNETS); -} - # Find routers. message("[1/6] Searching for routers..."); if (defined($ROUTER) && $ROUTER ne '') { @@ -1125,14 +1118,24 @@ if (defined($ROUTER) && $ROUTER ne '') { } } else { - my @scanned_hosts = $np->all_hosts(); - foreach my $host (@scanned_hosts) { - next unless defined($host->addr()) and defined($host->status()) and ($host->status() eq 'up'); + foreach my $subnet (@SUBNETS) { + my $net_addr = new NetAddr::IP ($subnet); + if (!defined($net_addr)) { + message("Invalid network: $subnet"); + exit 1; + } - # Make sure the host is up (nmap gives false positives!). - next if (pandora_ping(\%CONF, $host->addr(), 1, 1) == 0); + my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum; + foreach my $host (@hosts) { - arp_cache_discovery($host->addr()); + # Check if the device has already been visited. + next if (defined($VISITED_DEVICES{$host})); + + # Check if the host is up. + next if (pandora_ping(\%CONF, $host, 1, 1) == 0); + + arp_cache_discovery($host); + } } } update_recon_task($DBH, $TASK_ID, 30);