2006-06-20 19:05:19 +02:00
|
|
|
/* Pandora agents service for Win32.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Artica ST.
|
|
|
|
Written by Esteban Sanchez.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation,
|
|
|
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pandora_windows_service.h"
|
|
|
|
#include "pandora.h"
|
2006-07-04 16:07:08 +02:00
|
|
|
#include "pandora_strutils.h"
|
2006-06-20 19:05:19 +02:00
|
|
|
#include "windows_service.h"
|
|
|
|
#include "modules/pandora_module_factory.h"
|
2006-07-04 16:07:08 +02:00
|
|
|
#include "ssh/pandora_ssh_client.h"
|
|
|
|
#include "misc/pandora_file.h"
|
|
|
|
#include "windows/pandora_windows_info.h"
|
2006-06-20 19:05:19 +02:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <ctime>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Pandora;
|
|
|
|
using namespace Pandora_Modules;
|
2006-07-04 16:07:08 +02:00
|
|
|
using namespace Pandora_Strutils;
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-07-05 16:02:05 +02:00
|
|
|
string enabled_values[] = {"enabled", "1", "on", "yes", "si", "sí", "ok", ""};
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Creates a new Pandora_Windows_Service.
|
|
|
|
*
|
|
|
|
* @param svc_name Internal service name
|
|
|
|
* @param svc_display_name Service name that will appear in the
|
|
|
|
* Windows service administration tool.
|
|
|
|
* @param svc_description Long description of the service.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
Pandora_Windows_Service::Pandora_Windows_Service (const char * svc_name,
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
const char * svc_display_name,
|
|
|
|
const char * svc_description)
|
2006-07-04 16:07:08 +02:00
|
|
|
: Windows_Service (svc_name, svc_display_name, svc_description) {
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
this->setInitFunction ((void (Windows_Service::*) ())
|
|
|
|
&Pandora_Windows_Service::pandora_init);
|
|
|
|
this->setRunFunction ((void (Windows_Service::*) ())
|
|
|
|
&Pandora_Windows_Service::pandora_run);
|
2006-06-20 19:05:19 +02:00
|
|
|
execution_number = 0;
|
|
|
|
this->modules = NULL;
|
|
|
|
this->conf = NULL;
|
|
|
|
}
|
|
|
|
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
/**
|
|
|
|
* Destroys a Pandora_Windows_Service object.
|
|
|
|
*/
|
2006-06-20 19:05:19 +02:00
|
|
|
Pandora_Windows_Service::~Pandora_Windows_Service () {
|
|
|
|
if (this->conf != NULL) {
|
|
|
|
delete this->conf;
|
|
|
|
}
|
2006-07-05 16:02:05 +02:00
|
|
|
|
2006-06-20 19:05:19 +02:00
|
|
|
if (this->modules != NULL) {
|
|
|
|
delete this->modules;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-05 16:02:05 +02:00
|
|
|
bool
|
|
|
|
is_enabled (string value) {
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if (value == "") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (enabled_values[i] != "") {
|
|
|
|
if (enabled_values[i] == value) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-06-20 19:05:19 +02:00
|
|
|
void
|
|
|
|
Pandora_Windows_Service::pandora_init () {
|
2006-07-05 10:46:51 +02:00
|
|
|
int interval_ms = 60000;
|
2006-07-05 16:02:05 +02:00
|
|
|
string conf_file, interval, debug;
|
2006-06-20 19:05:19 +02:00
|
|
|
|
|
|
|
setPandoraDebug (true);
|
|
|
|
|
|
|
|
conf_file = Pandora::getPandoraInstallDir ();
|
|
|
|
conf_file += "pandora_agent.conf";
|
2006-08-15 Esteban Sanchez <estebans@artica.es>
* autogen.sh, configure.in, Makefile.am, Doxyfile.in: Added to
repository. They are used to generate documentation, not to compile.
* main.cc: Added some comments. Style correction.
* pandora.[cc,h]: Added documentation comments. Changed visibility of
some attributes.
* pandora_agent_conf.[cc,h]: Added to Pandora namespace. Added
documentation comments.
* pandora_windows_service.[cc,h], pandora_strutils.[cc,h],
windows/pandora_windows_infp.[cc,h], ssh/pandora_ssh_test.[cc,h]:
Added documentation comments.
* ssh/pandora_ssh_client.[cc,h]:Added documentation comments. Removed
old method to connect with user and password. Style correction.
* misc/pandora_file.[cc,h]: Added documentation comments. Renamed some
parameters.
* modules/pandora_module.[cc,h]: Added documentation comments. Put a
name to the enumerators. Added a new class to agroupate all exceptions
produced by Pandora_Module child class objects. Changed visibility of
some attributes. Added some new methods and renamed others.
* modules/pandora_module_cpuusage.[cc,h],
modules/pandora_module_exec.[cc,h],
modules/pandora_module_freememory.[cc,h],
modules/pandora_module_freedisk.[cc,h], modules/pandora_module_proc.[cc,h],
modules/pandora_module_service.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes.
* modules/pandora_module_list.[cc,h]: Added documentation comments.
Some changes to adapt the objects to the Pandora_Module changes. Added
to Pandora_Modules namespace.
* windows/pandora_windows_wmi.[cc,h]: Added documentation comments.
Renamed Pandora_Wmi_Error to Pandora_Wmi_Exception.
* windows_service.[cc,h]: Added documentation comments. Changed
visibility of some attributes. Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@150 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-08-25 15:02:03 +02:00
|
|
|
this->conf = new Pandora::Pandora_Agent_Conf (conf_file);
|
2006-06-20 19:05:19 +02:00
|
|
|
this->modules = new Pandora_Module_List (conf_file);
|
2006-07-05 10:46:51 +02:00
|
|
|
|
|
|
|
/* Get the interval value (in minutes) and set it to the service */
|
|
|
|
interval = conf->getValue ("interval");
|
2006-07-05 16:02:05 +02:00
|
|
|
|
2006-11-21 12:32:03 +01:00
|
|
|
debug = conf->getValue ("debug");
|
2006-07-05 16:02:05 +02:00
|
|
|
setPandoraDebug (is_enabled (debug));
|
|
|
|
|
2006-07-05 10:46:51 +02:00
|
|
|
if (interval != "") {
|
|
|
|
try {
|
|
|
|
interval_ms = strtoint (interval)
|
|
|
|
* 1000 /* miliseconds */;
|
|
|
|
} catch (Invalid_Conversion e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-20 19:05:19 +02:00
|
|
|
srand ((unsigned) time (0));
|
|
|
|
this->setSleepTime (interval_ms);
|
|
|
|
|
|
|
|
pandoraDebug ("Init end");
|
|
|
|
}
|
|
|
|
|
2006-07-04 16:07:08 +02:00
|
|
|
TiXmlElement *
|
|
|
|
Pandora_Windows_Service::getXmlHeader () {
|
2006-06-20 19:05:19 +02:00
|
|
|
TiXmlElement *agent;
|
|
|
|
SYSTEMTIME st;
|
|
|
|
char timestamp[20];
|
2006-07-04 16:07:08 +02:00
|
|
|
string value;
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-07-04 16:07:08 +02:00
|
|
|
agent = new TiXmlElement ("agent_data");
|
|
|
|
|
|
|
|
value = conf->getValue ("agent_name");
|
|
|
|
agent->SetAttribute ("agent_name", value);
|
2006-07-05 16:02:05 +02:00
|
|
|
if (value == "") {
|
|
|
|
value = Pandora_Windows_Info::getSystemName ();
|
|
|
|
}
|
|
|
|
|
|
|
|
agent->SetAttribute ("version", getPandoraAgentVersion ());
|
2006-07-04 16:07:08 +02:00
|
|
|
|
2006-06-20 19:05:19 +02:00
|
|
|
GetSystemTime(&st);
|
2006-07-05 16:02:05 +02:00
|
|
|
sprintf (timestamp, "%d-%d-%d %d:%d:%d", st.wYear, st.wMonth, st.wDay,
|
|
|
|
st.wHour, st.wMinute, st.wSecond);
|
2006-07-04 16:07:08 +02:00
|
|
|
agent->SetAttribute ("timestamp", timestamp);
|
|
|
|
|
|
|
|
value = conf->getValue ("interval");
|
|
|
|
agent->SetAttribute ("interval", value);
|
|
|
|
|
|
|
|
value = Pandora_Windows_Info::getOSName ();
|
|
|
|
agent->SetAttribute ("os", value);
|
|
|
|
|
|
|
|
value = Pandora_Windows_Info::getOSVersion ();
|
|
|
|
agent->SetAttribute ("os_version", value);
|
|
|
|
|
|
|
|
return agent;
|
2006-06-20 19:05:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Pandora_Windows_Service::pandora_run () {
|
2006-07-04 16:07:08 +02:00
|
|
|
TiXmlDocument *doc;
|
|
|
|
TiXmlElement *local_xml, *agent;
|
|
|
|
string xml_filename, remote_host;
|
|
|
|
string remote_filepath, random_integer;
|
|
|
|
string tmp_filename, tmp_filepath, interval;
|
|
|
|
string pubkey_file, privkey_file;
|
|
|
|
bool saved;
|
|
|
|
|
2006-06-20 19:05:19 +02:00
|
|
|
pandoraDebug ("Run begin");
|
|
|
|
|
2006-07-04 16:07:08 +02:00
|
|
|
agent = getXmlHeader ();
|
|
|
|
|
2006-06-20 19:05:19 +02:00
|
|
|
execution_number++;
|
|
|
|
|
|
|
|
if (this->modules != NULL) {
|
|
|
|
this->modules->goFirst ();
|
|
|
|
|
|
|
|
while (! this->modules->isLast ()) {
|
|
|
|
Pandora_Module *module;
|
|
|
|
string result;
|
|
|
|
|
|
|
|
module = this->modules->getCurrentValue ();
|
|
|
|
|
|
|
|
pandoraDebug ("Run %s", module->getName ().c_str ());
|
|
|
|
module->run ();
|
|
|
|
|
2006-07-04 16:07:08 +02:00
|
|
|
local_xml = module->getXml ();
|
2006-07-05 10:46:51 +02:00
|
|
|
if (local_xml != NULL) {
|
|
|
|
agent->InsertEndChild (*local_xml);
|
|
|
|
|
|
|
|
delete local_xml;
|
|
|
|
}
|
2006-06-20 19:05:19 +02:00
|
|
|
this->modules->goNext ();
|
|
|
|
}
|
|
|
|
}
|
2006-07-04 16:07:08 +02:00
|
|
|
|
|
|
|
random_integer = inttostr (rand());
|
|
|
|
tmp_filename = conf->getValue ("agent_name");
|
|
|
|
tmp_filename += "." + random_integer + ".data";
|
|
|
|
|
|
|
|
xml_filename = conf->getValue ("temporal");
|
|
|
|
if (xml_filename[xml_filename.length () - 1] != '\\') {
|
|
|
|
xml_filename += "\\";
|
|
|
|
}
|
|
|
|
tmp_filepath = xml_filename + tmp_filename;
|
|
|
|
|
|
|
|
/* Copy the XML to a temporal file */
|
|
|
|
pandoraDebug ("Copying XML on %s", tmp_filepath.c_str ());
|
|
|
|
doc = new TiXmlDocument (tmp_filepath);
|
|
|
|
doc->InsertEndChild (*agent);
|
|
|
|
saved = doc->SaveFile();
|
|
|
|
delete doc;
|
|
|
|
delete agent;
|
|
|
|
|
|
|
|
if (!saved) {
|
|
|
|
pandoraLog ("Error when saving the XML in %s",
|
|
|
|
tmp_filepath.c_str ());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
remote_host = conf->getValue ("server_ip");
|
|
|
|
ssh_client = new SSH::Pandora_Ssh_Client ();
|
|
|
|
pandoraDebug ("Connecting with %s", remote_host.c_str ());
|
|
|
|
|
|
|
|
try {
|
|
|
|
pubkey_file = Pandora::getPandoraInstallDir ();
|
|
|
|
pubkey_file += "key\\id_dsa.pub";
|
|
|
|
privkey_file = Pandora::getPandoraInstallDir ();
|
|
|
|
privkey_file += "key\\id_dsa";
|
2006-07-05 10:46:51 +02:00
|
|
|
|
2006-07-05 17:02:28 +02:00
|
|
|
ssh_client->connectWithPublicKey (remote_host.c_str (), 22, "pandora",
|
2006-07-04 16:07:08 +02:00
|
|
|
pubkey_file, privkey_file, "");
|
|
|
|
} catch (SSH::Authentication_Failed e) {
|
|
|
|
delete ssh_client;
|
|
|
|
pandoraLog ("Pandora Agent: Authentication Failed when connecting to %s",
|
|
|
|
remote_host.c_str ());
|
2006-10-06 13:25:36 +02:00
|
|
|
if (getPandoraDebug () == false) {
|
|
|
|
try {
|
|
|
|
Pandora_File::removeFile (tmp_filepath);
|
|
|
|
} catch (Pandora_File::Delete_Error e) {
|
|
|
|
}
|
|
|
|
}
|
2006-07-04 16:07:08 +02:00
|
|
|
return;
|
|
|
|
} catch (Pandora_Exception e) {
|
|
|
|
delete ssh_client;
|
2006-07-05 16:02:05 +02:00
|
|
|
pandoraLog ("Pandora Agent: Failed when copying to %s",
|
|
|
|
remote_host.c_str ());
|
2006-10-06 13:25:36 +02:00
|
|
|
if (getPandoraDebug () == false) {
|
|
|
|
try {
|
|
|
|
Pandora_File::removeFile (tmp_filepath);
|
|
|
|
} catch (Pandora_File::Delete_Error e) {
|
|
|
|
}
|
|
|
|
}
|
2006-07-04 16:07:08 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
remote_filepath = conf->getValue ("server_path");
|
|
|
|
if (remote_filepath[remote_filepath.length () - 1] != '/') {
|
|
|
|
remote_filepath += "/";
|
|
|
|
}
|
|
|
|
|
|
|
|
pandoraDebug ("Remote copying XML %s on server %s at %s%s",
|
2006-07-05 16:02:05 +02:00
|
|
|
tmp_filepath.c_str (), remote_host.c_str (),
|
|
|
|
remote_filepath.c_str (), tmp_filename.c_str ());
|
2006-07-04 16:07:08 +02:00
|
|
|
try {
|
|
|
|
ssh_client->scpFileFilename (remote_filepath + tmp_filename,
|
|
|
|
tmp_filepath);
|
|
|
|
} catch (Pandora_Exception e) {
|
2006-07-05 10:46:51 +02:00
|
|
|
pandoraLog ("Unable to copy at %s%s", remote_filepath.c_str (),
|
|
|
|
tmp_filename.c_str ());
|
2006-07-04 16:07:08 +02:00
|
|
|
ssh_client->disconnect();
|
|
|
|
delete ssh_client;
|
2006-10-06 13:25:36 +02:00
|
|
|
if (getPandoraDebug () == false) {
|
|
|
|
try {
|
|
|
|
Pandora_File::removeFile (tmp_filepath);
|
|
|
|
} catch (Pandora_File::Delete_Error e) {
|
|
|
|
}
|
|
|
|
}
|
2006-07-04 16:07:08 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ssh_client->disconnect();
|
2006-07-05 10:46:51 +02:00
|
|
|
delete ssh_client;
|
2006-06-20 19:05:19 +02:00
|
|
|
|
2006-10-06 13:25:36 +02:00
|
|
|
if (getPandoraDebug () == false) {
|
|
|
|
try {
|
|
|
|
Pandora_File::removeFile (tmp_filepath);
|
|
|
|
} catch (Pandora_File::Delete_Error e) {
|
|
|
|
}
|
|
|
|
}
|
2006-07-05 10:46:51 +02:00
|
|
|
|
2006-06-20 19:05:19 +02:00
|
|
|
pandoraDebug ("Execution number %d", execution_number);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|