simon-git: putty (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sun Feb 21 11:00:00 GMT 2021


TL;DR:
  a8599556 Fix premature exit if 'plink -shareexists' happens early.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2021-02-21 10:59:59

commit a859955689801f8173621677298280507061b13c
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=a859955689801f8173621677298280507061b13c;hp=f47e351ceeff1555aa7da55386e767a5fbd7e66e
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 21 10:11:13 2021 +0000

    Fix premature exit if 'plink -shareexists' happens early.
    
    A user reported a phenomenon where running 'plink -shareexists' very
    early in the connection would cause the receiving upstream PuTTY to
    exit cleanly with the message 'All channels closed' in the log.
    
    That wasn't hard to track down: that happens as a result of the
    connection layer callback sharing_no_more_downstreams(), which causes
    the connection layer to check whether it has any channels left open,
    and if not, to terminate the connection on the grounds that everything
    has finished. But it's premature to draw that conclusion if the reason
    no channels are open if we haven't _started_ yet! Now we have a
    'started' flag which is set when we initialise mainchan, and the
    'we're all done now' check will never fire before that flag is set.
    
    But in the course of investigating that, I found a second problem in
    the same area: at an even earlier stage of an SSH connection, the
    connshare system doesn't _even_ have the real ConnectionLayer pointer
    yet. Instead, it has a pointer to a dummy one provided by the
    top-level ssh.c, which contains a NULL vtable pointer. So if it calls
    sharing_no_more_downstreams on _that_ ConnectionLayer, it will
    dereference NULL and crash. So I've filled in cl_dummy's vtable
    pointer with a trivial vtable, containing only the one callback
    sharing_no_more_downstreams, which itself is a no-op function.
    
    Hopefully that should all be stable now.

 ssh.c            |  8 ++++++++
 ssh2connection.c | 10 ++++++++++
 ssh2connection.h |  1 +
 3 files changed, 19 insertions(+)



More information about the tartarus-commits mailing list