diff --git a/pandora_agents/win32/ChangeLog b/pandora_agents/win32/ChangeLog index feeeeda985..8f4f0e0d8c 100644 --- a/pandora_agents/win32/ChangeLog +++ b/pandora_agents/win32/ChangeLog @@ -1,3 +1,21 @@ +2009-09-24 Sancho Lerena + + * modules/pandora_module_tcpcheck.cc: WSAStartup memory management + was leaking memory, so we will create and destroy in each loop the WSA + structure. Tested and leak-proof :-)) + + * modules/pandora_module_inventory.cc: Fixed typo with string label of + services inventory module. + + * bin/PandoraAgent.exe: New binary (woah, compiled from linux!). + + * pandora_windows_service.cc: Fixed problem in os XML Tag, was os_name + not os. Fixed problem with windows version, now is passwd full string to xml. + Tentacle call is passwd between quotes, because tentacle could be + in paths with blank spaces (by default \program files\pandora_agent). + + * pandora.cc: Build updated. + 2009-09-23 Ramon Novoa * windows/pandora_wmi.h, modules/pandora_module_inventory.cc: Changed diff --git a/pandora_agents/win32/bin/PandoraAgent.exe b/pandora_agents/win32/bin/PandoraAgent.exe index c3b1b31d7c..d072f53bb6 100755 Binary files a/pandora_agents/win32/bin/PandoraAgent.exe and b/pandora_agents/win32/bin/PandoraAgent.exe differ diff --git a/pandora_agents/win32/modules/pandora_module_inventory.cc b/pandora_agents/win32/modules/pandora_module_inventory.cc index 0389d2f469..ab0baf7c8a 100644 --- a/pandora_agents/win32/modules/pandora_module_inventory.cc +++ b/pandora_agents/win32/modules/pandora_module_inventory.cc @@ -216,8 +216,8 @@ Pandora_Module_Inventory::run () { this->has_output = false; } rows.clear(); - } - found = this->options.find(module_inventory_software_str); + } + found = this->options.find(module_inventory_services_str); if (found != string::npos){ pandoraDebug(" Launching Services Query WMI\n"); num_results = Pandora_Wmi::getServices(rows); diff --git a/pandora_agents/win32/modules/pandora_module_tcpcheck.cc b/pandora_agents/win32/modules/pandora_module_tcpcheck.cc index f5f76c8f07..d2382e22af 100755 --- a/pandora_agents/win32/modules/pandora_module_tcpcheck.cc +++ b/pandora_agents/win32/modules/pandora_module_tcpcheck.cc @@ -35,10 +35,8 @@ using namespace Pandora_Modules; Pandora_Module_Tcpcheck::Pandora_Module_Tcpcheck (string name, string address, string port, string timeout) : Pandora_Module (name) { int rc; - WSADATA wsa_data; // Initialize Winsock - WSAStartup (MAKEWORD(2,2), &wsa_data); this->address = address; this->port = atoi (port.c_str ()); @@ -56,8 +54,7 @@ Pandora_Module_Tcpcheck::Pandora_Module_Tcpcheck (string name, string address, s * Pandora_Module_Tcpcheck destructor. */ Pandora_Module_Tcpcheck::~Pandora_Module_Tcpcheck () { - WSACleanup (); -} +} void Pandora_Module_Tcpcheck::run () { @@ -67,6 +64,13 @@ Pandora_Module_Tcpcheck::run () { struct hostent *host = NULL; fd_set socket_set; timeval timer; + + WSADATA wsa_data; + + // Initialize Winsock + WSAStartup (MAKEWORD(2,2), &wsa_data); + + // Run try { @@ -76,13 +80,15 @@ Pandora_Module_Tcpcheck::run () { } if (this->address.empty ()) { + WSACleanup (); return; } - + // Create the TCP socket sock = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); if (sock == SOCKET_ERROR) { pandoraLog ("Error %d creating socket", WSAGetLastError ()); + WSACleanup (); return; } @@ -96,13 +102,14 @@ Pandora_Module_Tcpcheck::run () { host = gethostbyname(this->address.c_str ()); if (host == NULL) { pandoraLog ("Could not resolve address for %s", this->address.c_str ()); + WSACleanup (); return; } memcpy(&server.sin_addr, host->h_addr_list[0], host->h_length); } - - // Use non-blocking sockets to implement a timeout + + // Use non-blocking sockets to implement a timeout ioctlsocket (sock, FIONBIO, &mode); // Connection request @@ -111,6 +118,7 @@ Pandora_Module_Tcpcheck::run () { rc = WSAGetLastError (); if (rc != WSAEWOULDBLOCK) { pandoraLog ("connect error %d", rc); + WSACleanup (); return; } } @@ -124,8 +132,10 @@ Pandora_Module_Tcpcheck::run () { rc = select(0, NULL, &socket_set, NULL, &timer); if (rc == 0) { this->setOutput ("0"); + + WSACleanup (); return; } - + WSACleanup (); this->setOutput ("1"); } diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index a35063a7b4..c5a68a6b15 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 ("3.0(Build 090224)") +#define PANDORA_VERSION ("3.0(Build 090924)") 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 0e92a78e8b..0737319532 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -197,9 +197,9 @@ Pandora_Windows_Service::getXmlHeader () { agent->SetAttribute ("interval", value); value = Pandora_Windows_Info::getOSName (); - agent->SetAttribute ("os", value); + agent->SetAttribute ("os_name", value); - value = Pandora_Windows_Info::getOSVersion (); + value = value + Pandora_Windows_Info::getOSVersion (); agent->SetAttribute ("os_version", value); return agent; @@ -245,7 +245,7 @@ Pandora_Windows_Service::copyTentacleDataFile (string host, tentacle_cmd += " " + opts; } - tentacle_cmd += " " + filepath; + tentacle_cmd += " \"" + filepath + "\""; /* Copy the file */ pandoraDebug ("Remote copying XML %s on server %s",