mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
2013-04-11 Hirofumi Kosaka <kosaka@rworks.jp>
* win32/pandora_windows_service.cc: Fixed possible resource leaks; - putenv() could run out the environment variable area, if using both file_collection and broker_agent. - possible handle leak at launching tentacle_client. * Cleaned source code style. Merged from branch 4.x. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7962 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
976bd1b478
commit
3ba48c447d
@ -1,3 +1,13 @@
|
|||||||
|
2013-04-11 Hirofumi Kosaka <kosaka@rworks.jp>
|
||||||
|
|
||||||
|
* win32/pandora_windows_service.cc: Fixed possible resource leaks;
|
||||||
|
- putenv() could run out the environment variable area, if
|
||||||
|
using both file_collection and broker_agent.
|
||||||
|
- possible handle leak at launching tentacle_client.
|
||||||
|
* Cleaned source code style.
|
||||||
|
|
||||||
|
Merged from branch 4.x.
|
||||||
|
|
||||||
2013-04-01 Sancho Lerena <slerena@artica.es>
|
2013-04-01 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* unix/plugins/inventory: Improved software inventory in RPM format.
|
* unix/plugins/inventory: Improved software inventory in RPM format.
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2013-04-11 Hirofumi Kosaka <kosaka@rworks.jp>
|
||||||
|
|
||||||
|
* pandora_windows_service.cc: Fixed possible resource leaks;
|
||||||
|
- putenv() could run out the environment variable area, if
|
||||||
|
using both file_collection and broker_agent.
|
||||||
|
- possible handle leak at launching tentacle_client.
|
||||||
|
* Cleaned source code style.
|
||||||
|
|
||||||
|
Merged from branch 4.x.
|
||||||
|
|
||||||
2013-04-04 Koichiro KIKUCHI <koichiro@rworks.jp>
|
2013-04-04 Koichiro KIKUCHI <koichiro@rworks.jp>
|
||||||
|
|
||||||
* windows_service.cc,
|
* windows_service.cc,
|
||||||
|
@ -694,6 +694,9 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* close thread handle, because it won't be used */
|
||||||
|
CloseHandle (pi.hThread);
|
||||||
|
|
||||||
/* Timeout */
|
/* Timeout */
|
||||||
tentacle_timeout = atoi (conf->getValue ("tentacle_timeout").c_str ());
|
tentacle_timeout = atoi (conf->getValue ("tentacle_timeout").c_str ());
|
||||||
if (tentacle_timeout <= 0) {
|
if (tentacle_timeout <= 0) {
|
||||||
@ -704,7 +707,7 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForSingleObject(pi.hProcess, tentacle_timeout) == WAIT_TIMEOUT) {
|
if (WaitForSingleObject(pi.hProcess, tentacle_timeout) == WAIT_TIMEOUT) {
|
||||||
TerminateProcess(pi.hThread, STILL_ACTIVE);
|
TerminateProcess(pi.hProcess, STILL_ACTIVE);
|
||||||
CloseHandle (pi.hProcess);
|
CloseHandle (pi.hProcess);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1116,7 +1119,7 @@ Pandora_Windows_Service::checkCollections () {
|
|||||||
|
|
||||||
int flag, i;
|
int flag, i;
|
||||||
char *coll_md5 = NULL, *server_coll_md5 = NULL;
|
char *coll_md5 = NULL, *server_coll_md5 = NULL;
|
||||||
string collection_name, collections_dir, collection_md5, tmp;
|
string collection_name, collections_dir, collection_path, collection_md5, tmp;
|
||||||
string collection_zip, install_dir, temp_dir, dest_dir, path, env;
|
string collection_zip, install_dir, temp_dir, dest_dir, path, env;
|
||||||
|
|
||||||
/*Get collections directory*/
|
/*Get collections directory*/
|
||||||
@ -1137,13 +1140,31 @@ Pandora_Windows_Service::checkCollections () {
|
|||||||
collection_name = conf->getCurrentCollectionName();
|
collection_name = conf->getCurrentCollectionName();
|
||||||
|
|
||||||
if(! conf->getCurrentCollectionVerify() ) {
|
if(! conf->getCurrentCollectionVerify() ) {
|
||||||
/*Add the collection directory to the path*/
|
int found;
|
||||||
tmp = collections_dir + collection_name;
|
|
||||||
path = getenv ("PATH");
|
|
||||||
env = "PATH=" + path + ";" + tmp;
|
|
||||||
putenv (env.c_str ());
|
|
||||||
conf->setCurrentCollectionVerify();
|
|
||||||
|
|
||||||
|
/*Add the collection directory to the path (if not exists in %path%)*/
|
||||||
|
collection_path = collections_dir + collection_name;
|
||||||
|
path = getenv ("PATH");
|
||||||
|
|
||||||
|
/* check if the path is just included in the middle of %path% */
|
||||||
|
tmp = collection_path + ";"; /* Added a separator */
|
||||||
|
if(path.find(tmp) == string::npos) {
|
||||||
|
|
||||||
|
/* check if the path is the last entry of %path% */
|
||||||
|
if( ((found = path.rfind(collection_path)) != string::npos)
|
||||||
|
&& ((found + collection_path.length()) == path.length()) )
|
||||||
|
{
|
||||||
|
/* included already (at the tail of %path%) */
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* it's new ! */
|
||||||
|
env = "PATH=" + path + ";" + collection_path;
|
||||||
|
putenv (env.c_str ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
conf->setCurrentCollectionVerify();
|
||||||
}
|
}
|
||||||
|
|
||||||
collection_zip = collection_name+".zip";
|
collection_zip = collection_name+".zip";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user