[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing an SFTP Server Using lobs she


2017-06-19 23:26 GMT+02:00 skerbsf@xxxxxxxxx <skerbsf@xxxxxxxxx>:
>
> Andreas,
> Thanks for the response!  I believe this is exactly what I am looking for.
> Still getting the feel for the API.
>
> Still not sure what to do exactly. The first message I get back is
> SSH_FXP_REALPATH.  I believe this is the initial directory that the user is
> to be placed in?  Here is what I have added (without error handling for
> better readability):
>
> while (1)
> {
>     msg = sftp_get_client_message();
>     type = sftp_client_message_get_type();
>
>     if (type == SSH_FXP_REALPATH)

It's possible to handle every incoming type of message this way, but
better in my opinion is
to use an array with 256 size of callbacks for every type. You need
256 cause the type is defined
as a single byte.
Futher you can assign valid callbacks for the known types
(SSH_FXP_INIT - SSH_FXP_UNBLOCK etc)
and a default cb for the rest, which sends a "SSH_FX_OP_UNSUPPORTED".

And SSH_FXP_REALPATH is not exactly what I expect as the first packet.
The first is FXP_INIT, and the server
replies with FXP_VERSION.

Futher I would not use a while, but an eventloop listning to any event
like the incoming message from client.
And a queue.

Stef

Follow-Ups:
Re: Writing an SFTP Server Using lobs she"skerbsf@xxxxxxxxx" <skerbsf@xxxxxxxxx>
Re: Writing an SFTP Server Using lobs sheAndreas Schneider <asn@xxxxxxxxxxxxxx>
References:
Writing an SFTP Server Using lobs she"skerbsf@xxxxxxxxx" <skerbsf@xxxxxxxxx>
Re: Writing an SFTP Server Using lobs sheAndreas Schneider <asn@xxxxxxxxxxxxxx>
Re: Writing an SFTP Server Using lobs she"skerbsf@xxxxxxxxx" <skerbsf@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org