ScSSHShell in a C++ Builder console app

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
benkedon
Posts: 28
Joined: Tue 15 May 2007 12:27

ScSSHShell in a C++ Builder console app

Post by benkedon » Wed 27 Aug 2008 20:55

I know I'm doing something wrong. I just need a small console app that logs in to a Linux/Unix box, via SSH, and sends a command, etc., based on the command-line arguments.

I'm sure the initialization is wrong somehow (all the code I have so far is at the end of this):

TScRegStorage* ScRegStorage1 = new TScRegStorage(NULL);
TScSSHClient* ScSSHClient1 = new TScSSHClient(NULL);
TScSSHShell *ScSSHShell1 = new TScSSHShell(NULL);

This is how I'd initialize it in a VCL Form app :

ScSSHClient1->KeyStorage = ScRegStorage1;
ScSSHClient1->HostName = "mtolx195.dc.mars";
ScSSHClient1->User = "oracle";
ScSSHClient1->Password = "dudley";

ScSSHShell1->Client = ScSSHClient1;
ScSSHShell1->Connected = true;

How do I accomplish the same thing in a console app ?

Thanks, for any help !

-----------------------------------------------------------------------------------
#include
#include
#pragma hdrstop
#include "ScBridge.hpp"
#include "ScSSHChannel.hpp"
#include "ScSSHClient.hpp"

//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{
AnsiString command_str,
server_receipt_str,
param_str_i;
int param_cnt, i;
TReplaceFlags rf;

TScRegStorage* ScRegStorage1 = new TScRegStorage(NULL);
TScSSHClient* ScSSHClient1 = new TScSSHClient(NULL);
TScSSHShell *ScSSHShell1 = new TScSSHShell(NULL);

//ScRegStorage1 = new TScRegStorage;
//new(TScRegStorage *);
//New(ScSSHClient1);
//New(ScSSHShell1);
ScSSHClient1->KeyStorage = ScRegStorage1;
ScSSHClient1->HostName = "mtolx195.dc.mars";
ScSSHClient1->User = "oracle";
ScSSHClient1->Password = "dudley";

ScSSHShell1->Client = ScSSHClient1;
ScSSHShell1->Connected = true;

rf = rf ExecuteCommand(command_str);
fputs(command_str.c_str(), stdout);

ScSSHShell1->Connected = false;
ScSSHClient1->Connected = false;

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 28 Aug 2008 10:18

Please give a more detailed description of the problem that arises in you application.

Post Reply