mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge pull request #8 from uchida/remember-agent_name_cmd-result-in-xml-header
Remember agent_name_cmd result in xml header
This commit is contained in:
commit
7357216155
pandora_agents/win32
@ -370,7 +370,7 @@ Pandora_Windows_Service::launchTentacleProxy() {
|
||||
string
|
||||
Pandora_Windows_Service::getXmlHeader () {
|
||||
char timestamp[20];
|
||||
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd, temp_agent_name;
|
||||
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd;
|
||||
string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result;
|
||||
time_t ctime;
|
||||
struct tm *ctime_tm = NULL;
|
||||
@ -385,7 +385,7 @@ Pandora_Windows_Service::getXmlHeader () {
|
||||
agent_name_cmd = conf->getValue ("agent_name_cmd");
|
||||
if (agent_name_cmd != "") {
|
||||
agent_name_cmd = "cmd.exe /c \"" + agent_name_cmd + "\"";
|
||||
temp_agent_name = getCoordinatesFromCmdExec(agent_name_cmd);
|
||||
static string temp_agent_name = getAgentNameFromCmdExec(agent_name_cmd);
|
||||
// Delete carriage return if is provided
|
||||
pos = temp_agent_name.find("\n");
|
||||
if(pos != string::npos) {
|
||||
@ -536,7 +536,7 @@ Pandora_Windows_Service::getXmlHeader () {
|
||||
}
|
||||
|
||||
string
|
||||
Pandora_Windows_Service::getCoordinatesFromCmdExec (string cmd_exec)
|
||||
Pandora_Windows_Service::getValueFromCmdExec (string cmd_exec, int timeout)
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
@ -546,7 +546,6 @@ Pandora_Windows_Service::getCoordinatesFromCmdExec (string cmd_exec)
|
||||
HANDLE out, new_stdout, out_read, job;
|
||||
string working_dir;
|
||||
string output = "";
|
||||
int timeout = 30;
|
||||
|
||||
/* Set the bInheritHandle flag so pipe handles are inherited. */
|
||||
attributes.nLength = sizeof (SECURITY_ATTRIBUTES);
|
||||
@ -660,6 +659,18 @@ Pandora_Windows_Service::getCoordinatesFromCmdExec (string cmd_exec)
|
||||
return output;
|
||||
}
|
||||
|
||||
string
|
||||
Pandora_Windows_Service::getAgentNameFromCmdExec (string cmd_exec)
|
||||
{
|
||||
return getValueFromCmdExec(cmd_exec, 10000);
|
||||
}
|
||||
|
||||
string
|
||||
Pandora_Windows_Service::getCoordinatesFromCmdExec (string cmd_exec)
|
||||
{
|
||||
return getValueFromCmdExec(cmd_exec, 500);
|
||||
}
|
||||
|
||||
int
|
||||
Pandora_Windows_Service::copyTentacleDataFile (string host,
|
||||
string filename,
|
||||
|
@ -53,6 +53,8 @@ namespace Pandora {
|
||||
|
||||
string getXmlHeader ();
|
||||
int copyDataFile (string filename);
|
||||
string getValueFromCmdExec (string cmd_exec, int timeout);
|
||||
string getAgentNameFromCmdExec (string cmd_exec);
|
||||
string getCoordinatesFromCmdExec (string cmd_exec);
|
||||
int copyTentacleDataFile (string host,
|
||||
string filename,
|
||||
|
Loading…
x
Reference in New Issue
Block a user