EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Override FTP server responses

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#31553
Posted: 12/01/2014 15:03:53
by Richard Hefner (Standard support level)
Joined: 12/01/2014
Posts: 4

I have just purchased a license of SecureBlackBox to as a managed code FTP server component to replace the DART FTP Server for ActiveX. I can understand how the basic FTP server functionality works from the VB.NET example, however I cannot figure out how to perform a few basic tasks we were performing with Dart. The documentation for the FTP server component speaks only very minimally about basic FTP functionality (we are not even interested in the encryption portion). Here are the basic actions we need to perform:

1) When the client requests a directory change:
a) reply with an error response, reject the request
b) reply with a positive response, override the requested directory (some of the devices will try to set a particular directory - which may not exist or they may not have access to, but we want to cause them to work in a different directory without sending an error response, which would halt the device)

2) When the client requests to retrieve a file:
a) reply with an error response, reject the request
b) reply with a positive response, override the requested file with an alternate file which will often be in another directory (we need to do some processing on the file based on device settings, and sometimes we need to append prefixes or suffixes to the automatically requested filename - which could involve us writing code to search subdirectories or alternate directories)

3) When the client requests to save a file:
a) reply with an error response, reject the request
b) reply with a positive response, override the destination filename before files are transferred (the devices are not to be permitted to save files in the reference directory, however returned files are to be captured to an alternate directory the device is not aware of)


My attempts to use the ElSimpleFTPSServer_OnBeforeSendReply event or the ElSimpleFTPSServer_OnCommandReceived even to alter or ignore the reply alternately left either the server or the client in a waiting state. With the previous library we were using we were able to handle an event before any response was made that passed by reference as parameters all information pertaining to the request and all information pertaining to the response. We could alter the request (change directory, change filename, etc - before FTP server library began work) or alter the response (send a negative acknowledgement, discard the request entirely and send a manually created response). Any information for how to similarly manipulate these requests / responses using your FTP server module before they are handled would be much appreciated. Thanks.
#31556
Posted: 12/02/2014 01:34:53
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Quote
1) When the client requests a directory change:
a) reply with an error response, reject the request

You can use TElSimpleFTPSServerSessionThread.OnCommandReceived event.

Quote
b) reply with a positive response, override the destination filename before

The task is complex. You can change response code inside TElSimpleFTPSServer.OnBeforeSendReply event. Filesystem related job is done inside so called file system adapter. If you want to control access to the files you should better write your own adapter and then assign an instance to TElSimpleFTPSServer.FileSystemAdapter property.

Quote
2) When the client requests to retrieve a file:
3) When the client requests to save a file:

Above description applies to these questions as well.

Also I recommend you to look at low level TElFTPSServer that will allow to control everything that simple class doesn't allow to do.
#31562
Posted: 12/02/2014 10:41:31
by Richard Hefner (Standard support level)
Joined: 12/01/2014
Posts: 4

I experimented quite extensively with the TElSimpleFTPSServerSessionThread.OnCommandReceived event, however setting Ignore to TRUE would cause the FTP server to ignore the request without sending the negative response - effectively hanging the client until timeout. When Ignore is set to true, the TElSimpleFTPSServer.OnBeforeSendReply event is not executed at all, preventing my ability to change the response.

When I do not ignore the command using the OnCommandReceived event, I can manipulate the response and send back a result code 550 to satisfy the client, however it appears that the FTP server at this point is still hung up on the RETR command, as the .OnTransferProgress event continues to fire continuously.

I will investigate the other class you mentioned, however I do not see any examples for its use.

All help appreciated. Thanks.
#31563
Posted: 12/03/2014 01:05:27
by Vsevolod Ievgiienko (EldoS Corp.)

Well check the problems you've described above.

Quote
I will investigate the other class you mentioned, however I do not see any examples for its use.

You can use TElSimpleFTPSServer source code as a sample of TElFTPSServer usage.
#31662
Posted: 12/16/2014 13:06:26
by Richard Hefner (Standard support level)
Joined: 12/01/2014
Posts: 4

I have not been successful using the TElFTPSServer library. As you mentioned, it has many more capabilities than the simple server library. I think it would be helpful if there were documentation for the methods of this class and an example project.
#31663
Posted: 12/16/2014 13:58:21
by Eugene Mayevski (EldoS Corp.)

Documentation unfortunately lags behind but we aim to have 100% coverage, so that no class and no public global function comes undocumented. There's a great example project available for you - the source code of TElSimpleFTPSServer class.


Sincerely yours
Eugene Mayevski
#31898
Posted: 01/13/2015 11:42:32
by Richard Hefner (Standard support level)
Joined: 12/01/2014
Posts: 4

Where can I find this source code? Is it included with the package? I have searched the install directory and all subfolders and cannot find any of the module source code. Thanks.
#31899
Posted: 01/13/2015 12:08:50
by Eugene Mayevski (EldoS Corp.)

The source code is available as a separate download from My Control Center (https://www.eldos.com/cc/) .


Sincerely yours
Eugene Mayevski
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 820 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!