Tweak to SSH coroutine code: put line number in the coroutine state
structure, which is consistent with Simon's canonical version of the
macros.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9607 cda61777-01e9-0310-a592-d414129be87e
Fix an erroneous "case" fallthrough in ssh1_msg_channel_close, which was 
causing assertion failures when closing X11 channels in SSH-1.  Also fix 
another pasto.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9608 cda61777-01e9-0310-a592-d414129be87e
Reworking of packet delivery to coroutines in SSH-2.

Before, NULL in the dispatch table meant "send to the appropriate one of 
do_ssh2_transport() and do_ssh2_authconn()".  Now those (via small 
shims) are specified directly in the dispatch table, so ssh2_protocol() 
is much simpler.

In the process, this has somewhat centralised the handling of gross 
server protocol violations.  PuTTY will now disconnect with a rude 
message when (e.g.) OpenSSH sends us an SSH_MSG_UNIMPLEMENTED when we 
try to KEXINIT during authentication.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9609 cda61777-01e9-0310-a592-d414129be87e
De-duplicate code in KEXINIT generation.

There's no need to have identical code generating server-to-client and
client-to-server versions of the cipher and MAC lists; a couple of
twice-around loops will do fine.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9610 cda61777-01e9-0310-a592-d414129be87e
Fix recently-introduced memory leak in ssh2_msg_unexpected().


git-svn-id: svn://svn.tartarus.org/sgt/putty@9611 cda61777-01e9-0310-a592-d414129be87e
Enhance logparse.pl so that it detects channels running SFTP and
decodes the SFTP message layer in addition to the underlying SSH.
Requests and responses are matched up via their ids.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9612 cda61777-01e9-0310-a592-d414129be87e
Fix a bug in the PSFTP command parser which would cause it to
hallucinate an extra empty argument word at the end of a line if the
line ended in more than one whitespace character.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9613 cda61777-01e9-0310-a592-d414129be87e
Generalise SSH_MSG_CHANNEL_{SUCCESS,FAILURE} handling.

Now each channel has a queue of arbitrary handlers for those messages, 
with anything that sends a CHANNEL_REQUEST with want_reply true pushing 
a new entry onto the queue, and a shared handler that dispatches 
responses appropriately.

Currently, this is only used for winadj@putty.projects.tartarus.org, but 
extending it to cover the initial requests as well shouldn't be too 
painful.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9615 cda61777-01e9-0310-a592-d414129be87e
Handle all replies to CHANNEL_REQUESTs through the per-channel queue.

Each of the minor start-of-session requests is now dealt with by its own 
little co-routine, while the shell/command is done in do_ssh2_authconn() 
itself.  This eliminates one more round-trip in session setup: PuTTY gets
all the way up to sending a shell request before worrying about any
replies.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9616 cda61777-01e9-0310-a592-d414129be87e
Fix matching of channel and global requests with replies in logparse.pl.

In each case, want_reply was being treated as true even when it wasnt,
because it got decoded into "yes"/"no", both of which are true in
Perl.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9617 cda61777-01e9-0310-a592-d414129be87e
Add some kind of window tracking to logparse.pl.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9618 cda61777-01e9-0310-a592-d414129be87e
Simplify handling of responses to channel requests.

The various setup routines can only receive CHANNEL_REQUEST or
CHANNEL_FAILURE, so there's no need for the to worry about receiving
anything else.  Strange packets will end up in do_ssh2_authconn
instead.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9619 cda61777-01e9-0310-a592-d414129be87e
Factor out common code to construct CHANNEL_REQUESTS.

This reduces code size a little and also makes it harder to
accidentally request a reply without putting in place a handler for
it or vice versa.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9620 cda61777-01e9-0310-a592-d414129be87e
Better handling of outstanding CHANNEL_REQUESTS on channel destruction.

Part the first: make sure that all structures describing channel
requests are freed when the SSH connection is freed.  This involves
adding a means to ask a response handler to free any memory it holds.

Part the second: in ssh_channel_try_eof(), call
ssh2_channel_check_close() rather than emitting an SSH_MSG_CHANNEL_EOF
directly.  This avoids the possibility of closing the channel while a
CHANNEL_REQUEST is outstanding.

Also add some assertions that helped with tracking down the latter
problem.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9623 cda61777-01e9-0310-a592-d414129be87e
Improve  window-size handling in Unix Plink.

Unconditionally override the configured terminal size with the one
from stdin if it's available.  This avoids the silliness whereby if
Default Settings had a terminal size set, Plink used this and thus
caused the server to use the wrong size.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9624 cda61777-01e9-0310-a592-d414129be87e
Remove documentation for "Out of space for port forwardings" error.

It no longer exists in the code, and should have been obsoleted by
r9214 at the latest.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9626 cda61777-01e9-0310-a592-d414129be87e
Fix markup error introduced in r9626.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9627 cda61777-01e9-0310-a592-d414129be87e