simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Mon Sep 24 19:45:56 BST 2018


TL;DR:
  26f7a2ac Add missing 'static' to BPP vtable definitions.
  f4fbaa1b Rework special-commands system to add an integer argument.
  8cb68390 Move SSH packet type codes into list macros.
  09c3439b Move SSH_MSG_UNEXPECTED generation into the BPP.
  f6f8219a Replace PktIn reference count with a 'free queue'.
  43767fff Add a missing include to putty.h.
  96622d17 Move verify_ssh_manual_host_key into sshcommon.c
  d77b95cb Macroise the cumbersome read idioms in the BPPs.
  56bf65ef Fix spurious EOF in agent forwarding!
  54b300f1 pscp: try not to print error message on statistics line.
  a703f867 Defer passing a ConnectionLayer to sshshare.c.
  623c7b72 Put an optional IdempotentCallback in packet queues.
  06b721ca Put an optional IdempotentCallback in bufchains.
  60d95b6a Tweak crWaitUntil macros for greater robustness.
  6bb84773 Give the BPP an input and output packet queue.
  30744400 Move SSH_MSG_DISCONNECT construction into the BPP.
  344ec3ae Restructure SSH-1 compression again.
  2ca0070f Move most of ssh.c out into separate source files.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2018-09-24 19:45:56

commit 26f7a2ac723629bc0f56728eff3eb99f4dd742e6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=26f7a2ac723629bc0f56728eff3eb99f4dd742e6;hp=ed70e6014cbe43baf5d5e0c3261c4d99e6bc9473
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Sep 23 09:30:37 2018 +0100

    Add missing 'static' to BPP vtable definitions.
    
    Vtable objects only need to be globally visible throughout the code if
    they're used directly in some interchangeable way, e.g. by passing
    them to a constructor like cipher_new that's the same for all
    implementations of the vtable, or by directly looking up public data
    fields in the vtable itself.
    
    But the BPPs are never used like that: each BPP has its own
    constructor function with a different type signature, so the BPP types
    are not interchangeable in any way _before_ an instance of one has
    been constructed. Hence, their vtable objects don't need external
    linkage.

 ssh1bpp.c      | 2 +-
 ssh2bpp-bare.c | 2 +-
 ssh2bpp.c      | 2 +-
 sshverstring.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

commit f4fbaa1bd987dea038282e514d99162789f0a697
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f4fbaa1bd987dea038282e514d99162789f0a697;hp=26f7a2ac723629bc0f56728eff3eb99f4dd742e6
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 09:35:52 2018 +0100

    Rework special-commands system to add an integer argument.
    
    In order to list cross-certifiable host keys in the GUI specials menu,
    the SSH backend has been inventing new values on the end of the
    Telnet_Special enumeration, starting from the value TS_LOCALSTART.
    This is inelegant, and also makes it awkward to break up special
    handlers (e.g. to dispatch different specials to different SSH
    layers), since if all you know about a special is that it's somewhere
    in the TS_LOCALSTART+n space, you can't tell what _general kind_ of
    thing it is. Also, if I ever need another open-ended set of specials
    in future, I'll have to remember which TS_LOCALSTART+n codes are in
    which set.
    
    So here's a revamp that causes every special to take an extra integer
    argument. For all previously numbered specials, this argument is
    passed as zero and ignored, but there's a new main special code for
    SSH host key cross-certification, in which the integer argument is an
    index into the backend's list of available keys. TS_LOCALSTART is now
    a thing of the past: if I need any other open-ended sets of specials
    in future, I can add a new top-level code with a nicely separated
    space of arguments.
    
    While I'm at it, I've removed the legacy misnomer 'Telnet_Special'
    from the code completely; the enum is now SessionSpecialCode, the
    struct containing full details of a menu entry is SessionSpecial, and
    the enum values now start SS_ rather than TS_.

 defs.h             |   2 +
 ldisc.c            |  20 ++++-----
 pinger.c           |   4 +-
 pscp.c             |   4 +-
 psftp.c            |   6 +--
 putty.h            |  89 ++++++++++++++++++++++++++-------------
 raw.c              |   6 +--
 rlogin.c           |   4 +-
 ssh.c              | 119 +++++++++++++++++++++++++++--------------------------
 telnet.c           |  81 +++++++++++++++---------------------
 testback.c         |   8 ++--
 unix/gtkcompat.h   |   1 +
 unix/gtkwin.c      |  27 +++++++-----
 unix/uxplink.c     |   4 +-
 unix/uxpty.c       |   4 +-
 unix/uxser.c       |  12 +++---
 windows/window.c   |  13 +++---
 windows/winplink.c |   2 +-
 windows/winser.c   |  12 +++---
 19 files changed, 224 insertions(+), 194 deletions(-)

