EldoS | Feel safer!

Software components for data protection, secure storage and transfer


Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
Posted: 04/26/2007 22:10:48
by William Galloway (Standard support level)
Joined: 04/26/2007
Posts: 4

I see that the client code includes some mentions to the extended_reply. Now I'm still wrapping my mind around the thousands of lines of code, but does that mean that the sftpclient support the ssh_FXP_extended concept. If so then, does the sftp server code (VCL) support the use of extended commands?

My need is to implement custom commands by writting the server and client with secureblackbox. So for example I could add a command to the server called "HELLO" and when the client executes it, the server would respond to HELLO with "HI".

It seems that that's what ssh_fxp_extended would do for me.

If whoever responds to this is really kind they could even give me a starting point in the source to get me on my way. (assuming this method will work).

Posted: 04/27/2007 00:23:03
by Eugene Mayevski (Team)

What you want (custom commands) is really implemented using this code, but at the moment SFTP components don't support it completely (i.e. this code is used for several extensions, but there's no generic mechanism). We plan to add this feature to SecureBlackbox 5.2.

Sincerely yours
Eugene Mayevski
Posted: 04/27/2007 02:10:42
by Ken Ivanov (Team)

...but at the moment SFTP components don't support it completely

To be precise, the feature is *completely* supported by TElSFTPClient class and *not* supported by TElSimpleSFTPClient class at the moment. With TElSFTPClient, please consider using ExtensionCmd() methods along with OnExtendedReply event to deal with extended SFTP requests.
Posted: 04/27/2007 07:25:29
by William Galloway (Standard support level)
Joined: 04/26/2007
Posts: 4

WHen will 5.2 be relased? If not anytime soon then is there a rough idea of what the server's event would look like? This way when I change the sftpserver code at least I can still upgrade to 5.2 and not rewrite my entire application. Do you think it would be sftpserver.extensioncmd? It would just pass in the parms sent by user? And would you use a sftpserver.registercustomcmd? passing in a command name?

Even if you just have a general idea at least I can get close.

Posted: 04/27/2007 08:01:23
by Ken Ivanov (Team)

TElSFTPServer already contains OnExtendedRequest event which is fired when the corresponding extended request is received from client.
Posted: 04/30/2007 20:59:35
by William Galloway (Standard support level)
Joined: 04/26/2007
Posts: 4

I'm slowly getting there.

I got the server to check my custom command and reply to it.

But in SftpClient.OnExtendedReply is declared procedure TForm1.HandleExtendedRep(Sender: TObject; Buffer: pointer; Size: integer);

HOW Do I read the reply from the buffer???

Posted: 05/01/2007 00:49:17
by Ken Ivanov (Team)

Not sure if I understand you. What exactly problems reading the reply are you encountering?
Posted: 05/01/2007 00:56:51
by Eugene Mayevski (Team)

The reply is pointed the Buffer variable and has the size of Size. Dereferencing pointers is out of scope of support, provided by EldoS Corporation.

Sincerely yours
Eugene Mayevski
Posted: 12/14/2009 04:04:41
by alvin tan (Basic support level)
Joined: 12/14/2009
Posts: 2

I need to be able to send custom commands to an SFTP server and it looks like ExtensionCmd is what I need.

Is anyone able to provide some example code that uses the TElSimpleSFTPClient.ExtensionCmd() method.

We are currently using TElSimpleSFTPClient to upload files to the SFTP server

regards Alvin
Posted: 12/14/2009 06:46:09
by Ken Ivanov (Team)

What exactly custom command do you need to execute (is it a SFTP subsystem-related command or a remote OS command)? If the first case, please use the following code:
byte[] request = new byte[] { 1, 2, 3, 4, 5 }; // request-specific data
// creating stream for command response
MemoryStream response = new MemoryStream();
// executing custom command
Client.ExtensionCmd("my-custom-command", request, response);
// processing response
// ...

If you need to execute OS command remotely within the SFTP session, the only solution would be to use low-level SSH/SFTP components.
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.



Topic viewed 5992 times

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


Back to top

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

Got it!