mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
2006-12-04 Esteban Sanchez <estebans@artica.es>
* misc/pandora_file.[cc,h]: Added a function to check the existance of a file. * pandora_ssh_tesct.cc: Check if private and public key files exists when doing the test. * bin/PandoraAgent.exe: Updated to new commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@302 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
209c912a12
commit
cd3fdf0a80
@ -1,3 +1,13 @@
|
|||||||
|
2006-12-04 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* misc/pandora_file.[cc,h]: Added a function to check the existance of
|
||||||
|
a file.
|
||||||
|
|
||||||
|
* pandora_ssh_tesct.cc: Check if private and public key files exists
|
||||||
|
when doing the test.
|
||||||
|
|
||||||
|
* bin/PandoraAgent.exe: Updated to new commit.
|
||||||
|
|
||||||
2006-12-01 Raul Mateos <raulofpandora@gmail.com>
|
2006-12-01 Raul Mateos <raulofpandora@gmail.com>
|
||||||
|
|
||||||
* installer/Pandora_FMS_Windows_Agent-1.2-Setup.exe: Updated with last
|
* installer/Pandora_FMS_Windows_Agent-1.2-Setup.exe: Updated with last
|
||||||
|
@ -25,6 +25,26 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a file exists.
|
||||||
|
*
|
||||||
|
* @param filepath Path of the file to check.
|
||||||
|
*
|
||||||
|
* @retval True if the file exists.
|
||||||
|
**/
|
||||||
|
bool
|
||||||
|
Pandora_File::fileExists (const string filepath) {
|
||||||
|
string line, result;
|
||||||
|
ifstream myfile (filepath.c_str ());
|
||||||
|
|
||||||
|
if (! myfile.is_open ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
myfile.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a file and returns its content.
|
* Reads a file and returns its content.
|
||||||
*
|
*
|
||||||
|
@ -50,7 +50,8 @@ namespace Pandora_File {
|
|||||||
class Delete_Error : Pandora_File::File_Exception {
|
class Delete_Error : Pandora_File::File_Exception {
|
||||||
};
|
};
|
||||||
|
|
||||||
string readFile (const string filename);
|
bool fileExists (const string filename);
|
||||||
|
string readFile (const string filename);
|
||||||
void removeFile (const string filename);
|
void removeFile (const string filename);
|
||||||
void writeFile (const string filename, const string data);
|
void writeFile (const string filename, const string data);
|
||||||
}
|
}
|
||||||
|
@ -75,16 +75,26 @@ Pandora_SSH_Test::test () {
|
|||||||
TiXmlDeclaration *decl;
|
TiXmlDeclaration *decl;
|
||||||
bool saved;
|
bool saved;
|
||||||
|
|
||||||
remote_host = this->conf->getValue ("server_ip");
|
|
||||||
|
|
||||||
pubkey_file = Pandora::getPandoraInstallDir ();
|
pubkey_file = Pandora::getPandoraInstallDir ();
|
||||||
pubkey_file += "key\\id_dsa.pub";
|
pubkey_file += "key\\id_dsa.pub";
|
||||||
|
if (! Pandora_File::fileExists (pubkey_file)) {
|
||||||
|
cout << "Public key file " << pubkey_file << " not found."
|
||||||
|
<< endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cout << "Public key file " << pubkey_file << " exists." << endl;
|
||||||
|
|
||||||
privkey_file = Pandora::getPandoraInstallDir ();
|
privkey_file = Pandora::getPandoraInstallDir ();
|
||||||
privkey_file += "key\\id_dsa";
|
privkey_file += "key\\id_dsa";
|
||||||
|
if (! Pandora_File::fileExists (privkey_file)) {
|
||||||
cout << "Public key file: " << pubkey_file << endl;
|
cout << "Private key file " << privkey_file << " not found."
|
||||||
cout << "Private key file: " << privkey_file << endl;
|
<< endl;
|
||||||
cout << "Connecting with " << remote_host << "..." << endl;
|
return;
|
||||||
|
}
|
||||||
|
cout << "Private key file: " << privkey_file << " exists." << endl;
|
||||||
|
|
||||||
|
remote_host = this->conf->getValue ("server_ip");
|
||||||
|
cout << "Connecting with " << remote_host << "." << endl;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this->ssh_client->connectWithPublicKey (remote_host.c_str (), 22,
|
this->ssh_client->connectWithPublicKey (remote_host.c_str (), 22,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user