commit 8cb68390e430fc03a0d032327dec36913320e60d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=8cb68390e430fc03a0d032327dec36913320e60d;hp=f4fbaa1bd987dea038282e514d99162789f0a697
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 13:29:09 2018 +0100

    Move SSH packet type codes into list macros.
    
    This allows me to share just one definition of the packet types
    between the enum declarations in ssh.h and the string translation
    functions in sshcommon.c. No functional change.
    
    The style of list macro is slightly unusual; instead of the
    traditional 'X-macro' in which LIST(X) expands to invocations of the
    form X(list element), this is an 'X-y macro', where LIST(X,y) expands
    to invocations of the form X(y, list element). That style makes it
    possible to wrap the list macro up in another macro and pass a
    parameter through from the wrapper to the per-element macro. I'm not
    using that facility just yet, but I will in the next commit.

 ssh.h       | 219 ++++++++++++++++++++++++++++++++----------------------------
 sshcommon.c | 114 ++++---------------------------
 2 files changed, 129 insertions(+), 204 deletions(-)

commit 09c3439b5ab3be150cfaa1565968e797fa4133b8
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=09c3439b5ab3be150cfaa1565968e797fa4133b8;hp=8cb68390e430fc03a0d032327dec36913320e60d
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 13:45:10 2018 +0100

    Move SSH_MSG_UNEXPECTED generation into the BPP.
    
    Now I've got a list macro defining all the packet types we recognise,
    I can use it to write a test for 'is this a recognised code?', and use
    that in turn to centralise detection of completely unrecognised codes
    into the binary packet protocol, where any such messages will be
    handled entirely internally and never even be seen by the next level
    up. This lets me remove another big pile of boilerplate in ssh.c.

 ssh.c          | 81 ++++++++--------------------------------------------------
 ssh.h          |  1 +
 ssh2bpp-bare.c |  6 +++++
 ssh2bpp.c      |  6 +++++
 sshbpp.h       |  3 +++
 sshcommon.c    | 41 +++++++++++++++++++++++++++++
 6 files changed, 67 insertions(+), 71 deletions(-)

commit f6f8219a3dcb1a144f4ccbff1dbf12c776affdaa
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f6f8219a3dcb1a144f4ccbff1dbf12c776affdaa;hp=09c3439b5ab3be150cfaa1565968e797fa4133b8
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Sep 23 16:35:29 2018 +0100

    Replace PktIn reference count with a 'free queue'.
    
    This is a new idea I've had to make memory-management of PktIn even
    easier. The idea is that a PktIn is essentially _always_ an element of
    some linked-list queue: if it's not one of the queues by which packets
    move through ssh.c, then it's a special 'free queue' which holds
    packets that are unowned and due to be freed.
    
    pq_pop() on a PktInQueue automatically relinks the packet to the free
    queue, and also triggers an idempotent callback which will empty the
    queue and really free all the packets on it. Hence, you can pop a
    packet off a real queue, parse it, handle it, and then just assume
    it'll get tidied up at some point - the only constraint being that you
    have to finish with it before returning to the application's main loop.
    
    The exception is that it's OK to pq_push() the packet back on to some
    other PktInQueue, because a side effect of that will be to _remove_ it
    from the free queue again. (And if _all_ the incoming packets get that
    treatment, then when the free-queue handler eventually runs, it may
    find it has nothing to do - which is harmless.)

 defs.h         |  2 ++
 ssh.c          |  6 ------
 ssh.h          |  3 +--
 ssh1bpp.c      |  5 ++---
 ssh2bpp-bare.c |  5 ++---
 ssh2bpp.c      |  9 ++++-----
 sshcommon.c    | 59 +++++++++++++++++++++++++++++++++++++++++++++-------------
 7 files changed, 57 insertions(+), 32 deletions(-)

