mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Separate getAgentNameCmdExec from getCoordinatesFromCmdExec
This commit is contained in:
parent
9ff9a41494
commit
ce6d76eabc
@ -385,7 +385,7 @@ Pandora_Windows_Service::getXmlHeader () {
|
|||||||
agent_name_cmd = conf->getValue ("agent_name_cmd");
|
agent_name_cmd = conf->getValue ("agent_name_cmd");
|
||||||
if (agent_name_cmd != "") {
|
if (agent_name_cmd != "") {
|
||||||
agent_name_cmd = "cmd.exe /c \"" + agent_name_cmd + "\"";
|
agent_name_cmd = "cmd.exe /c \"" + agent_name_cmd + "\"";
|
||||||
static string temp_agent_name = getCoordinatesFromCmdExec(agent_name_cmd);
|
static string temp_agent_name = getAgentNameFromCmdExec(agent_name_cmd);
|
||||||
// Delete carriage return if is provided
|
// Delete carriage return if is provided
|
||||||
pos = temp_agent_name.find("\n");
|
pos = temp_agent_name.find("\n");
|
||||||
if(pos != string::npos) {
|
if(pos != string::npos) {
|
||||||
@ -536,7 +536,7 @@ Pandora_Windows_Service::getXmlHeader () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
Pandora_Windows_Service::getCoordinatesFromCmdExec (string cmd_exec)
|
Pandora_Windows_Service::getValueFromCmdExec (string cmd_exec, int timeout)
|
||||||
{
|
{
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
@ -546,7 +546,6 @@ Pandora_Windows_Service::getCoordinatesFromCmdExec (string cmd_exec)
|
|||||||
HANDLE out, new_stdout, out_read, job;
|
HANDLE out, new_stdout, out_read, job;
|
||||||
string working_dir;
|
string working_dir;
|
||||||
string output = "";
|
string output = "";
|
||||||
int timeout = 500;
|
|
||||||
|
|
||||||
/* Set the bInheritHandle flag so pipe handles are inherited. */
|
/* Set the bInheritHandle flag so pipe handles are inherited. */
|
||||||
attributes.nLength = sizeof (SECURITY_ATTRIBUTES);
|
attributes.nLength = sizeof (SECURITY_ATTRIBUTES);
|
||||||
@ -660,6 +659,18 @@ Pandora_Windows_Service::getCoordinatesFromCmdExec (string cmd_exec)
|
|||||||
return output;
|
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
|
int
|
||||||
Pandora_Windows_Service::copyTentacleDataFile (string host,
|
Pandora_Windows_Service::copyTentacleDataFile (string host,
|
||||||
string filename,
|
string filename,
|
||||||
|
@ -53,6 +53,8 @@ namespace Pandora {
|
|||||||
|
|
||||||
string getXmlHeader ();
|
string getXmlHeader ();
|
||||||
int copyDataFile (string filename);
|
int copyDataFile (string filename);
|
||||||
|
string getValueFromCmdExec (string cmd_exec, int timeout);
|
||||||
|
string getAgentNameFromCmdExec (string cmd_exec);
|
||||||
string getCoordinatesFromCmdExec (string cmd_exec);
|
string getCoordinatesFromCmdExec (string cmd_exec);
|
||||||
int copyTentacleDataFile (string host,
|
int copyTentacleDataFile (string host,
|
||||||
string filename,
|
string filename,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user