oSSHClient.Disconnect bug

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
multimesut
Posts: 18
Joined: Mon 28 Nov 2011 18:04
Location: Türkiye

oSSHClient.Disconnect bug

Post by multimesut » Mon 01 Jun 2020 08:29

Details:

Hello, I just upgraded to pro version to develop linux applications. There is a problem with oSSHClient. The application freezes when disconnect or free. I added the sample project.

I'm waiting for your help. thanks.

Info;
Product Version: 9.2.4
OS Version: Linux
Platform: x64
Delphi: 10.3.3
Is registered user: True

Code;

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  ScSSHClient, ScBridge, ScSSHChannel,
  System.SysUtils;

type
TSSH = class
private
  oSSHClient: TScSSHClient;
  oMemoryStorage: TScFileStorage;
  oSSHShell : TScSshShell;
  procedure ScSSHClientServerKeyValidate(Sender: TObject; NewServerKey: TScKey; var Accept: Boolean);
  procedure Test;
end;

var
SSH: TSSH;


procedure TSSH.ScSSHClientServerKeyValidate(Sender: TObject; NewServerKey: TScKey; var Accept: Boolean);
begin
  Accept := True;
end;

procedure TSSH.Test;
var
  I: Integer;
  x: String;
begin
  for I := 0 to 100 do
    begin
    WriteLN('Create Start - '+IntToStr(i));
    oSSHClient    := TScSSHClient.Create(nil);
    oMemoryStorage  := nil;
    oMemoryStorage := TScFileStorage.Create(nil);
    oSSHClient.KeyStorage := oMemoryStorage;
    oSSHClient.HostName := '127.0.0.1';
    oSSHClient.Port := 22;
    oSSHClient.User := 'root';
    oSSHClient.Password := '123456';
    oSSHClient.HostKeyAlgorithms.AsString:='ssh-rsa,ssh-dss';
    oSSHClient.OnServerKeyValidate := ScSSHClientServerKeyValidate;
    oSSHClient.Connect;
    oSSHShell := TScSshShell.Create(nil);
    oSSHShell.Client:=oSSHClient;
    x:=oSSHShell.ExecuteCommand('date');
    WriteLN('Create Finish - '+IntToStr(i)+' - '+x);
    //
    WriteLN('FreeAndNil Start - '+IntToStr(i));
    oSSHClient.Disconnect;
    FreeAndNil(oSSHClient);
    FreeAndNil(oMemoryStorage);
    FreeAndNil(oSSHShell);
    WriteLN('FreeAndNil Finish - '+IntToStr(i));
    end;
end;

begin
  try
  SSH:=TSSH.Create;
  SSH.Test;
    { TODO -oUser -cConsole Main : Insert code here }
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: oSSHClient.Disconnect bug

Post by ViktorV » Thu 04 Jun 2020 05:16

Thank you for the information. We have reproduced the issue and investigation is in progress. We will inform you when we have any results.

multimesut
Posts: 18
Joined: Mon 28 Nov 2011 18:04
Location: Türkiye

Re: oSSHClient.Disconnect bug

Post by multimesut » Thu 04 Jun 2020 08:14

Thanks for your answer, @ViktorV. I am waiting for news from you.

Post Reply