commit 43767fff045bf1c705230d639663ba086825b608
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=43767fff045bf1c705230d639663ba086825b608;hp=f6f8219a3dcb1a144f4ccbff1dbf12c776affdaa
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 14:01:06 2018 +0100

    Add a missing include to putty.h.
    
    We define a macro in terms of INT_MAX, so we ought to include
    <limits.h> to ensure INT_MAX is defined, rather than depending on
    every call site to have remembered to do that themselves.

 putty.h | 1 +
 1 file changed, 1 insertion(+)

commit 96622d17a37376e260b86482a4658ecd4fdc3d0c
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=96622d17a37376e260b86482a4658ecd4fdc3d0c;hp=43767fff045bf1c705230d639663ba086825b608
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 14:15:32 2018 +0100

    Move verify_ssh_manual_host_key into sshcommon.c
    
    This is essentially trivial, because the only thing it needed from the
    Ssh structure was the Conf. So the version in sshcommon.c just takes
    an actual Conf as an argument, and now it doesn't need access to the
    big structure definition any more.

 ssh.c       | 58 +++-------------------------------------------------------
 ssh.h       |  3 +++
 sshcommon.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 55 deletions(-)

commit d77b95cb425972dcfcabad63e0a5b42ff9f2d9dd
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=d77b95cb425972dcfcabad63e0a5b42ff9f2d9dd;hp=96622d17a37376e260b86482a4658ecd4fdc3d0c
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 14:23:52 2018 +0100

    Macroise the cumbersome read idioms in the BPPs.
    
    Now the three 'proper' BPPs each have a BPP_READ() macro that wraps up
    the fiddly combination of crMaybeWaitUntilV and bufchainery they use
    to read a fixed-length amount of input data. The sshverstring 'BPP'
    doesn't read fixed-length data in quite the same way, but it has a
    similar BPP_WAITFOR macro.
    
    No functional change. Mostly this is just a cleanup to make the code
    more legible, but also, the new macros will be a good place to
    centralise anything else that needs doing on every read, such as EOF
    checking.

 ssh1bpp.c      | 12 ++++++++----
 ssh2bpp-bare.c | 12 ++++++++----
 ssh2bpp.c      | 29 +++++++++++++----------------
 sshverstring.c | 13 ++++++++++---
 4 files changed, 39 insertions(+), 27 deletions(-)

commit 56bf65ef841c8c1aeba15ed5aaac50dfffba4f84
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=56bf65ef841c8c1aeba15ed5aaac50dfffba4f84;hp=d77b95cb425972dcfcabad63e0a5b42ff9f2d9dd
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 14:40:35 2018 +0100

    Fix spurious EOF in agent forwarding!
    
    Commit 6a8b9d381, which created the Channel vtable and moved the agent
    forwarding implementation of it out into agentf.c, managed to set the
    rcvd_eof flag to TRUE in agentf_new(), meaning that we behave exactly
    as if the first agent request was followed by an incoming EOF.

 agentf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 54b300f1547266feded4ef56bfc4692f6324850d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=54b300f1547266feded4ef56bfc4692f6324850d;hp=56bf65ef841c8c1aeba15ed5aaac50dfffba4f84
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 14:59:22 2018 +0100

    pscp: try not to print error message on statistics line.
    
    If an error happens in mid-file-copy, we now try to move the terminal
    cursor to the start of the next line before printing the error message.

 pscp.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

