No source for TScSFTError

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
ndi.infotip
Posts: 9
Joined: Mon 12 May 2014 14:05

No source for TScSFTError

Post by ndi.infotip » Thu 11 Sep 2014 11:55

I build a SFTP-Server with SecureBridge professinal edition.
In TScSFTPServer is the Event OnOpenDirectory.
This call
procedure TSSHServerFrame.ScSFTPServer1OpenDirectory(Sender: TObject;
SFTPSessionInfo: TScSFTPSessionInfo; const Path: string; var Data: TObject;
var Error: TScSFTPError);

In all the Demo-Software i can not find a pas-File with the Definition of TScSFTError);

The class TScSFTPFileInfo is also not defined.

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

Re: No source for TScSFTError

Post by Dimon » Thu 11 Sep 2014 14:16

The TScSFTPError type and the TScSFTPFileInfo class are declared in the ScSFTPUtils.pas unit.

Code: Select all

  TScSFTPError = record
    ErrorCode: TScSFTPErrorCode;
    ErrorMessage: string;
  end;

ndi.infotip
Posts: 9
Joined: Mon 12 May 2014 14:05

Re: No source for TScSFTError

Post by ndi.infotip » Thu 11 Sep 2014 17:46

On the Download it was no file ScSFTPUtils.pas
Only ScSFTPUtils.dcu and ScSFTPUtils.obj
The Compiler Delphi XE 6 doesn't know erOK.

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

Re: No source for TScSFTError

Post by Dimon » Fri 12 Sep 2014 10:26

The erOK constant is declared in the ScSFTPConsts unit.

ndi.infotip
Posts: 9
Joined: Mon 12 May 2014 14:05

Re: No source for TScSFTError

Post by ndi.infotip » Thu 18 Sep 2014 10:43

I found the file with the variable-values.

But where is a description of your SFTP-Server-Implementation?
I need a Log-File for all SFTP-Action.

When i use the OnMakeDirectory-Action, then i get always error.
When i set ErrCode=erOk, then the new Directory not exists. Ftp-Client said okay.
What is wrong?

procedure TSSHServerFrame.ScSFTPServer1MakeDirectory(Sender: TObject;
SFTPSessionInfo: TScSFTPSessionInfo; const Path: string;
var Error: TScSFTPError);
begin
inherited;
//Error.ErrorCode=erOk;
WriteLog('MkDir '+Path,SFTPSessionInfo.Client);
end;

ndi.infotip
Posts: 9
Joined: Mon 12 May 2014 14:05

Re: No source for TScSFTError

Post by ndi.infotip » Tue 23 Sep 2014 13:08

I need a Logfile in SFTP-Server.
If i use the onMakeDirectory-Event, then the component don't create the directory.

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

Re: No source for TScSFTError

Post by ViktorV » Fri 26 Sep 2014 12:23

When using the OnMakeDirectory event handler of TScSFTPServer, you should implement the functionality for creating directories by yourslef.
For this, you can call the DefaultMakeDirectory method of the TScSFTPServer component, that creates a directory.

To log directory creation, you can use the following code:

Code: Select all

procedure TSSHServerFrame.ScSFTPServer1MakeDirectory(Sender: TObject;
  SFTPSessionInfo: TScSFTPSessionInfo; const Path: string;
  var Error: TScSFTPError);
begin
  TScSFTPServer(Sender).DefaultMakeDirectory(SFTPSessionInfo, Path, Error);
  if Error.ErrorCode = erOK then
    WriteLog(Path, SFTPSessionInfo.Client)
  else
    WriteLog(Error.ErrorMessage, SFTPSessionInfo.Client)
end;
Add the ScSFTPUtils, ScSFTPConsts modules to the uses section to use this code.

ndi.infotip
Posts: 9
Joined: Mon 12 May 2014 14:05

Re: No source for TScSFTError

Post by ndi.infotip » Fri 10 Oct 2014 09:16

It works very well.
Thanks.

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

Re: No source for TScSFTError

Post by ViktorV » Fri 10 Oct 2014 10:04

Feel free to contact us if you have any further questions.

Post Reply