mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-26 23:35:02 +02:00
2008-12-24 Ramon Novoa <rnovoa@artica.es>
* win32/pandora_windows_service.h, win32/bin/pandora_agent.conf, win32/pandora_windows_service.cc: Added local transfer mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1309 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c463b65c29
commit
c0f8c88cd4
@ -1,3 +1,9 @@
|
|||||||
|
2008-12-24 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* win32/pandora_windows_service.h,
|
||||||
|
win32/bin/pandora_agent.conf,
|
||||||
|
win32/pandora_windows_service.cc: Added local transfer mode.
|
||||||
|
|
||||||
2008-12-24 Ramon Novoa <rnovoa@artica.es>
|
2008-12-24 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* win32/pandora_windows_service.cc: Do not send XML if server address
|
* win32/pandora_windows_service.cc: Do not send XML if server address
|
||||||
|
@ -28,7 +28,7 @@ temporal "$AgentTemp$"
|
|||||||
|
|
||||||
interval 300
|
interval 300
|
||||||
|
|
||||||
# tranfer_modes: Possible values are tentacle (default), ftp and ssh.
|
# tranfer_modes: Possible values are local, tentacle (default), ftp and ssh.
|
||||||
transfer_mode tentacle
|
transfer_mode tentacle
|
||||||
server_port 41121
|
server_port 41121
|
||||||
|
|
||||||
|
@ -372,19 +372,24 @@ Pandora_Windows_Service::copyDataFile (string filename)
|
|||||||
mode = conf->getValue ("transfer_mode");
|
mode = conf->getValue ("transfer_mode");
|
||||||
host = conf->getValue ("server_ip");
|
host = conf->getValue ("server_ip");
|
||||||
remote_path = conf->getValue ("server_path");
|
remote_path = conf->getValue ("server_path");
|
||||||
if (remote_path[remote_path.length () - 1] != '/') {
|
// Fix remote path
|
||||||
|
if (mode != "local" && remote_path[remote_path.length () - 1] != '/') {
|
||||||
remote_path += "/";
|
remote_path += "/";
|
||||||
|
} else if (mode == "local" && remote_path[remote_path.length () - 1] != '\\') {
|
||||||
|
remote_path += "\\";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mode == "ftp") {
|
if (mode == "ftp") {
|
||||||
copyFtpDataFile (host, remote_path, filename, conf->getValue ("server_pwd"));
|
copyFtpDataFile (host, remote_path, filename, conf->getValue ("server_pwd"));
|
||||||
} else if (mode == "tentacle") {
|
} else if (mode == "tentacle" || mode == "") {
|
||||||
copyTentacleDataFile (host, filename, conf->getValue ("server_port"),
|
copyTentacleDataFile (host, filename, conf->getValue ("server_port"),
|
||||||
conf->getValue ("server_ssl"), conf->getValue ("server_pwd"),
|
conf->getValue ("server_ssl"), conf->getValue ("server_pwd"),
|
||||||
conf->getValue ("server_opts"));
|
conf->getValue ("server_opts"));
|
||||||
} else if (mode == "ssh" || mode == "") {
|
} else if (mode == "ssh") {
|
||||||
copyScpDataFile (host, remote_path, filename);
|
copyScpDataFile (host, remote_path, filename);
|
||||||
|
} else if (mode == "local") {
|
||||||
|
copyLocalDataFile (remote_path, filename);
|
||||||
} else {
|
} else {
|
||||||
pandoraLog ("Invalid transfer mode: %s."
|
pandoraLog ("Invalid transfer mode: %s."
|
||||||
"Please recheck transfer_mode option "
|
"Please recheck transfer_mode option "
|
||||||
@ -518,6 +523,23 @@ Pandora_Windows_Service::recvDataFile (string filename) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Pandora_Windows_Service::copyLocalDataFile (string remote_path,
|
||||||
|
string filename)
|
||||||
|
{
|
||||||
|
string local_path, local_file, remote_file;
|
||||||
|
local_path = conf->getValue ("temporal");
|
||||||
|
if (local_path[local_path.length () - 1] != '\\') {
|
||||||
|
local_path += "\\";
|
||||||
|
}
|
||||||
|
|
||||||
|
local_file = local_path + filename;
|
||||||
|
remote_file = remote_path + filename;
|
||||||
|
if (!CopyFile (local_file.c_str (), remote_file.c_str (), TRUE)) {
|
||||||
|
throw Pandora_Exception ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Pandora_Windows_Service::checkConfig () {
|
Pandora_Windows_Service::checkConfig () {
|
||||||
int i, conf_size;
|
int i, conf_size;
|
||||||
|
@ -61,6 +61,8 @@ namespace Pandora {
|
|||||||
string remote_path,
|
string remote_path,
|
||||||
string filename,
|
string filename,
|
||||||
string password);
|
string password);
|
||||||
|
void copyLocalDataFile (string remote_path,
|
||||||
|
string filename);
|
||||||
void recvDataFile (string filename);
|
void recvDataFile (string filename);
|
||||||
void recvTentacleDataFile (string host,
|
void recvTentacleDataFile (string host,
|
||||||
string filename);
|
string filename);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user