2009-09-24 Sancho Lerena <slerena@artica.es>
* 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. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1969 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
7358747348
commit
d5b14dab3b
|
@ -1,3 +1,21 @@
|
||||||
|
2009-09-24 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
|
* 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 <rnovoa@artica.es>
|
2009-09-23 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* windows/pandora_wmi.h, modules/pandora_module_inventory.cc: Changed
|
* windows/pandora_wmi.h, modules/pandora_module_inventory.cc: Changed
|
||||||
|
|
Binary file not shown.
|
@ -216,8 +216,8 @@ Pandora_Module_Inventory::run () {
|
||||||
this->has_output = false;
|
this->has_output = false;
|
||||||
}
|
}
|
||||||
rows.clear();
|
rows.clear();
|
||||||
}
|
}
|
||||||
found = this->options.find(module_inventory_software_str);
|
found = this->options.find(module_inventory_services_str);
|
||||||
if (found != string::npos){
|
if (found != string::npos){
|
||||||
pandoraDebug(" Launching Services Query WMI\n");
|
pandoraDebug(" Launching Services Query WMI\n");
|
||||||
num_results = Pandora_Wmi::getServices(rows);
|
num_results = Pandora_Wmi::getServices(rows);
|
||||||
|
|
|
@ -35,10 +35,8 @@ using namespace Pandora_Modules;
|
||||||
Pandora_Module_Tcpcheck::Pandora_Module_Tcpcheck (string name, string address, string port, string timeout)
|
Pandora_Module_Tcpcheck::Pandora_Module_Tcpcheck (string name, string address, string port, string timeout)
|
||||||
: Pandora_Module (name) {
|
: Pandora_Module (name) {
|
||||||
int rc;
|
int rc;
|
||||||
WSADATA wsa_data;
|
|
||||||
|
|
||||||
// Initialize Winsock
|
// Initialize Winsock
|
||||||
WSAStartup (MAKEWORD(2,2), &wsa_data);
|
|
||||||
|
|
||||||
this->address = address;
|
this->address = address;
|
||||||
this->port = atoi (port.c_str ());
|
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 destructor.
|
||||||
*/
|
*/
|
||||||
Pandora_Module_Tcpcheck::~Pandora_Module_Tcpcheck () {
|
Pandora_Module_Tcpcheck::~Pandora_Module_Tcpcheck () {
|
||||||
WSACleanup ();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Pandora_Module_Tcpcheck::run () {
|
Pandora_Module_Tcpcheck::run () {
|
||||||
|
@ -67,6 +64,13 @@ Pandora_Module_Tcpcheck::run () {
|
||||||
struct hostent *host = NULL;
|
struct hostent *host = NULL;
|
||||||
fd_set socket_set;
|
fd_set socket_set;
|
||||||
timeval timer;
|
timeval timer;
|
||||||
|
|
||||||
|
WSADATA wsa_data;
|
||||||
|
|
||||||
|
// Initialize Winsock
|
||||||
|
WSAStartup (MAKEWORD(2,2), &wsa_data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Run
|
// Run
|
||||||
try {
|
try {
|
||||||
|
@ -76,13 +80,15 @@ Pandora_Module_Tcpcheck::run () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->address.empty ()) {
|
if (this->address.empty ()) {
|
||||||
|
WSACleanup ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the TCP socket
|
// Create the TCP socket
|
||||||
sock = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
sock = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (sock == SOCKET_ERROR) {
|
if (sock == SOCKET_ERROR) {
|
||||||
pandoraLog ("Error %d creating socket", WSAGetLastError ());
|
pandoraLog ("Error %d creating socket", WSAGetLastError ());
|
||||||
|
WSACleanup ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,13 +102,14 @@ Pandora_Module_Tcpcheck::run () {
|
||||||
host = gethostbyname(this->address.c_str ());
|
host = gethostbyname(this->address.c_str ());
|
||||||
if (host == NULL) {
|
if (host == NULL) {
|
||||||
pandoraLog ("Could not resolve address for %s", this->address.c_str ());
|
pandoraLog ("Could not resolve address for %s", this->address.c_str ());
|
||||||
|
WSACleanup ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&server.sin_addr, host->h_addr_list[0], host->h_length);
|
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);
|
ioctlsocket (sock, FIONBIO, &mode);
|
||||||
|
|
||||||
// Connection request
|
// Connection request
|
||||||
|
@ -111,6 +118,7 @@ Pandora_Module_Tcpcheck::run () {
|
||||||
rc = WSAGetLastError ();
|
rc = WSAGetLastError ();
|
||||||
if (rc != WSAEWOULDBLOCK) {
|
if (rc != WSAEWOULDBLOCK) {
|
||||||
pandoraLog ("connect error %d", rc);
|
pandoraLog ("connect error %d", rc);
|
||||||
|
WSACleanup ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,8 +132,10 @@ Pandora_Module_Tcpcheck::run () {
|
||||||
rc = select(0, NULL, &socket_set, NULL, &timer);
|
rc = select(0, NULL, &socket_set, NULL, &timer);
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
this->setOutput ("0");
|
this->setOutput ("0");
|
||||||
|
|
||||||
|
WSACleanup ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
WSACleanup ();
|
||||||
this->setOutput ("1");
|
this->setOutput ("1");
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 ("3.0(Build 090224)")
|
#define PANDORA_VERSION ("3.0(Build 090924)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
|
|
@ -197,9 +197,9 @@ Pandora_Windows_Service::getXmlHeader () {
|
||||||
agent->SetAttribute ("interval", value);
|
agent->SetAttribute ("interval", value);
|
||||||
|
|
||||||
value = Pandora_Windows_Info::getOSName ();
|
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);
|
agent->SetAttribute ("os_version", value);
|
||||||
|
|
||||||
return agent;
|
return agent;
|
||||||
|
@ -245,7 +245,7 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
|
||||||
tentacle_cmd += " " + opts;
|
tentacle_cmd += " " + opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
tentacle_cmd += " " + filepath;
|
tentacle_cmd += " \"" + filepath + "\"";
|
||||||
|
|
||||||
/* Copy the file */
|
/* Copy the file */
|
||||||
pandoraDebug ("Remote copying XML %s on server %s",
|
pandoraDebug ("Remote copying XML %s on server %s",
|
||||||
|
|
Loading…
Reference in New Issue