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

Re: Server API: How to communicate connection failures to client


On 06.02.19 17:41, g4-lisz@xxxxxxxxxxxx wrote:
> Hi there,
>
> My server implementation accepts direct-tcpip requests.
>
> In the message CB function, after receiving a message of type
> SSH_REQUEST_CHANNEL_OPEN, subtype SSH_CHANNEL_DIRECT_TCPIP, we try to
> open a local socket. If this is successful, a new channel with
> ssh_message_channel_request_open_reply_accept(message) is attached.
>
> But if opening of the local socket fails, how should the message be
> treated? Is there a way to signalize to the client that the connection
> failed, without opening a new channel?
>
> Or do I have to accept the request and open a channel in any case? And
> then close the channel again when the local socket operation failed?
>
> Right now I'm reading the OpenSSH server code to find out. But maybe
> someone could give me the answer and tell me what libssh functions
> should be used?

No one?

Maybe my mail had too much text ;-))

Short version: When writing a server, how do should it signal to the
client when the destination for the direct-tcpip request can not be
reached (or resolved)?

- The API only let me send a channel EOF or close
- Should it accept the request at all (i.e. open a new channel) _before_
the local (server side) connection could been made?
- Does it make sense (if it opened the channel) to send something on the
channel stderr?

Thanks,
Till


Follow-Ups:
Re: Server API: How to communicate connection failures to clientAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org