commit a703f86731befdaaed00c968b21fc5e8261dbc53
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=a703f86731befdaaed00c968b21fc5e8261dbc53;hp=54b300f1547266feded4ef56bfc4692f6324850d
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Sep 21 17:00:36 2018 +0100

    Defer passing a ConnectionLayer to sshshare.c.
    
    This paves the way for me to reorganise ssh.c in a way that will mean
    I don't have a ConnectionLayer available yet at the time I have to
    create the connshare. The constructor function now takes a mere
    Frontend, for generating setup-time Event Log messages, and there's a
    separate ssh_connshare_provide_connlayer() function I can call later
    once I have the ConnectionLayer to provide.
    
    NFC for the moment: the new provide_connlayer function is called
    immediately after ssh_connection_sharing_init.

 ssh.c      |  7 +++++--
 ssh.h      |  4 +++-
 sshshare.c | 20 +++++++++++++-------
 3 files changed, 21 insertions(+), 10 deletions(-)

commit 623c7b720c731ce3c94cf65dc9607351b29a70a7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=623c7b720c731ce3c94cf65dc9607351b29a70a7;hp=a703f86731befdaaed00c968b21fc5e8261dbc53
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Sep 21 13:16:38 2018 +0100

    Put an optional IdempotentCallback in packet queues.
    
    This means that someone putting things on a packet queue doesn't need
    to separately hold a pointer to someone who needs notifying about it,
    or remember to call the notification function every time they push
    things on the queue. It's all taken care of automatically, without
    having to put extra stuff at the call sites.
    
    The precise semantics are that the callback will be scheduled whenever
    _new_ packets appear on the queue, but not when packets are removed.
    (Because the expectation is that the callback is notifying whoever is
    consuming the queue.)

 ssh.h       |  1 +
 sshcommon.c | 13 +++++++++++++
 2 files changed, 14 insertions(+)

commit 06b721ca0366db434095edf672ea1610c5b0bcb9
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=06b721ca0366db434095edf672ea1610c5b0bcb9;hp=623c7b720c731ce3c94cf65dc9607351b29a70a7
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Sep 22 08:13:41 2018 +0100

    Put an optional IdempotentCallback in bufchains.
    
    The callback has the same semantics as for packet queues: it triggers
    automatically when data is added to a bufchain, not when it's removed.

 cmdgen.c          | 4 ++++
 misc.c            | 4 ++++
 misc.h            | 1 +
 testbn.c          | 1 +
 windows/winpgen.c | 3 ++-
 windows/winpgnt.c | 3 ++-
 6 files changed, 14 insertions(+), 2 deletions(-)

commit 60d95b6a62e7db689ca9c74dfb0efdb82d000289
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=60d95b6a62e7db689ca9c74dfb0efdb82d000289;hp=06b721ca0366db434095edf672ea1610c5b0bcb9
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 14:02:44 2018 +0100

    Tweak crWaitUntil macros for greater robustness.
    
    I've rewritten these macros so that they don't keep rewriting the same
    value into the crLine variable. They now write it just once, before
    ever testing the condition.
    
    The point isn't the extra efficiency (which is surely negligible);
    it's to make it safe to abort a coroutine and free its entire state at
    unexpected moments. If you use one of these macros with a condition
    that has side effects, say crWaitUntil(func()), and one of the side
    effects can be to free the entire object that holds the coroutine
    state, then the write to crLine after testing the condition would
    previously have caused a stale-pointer dereference. But now that only
    happened once, _before_ the condition was first evaluated; so as long
    as func() returns false in the event that it frees the coroutine
    state, it's safe - crWaitUntil will see the false condition and return
    without touching the state object, and then it'll never be called
    again because the whole object will have gone away.

 sshcr.h | 39 +++++++++++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 4 deletions(-)

commit 6bb847738bf3aa6f56f93cc9e8cedc9f0207663a
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=6bb847738bf3aa6f56f93cc9e8cedc9f0207663a;hp=60d95b6a62e7db689ca9c74dfb0efdb82d000289
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 18:08:09 2018 +0100

    Give the BPP an input and output packet queue.
    
    Now, instead of writing each packet straight on to the raw output
    bufchain by calling the BPP's format_packet function, the higher
    protocol layers will put the packets on to a queue, which will
    automatically trigger a callback (using the new mechanism for
    embedding a callback in any packet queue) to make the BPP format its
    queue on to the raw-output bufchain. That in turn triggers a second
    callback which moves the data to the socket.
    
    This means in particular that the CBC ignore-message workaround can be
    moved into the new BPP routine to process the output queue, which is a
    good place for it because then it can easily arrange to only put an
    ignore message at the start of any sequence of packets that are being
    formatted as a single output blob.

 ssh.c          | 68 ++++++++++++++++++++++++++--------------------------------
 ssh1bpp.c      | 21 ++++++++++++------
 ssh2bpp-bare.c | 25 ++++++++++++++-------
 ssh2bpp.c      | 53 +++++++++++++++++++++++++++++++++++++++------
 sshbpp.h       | 30 ++++++++++++++++++++------
 sshcommon.c    | 35 ++++++++++++++++++++++++++++--
 sshverstring.c |  7 +++---
 7 files changed, 170 insertions(+), 69 deletions(-)

commit 30744400405512d5c46f9e24b422a018b41bebcd
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=30744400405512d5c46f9e24b422a018b41bebcd;hp=6bb847738bf3aa6f56f93cc9e8cedc9f0207663a
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 18:14:33 2018 +0100

    Move SSH_MSG_DISCONNECT construction into the BPP.
    
    This is a convenient place for it because it abstracts away the
    difference in disconnect packet formats between SSH-1 and -2, so when
    I start restructuring, I'll be able to call it even from places that
    don't know which version of SSH they're running.

 ssh.c          | 15 ++-------------
 ssh1bpp.c      | 11 +++++++++++
 ssh2bpp-bare.c |  1 +
 ssh2bpp.c      |  1 +
 sshbpp.h       |  8 +++++++-
 sshcommon.c    | 10 ++++++++++
 sshverstring.c |  9 +++++++++
 7 files changed, 41 insertions(+), 14 deletions(-)

commit 344ec3aec5d8d32a1e6d6ccc8028c6951ebce5d1
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=344ec3aec5d8d32a1e6d6ccc8028c6951ebce5d1;hp=30744400405512d5c46f9e24b422a018b41bebcd
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Sep 22 11:09:15 2018 +0100

    Restructure SSH-1 compression again.
    
    Having redesigned it a few days ago in commit 562cdd4df, I'm changing
    it again, this time to fix a potential race condition on the _output_
    side: the last change was intended to cope with a server sending an
    asynchronous message like IGNORE immediately after enabling
    compression, and this one fixes the case in which _we_ happen to
    decide to send an IGNORE while a compression request is still pending.
    
    I couldn't fix this until after the BPP was reorganised to have an
    explicit output queue of packets, but now it does, I can simply defer
    processing that queue on to the output raw-data bufchain if we're
    waiting for a compression request to be answered. Once it is answered,
    the BPP can release any pending packets.

 ssh.c     |  9 +++++++-
 ssh1bpp.c | 77 ++++++++++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 62 insertions(+), 24 deletions(-)

commit 2ca0070f891c464d4274bdc1c69709fd6b694bd7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=2ca0070f891c464d4274bdc1c69709fd6b694bd7;hp=344ec3aec5d8d32a1e6d6ccc8028c6951ebce5d1
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Sep 24 18:28:16 2018 +0100

    Move most of ssh.c out into separate source files.
    
    I've tried to separate out as many individually coherent changes from
    this work as I could into their own commits, but here's where I run
    out and have to commit the rest of this major refactoring as a
    big-bang change.
    
    Most of ssh.c is now no longer in ssh.c: all five of the main
    coroutines that handle layers of the SSH-1 and SSH-2 protocols now
    each have their own source file to live in, and a lot of the
    supporting functions have moved into the appropriate one of those too.
    
    The new abstraction is a vtable called 'PacketProtocolLayer', which
    has an input and output packet queue. Each layer's main coroutine is
    invoked from the method ssh_ppl_process_queue(), which is usually
    (though not exclusively) triggered automatically when things are
    pushed on the input queue. In SSH-2, the base layer is the transport
    protocol, and it contains a pair of subsidiary queues by which it
    passes some of its packets to the higher SSH-2 layers - first userauth
    and then connection, which are peers at the same level, with the
    former abdicating in favour of the latter at the appropriate moment.
    SSH-1 is simpler: the whole login phase of the protocol (crypto setup
    and authentication) is all in one module, and since SSH-1 has no
    repeat key exchange, that setup layer abdicates in favour of the
    connection phase when it's done.
    
    ssh.c itself is now about a tenth of its old size (which all by itself
    is cause for celebration!). Its main job is to set up all the layers,
    hook them up to each other and to the BPP, and to funnel data back and
    forth between that collection of modules and external things such as
    the network and the terminal. Once it's set up a collection of packet
    protocol layers, it communicates with them partly by calling methods
    of the base layer (and if that's ssh2transport then it will delegate
    some functionality to the corresponding methods of its higher layer),
    and partly by talking directly to the connection layer no matter where
    it is in the stack by means of the separate ConnectionLayer vtable
    which I introduced in commit 8001dd4cb, and to which I've now added
    quite a few extra methods replacing services that used to be internal
    function calls within ssh.c.
    
    (One effect of this is that the SSH-1 and SSH-2 channel storage is now
    no longer shared - there are distinct struct types ssh1_channel and
    ssh2_channel. That means a bit more code duplication, but on the plus
    side, a lot fewer confusing conditionals in the middle of half-shared
    functions, and less risk of a piece of SSH-1 escaping into SSH-2 or
    vice versa, which I remember has happened at least once in the past.)
    
    The bulk of this commit introduces the five new source files, their
    common header sshppl.h and some shared supporting routines in
    sshcommon.c, and rewrites nearly all of ssh.c itself. But it also
    includes a couple of other changes that I couldn't separate easily
    enough:
    
    Firstly, there's a new handling for socket EOF, in which ssh.c sets an
    'input_eof' flag in the BPP, and that responds by checking a flag that
    tells it whether to report the EOF as an error or not. (This is the
    main reason for those new BPP_READ / BPP_WAITFOR macros - they can
    check the EOF flag every time the coroutine is resumed.)
    
    Secondly, the error reporting itself is changed around again. I'd
    expected to put some data fields in the public PacketProtocolLayer
    structure that it could set to report errors in the same way as the
    BPPs have been doing, but in the end, I decided propagating all those
    data fields around was a pain and that even the BPPs shouldn't have
    been doing it that way. So I've reverted to a system where everything
    calls back to functions in ssh.c itself to report any connection-
    ending condition. But there's a new family of those functions,
    categorising the possible such conditions by semantics, and each one
    has a different set of detailed effects (e.g. how rudely to close the
    network connection, what exit status should be passed back to the
    whole application, whether to send a disconnect message and/or display
    a GUI error box).
    
    I don't expect this to be immediately perfect: of course, the code has
    been through a big upheaval, new bugs are expected, and I haven't been
    able to do a full job of testing (e.g. I haven't tested every auth or
    kex method). But I've checked that it _basically_ works - both SSH
    protocols, all the different kinds of forwarding channel, more than
    one auth method, Windows and Linux, connection sharing - and I think
    it's now at the point where the easiest way to find further bugs is to
    let it out into the wild and see what users can spot.

 Recipe           |    1 +
 defs.h           |    1 +
 ssh.c            | 9942 ++++--------------------------------------------------
 ssh.h            |   56 +-
 ssh1bpp.c        |   35 +-
 ssh1connection.c | 1211 +++++++
 ssh1login.c      | 1206 +++++++
 ssh2bpp-bare.c   |   23 +-
 ssh2bpp.c        |   36 +-
 ssh2connection.c | 2501 ++++++++++++++
 ssh2transport.c  | 2967 ++++++++++++++++
 ssh2userauth.c   | 1673 +++++++++
 sshbpp.h         |    8 +-
 sshcommon.c      |  102 +
 sshgss.h         |   12 +
 sshppl.h         |  144 +
 sshverstring.c   |   21 +-
 17 files changed, 10575 insertions(+), 9364 deletions(-)



More information about the tartarus-commits mailing list