2009-11-19 Ramon Novoa <rnovoa@artica.es>

* windows/pandora_wmi.cc: Fixed bug #2895307.

        * modules/pandora_module.cc: Fixed bug #2835450.

        * bin/pandora_agent.conf: Added xml_buffer configuration token.

        * ssh/libssh2/libssh2_config.h, ssh/libssh2/packet.c: Renamed usleep to
          u_sleep to avoid conflicts.

        * pandora_windows_service.cc: Fixed bug #2899257.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2115 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2009-11-19 00:40:26 +00:00
parent 47e04649b8
commit a190b7c9d1
7 changed files with 34 additions and 12 deletions

View File

@ -1,3 +1,16 @@
2009-11-19 Ramon Novoa <rnovoa@artica.es>
* windows/pandora_wmi.cc: Fixed bug #2895307.
* modules/pandora_module.cc: Fixed bug #2835450.
* bin/pandora_agent.conf: Added xml_buffer configuration token.
* ssh/libssh2/libssh2_config.h, ssh/libssh2/packet.c: Renamed usleep to
u_sleep to avoid conflicts.
* pandora_windows_service.cc: Fixed bug #2899257.
2009-11-17 Sancho Lerena <slerena@artica.es> 2009-11-17 Sancho Lerena <slerena@artica.es>
* Installer/Pandora_silent.mpi: Installer in silent mode. Should * Installer/Pandora_silent.mpi: Installer in silent mode. Should

View File

@ -57,6 +57,10 @@ server_port 41121
# Set XML encoding (ISO-8859-1 by default). # Set XML encoding (ISO-8859-1 by default).
#encoding ISO-8859-1 #encoding ISO-8859-1
# Enable or disable XML buffer.
xml_buffer 0
# Module Definition # Module Definition
# Check online documentation and module library at http://pandorafms.org # Check online documentation and module library at http://pandorafms.org
# ================= # =================

View File

@ -407,6 +407,7 @@ Pandora_Module::getXml () {
} }
text = new TiXmlText (data_clean); text = new TiXmlText (data_clean);
text->SetCDATA (true);
element->InsertEndChild (*text); element->InsertEndChild (*text);
data_element->InsertEndChild (*element); data_element->InsertEndChild (*element);
delete text; delete text;

View File

@ -697,7 +697,7 @@ Pandora_Windows_Service::checkConfig () {
int int
Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) { Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
int rc = 0; int rc = 0, xml_buffer;
TiXmlDeclaration *decl; TiXmlDeclaration *decl;
TiXmlDocument *doc; TiXmlDocument *doc;
TiXmlElement *local_xml, *agent; TiXmlElement *local_xml, *agent;
@ -712,6 +712,7 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
conf = this->getConf (); conf = this->getConf ();
min_free_bytes = 1024 * atoi (conf->getValue ("temporal_min_size").c_str ()); min_free_bytes = 1024 * atoi (conf->getValue ("temporal_min_size").c_str ());
xml_buffer = atoi (conf->getValue ("xml_buffer").c_str ());
if (mutex == 0) { if (mutex == 0) {
mutex = CreateMutex (NULL, FALSE, NULL); mutex = CreateMutex (NULL, FALSE, NULL);
@ -781,14 +782,15 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
if (getPandoraDebug () == false) { if (getPandoraDebug () == false) {
rc = this->copyDataFile (tmp_filename); rc = this->copyDataFile (tmp_filename);
/* Delete the file if successfully copied or not enough space available */ /* Delete the file if successfully copied, buffer disabled or not enough space available */
if (rc == 0 || (GetDiskFreeSpaceEx (tmp_filepath.c_str (), &free_bytes, NULL, NULL) != 0 if (rc == 0 || xml_buffer == 0 || (GetDiskFreeSpaceEx (tmp_filepath.c_str (), &free_bytes, NULL, NULL) != 0 && free_bytes.QuadPart < min_free_bytes)) {
&& free_bytes.QuadPart < min_free_bytes)) { Pandora_File::removeFile (tmp_filepath);
Pandora_File::removeFile (tmp_filepath); }
}
/* Send any buffered data files */ /* Send any buffered data files */
this->sendBufferedXml (conf->getValue ("temporal")); if (xml_buffer == 1) {
this->sendBufferedXml (conf->getValue ("temporal"));
}
} }
ReleaseMutex (mutex); ReleaseMutex (mutex);
@ -839,7 +841,9 @@ Pandora_Windows_Service::pandora_run () {
conf = this->getConf (); conf = this->getConf ();
/* Check for configuration changes */ /* Check for configuration changes */
this->checkConfig (); if (getPandoraDebug == false) {
this->checkConfig ();
}
server_addr = conf->getValue ("server_ip"); server_addr = conf->getValue ("server_ip");

View File

@ -23,7 +23,7 @@ static inline int writev(int sock, struct iovec *iov, int nvecs)
} }
/* not really usleep, but safe for the way we use it in this lib */ /* not really usleep, but safe for the way we use it in this lib */
static inline int usleep(int udelay) static inline int u_sleep(int udelay)
{ {
Sleep(udelay / 1000); Sleep(udelay / 1000);
return 0; return 0;

View File

@ -673,7 +673,7 @@ static int libssh2_blocking_read(LIBSSH2_SESSION *session, unsigned char *buf, s
if (polls++ > LIBSSH2_SOCKET_POLL_MAXLOOPS) { if (polls++ > LIBSSH2_SOCKET_POLL_MAXLOOPS) {
return -1; return -1;
} }
usleep(LIBSSH2_SOCKET_POLL_UDELAY); u_sleep(LIBSSH2_SOCKET_POLL_UDELAY);
#endif /* POLL/SELECT/SLEEP */ #endif /* POLL/SELECT/SLEEP */
continue; continue;
} }

View File

@ -159,7 +159,7 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
L".FreeSpace"); L".FreeSpace");
// 1048576 = 1024 * 1024 // 1048576 = 1024 * 1024
return (unsigned long) free_space / 1048576; return (unsigned long) (free_space / 1048576);
} NEXT_THROW (quickfix); } NEXT_THROW (quickfix);
} catch (string errstr) { } catch (string errstr) {
pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ()); pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ());