On Tuesday, 20 June 2017 00:00:06 CEST Stef Bon wrote:
> 2017-06-19 23:26 GMT+02:00 [email protected] <[email protected]>:
> > 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".
The better way would be to reimplement the sftp-server using callbacks like
the rest of the ssh server we have. Then all you have to do is to define the
callblacks.
Andreas
--
Andreas Schneider GPG-ID: CC014E3D
www.cryptomilk.org [email protected]