IETF-SSH archive

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

Re: Channel close logic, needs clarification?



On Sun, Mar 11, 2001 at 11:02:12PM +0100, Niels Möller wrote:
> > I'm not sure that you can rely on getting an EOF message.
> 
> I'm not sure what you're saying here. I'm saying that the "normal"
> reason the channel close process is initiated is that CHANNEL_EOF is
> both sent and received. There are other, less "normal", reasons. For
> instance, if lsh or lshd receives a CHANNEL_CLOSE, that is not
> preceded by a CHANNEL_EOF, it displays a warning message "unexpected
> channel close",

I don't think this is correct. A CLOSE without an EOF is completely
legal in the SSH 2 protocol.

> and then it replies with CHANNEL_CLOSE so that the
> channel goes away.
> 
> > > What happens at the client? When the lsh client receives
> > > an SSH_MSG_CHANNEL_REQUEST "exit-status" message, it decides that it's
> > > time to stop talking, and it sends an SSH_MSG_CHANNEL_EOF. Now rule 2
> > > applies, and the channel gets closed properly.
> > 
> > The OpenSSH client considers the "exit-status" message just informational
> > and does _not_ send an EOF message back.
> 
> That seems reasonable (as the client can't really know if the server
> implements exit-status), but on the other hand that message is the
> only reliable hint the client gets that it will not be able to send
> any more data.
> 
> The alternative is for the server to send CHANNEL_CLOSE after the
> exit-status message. If I understand you and Sami correctly, that is
> what both the ssh2 and openssh servers do.

When the login shell dies, the OpenSSH server sends
the CLOSE message after:
        1) all data is read from the pipe/socket (that connects the
           server to the login-shell) and
	2) this data is sent to the client.

-m



Home | Main Index | Thread Index | Old Index