Page 1 of 1

No source for TScSFTError

Posted: Thu 11 Sep 2014 11:55
by ndi.infotip
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.

Re: No source for TScSFTError

Posted: Thu 11 Sep 2014 14:16
by Dimon
The TScSFTPError type and the TScSFTPFileInfo class are declared in the ScSFTPUtils.pas unit.

Code: Select all

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

Re: No source for TScSFTError

Posted: Thu 11 Sep 2014 17:46
by ndi.infotip
On the Download it was no file ScSFTPUtils.pas
Only ScSFTPUtils.dcu and ScSFTPUtils.obj
The Compiler Delphi XE 6 doesn't know erOK.

Re: No source for TScSFTError

Posted: Fri 12 Sep 2014 10:26
by Dimon
The erOK constant is declared in the ScSFTPConsts unit.

Re: No source for TScSFTError

Posted: Thu 18 Sep 2014 10:43
by ndi.infotip
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;

Re: No source for TScSFTError

Posted: Tue 23 Sep 2014 13:08
by ndi.infotip
I need a Logfile in SFTP-Server.
If i use the onMakeDirectory-Event, then the component don't create the directory.

Re: No source for TScSFTError

Posted: Fri 26 Sep 2014 12:23
by ViktorV
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.

Re: No source for TScSFTError

Posted: Fri 10 Oct 2014 09:16
by ndi.infotip
It works very well.
Thanks.

Re: No source for TScSFTError

Posted: Fri 10 Oct 2014 10:04
by ViktorV
Feel free to contact us if you have any further questions.