I want to create an SFTP Server that does not work the the file system, but rather accesses my API and returns content from the API as files. I have authentication working, however, I am having a hard time figuring out how to get the ShellCommand event working with ShellType.Empty. The help on this is very poor. A Google search only returns one result.
From what I can tell, if add a user like this:
FileServerUser(Username, Password, ShellType.Empty);
Then I must handle the ShellCommand event like this:
_server.ShellCommand += _server_ShellCommand;
void _server_ShellCommand(object sender, ShellCommandEventArgs e)
{
}
According to the help, I can use e.Command and e.Args to determine the command that was sent from the client. I have the ability to use the e.Write, e.WriteLine and e.ExitCode methods to send a response to the client.
What I need is a list of standard shell command responses for each of the FTP commands rather than having to figure this out from scratch.
What I would have liked:
* The ability to specify a path and ShellType.Default when creating the user and override the behavior of any command of my choosing, or alternatively, let the default shell command handler handle a command that I have not overriden.
Another problem: When I connect with FileZilla using ShellType.Empty, the first ShellCommand event that fires is a "test" command with 5 parameters. This does not appear to be a standard FTP command and I'm not sure exactly what I should return.
Complaint: The code obfuscation is not helpful. I would much rather have just perused the source code to figure out what to do, but one can only go so far with the obfuscation. Is there an option to buy with source?