simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sat Jan 4 14:25:44 GMT 2020


TL;DR:
  09954a87 Low-level API to open nonstandard port forwardings.
  ae114826 Stream-oriented agent forwarding on Unix.
  b89d17fb Centralise implementations of Windows do_select().
  58e2a35b Const-correctness in do_select() return value.
  e3059743 Move obfuscate_name out of winshare.c.
  39248737 winnpc.c: add low-level connect_to_named_pipe() function.
  f93b2606 Windows Pageant: establish a named-pipe server.
  cf29125f Windows: use named-pipe IPC for stream agent forwarding.
  c2b135c9 Windows: use the named pipe for normal agent queries.

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:           2020-01-04 14:25:44

commit 09954a87c24e84dac133a9c29ffaef45f145eeca
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=09954a87c24e84dac133a9c29ffaef45f145eeca;hp=e5107478f3119c2ee3d40a3e7dd29bdf96490db2
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 16:46:31 2020 +0000

    Low-level API to open nonstandard port forwardings.
    
    The new portfwdmgr_connect_socket() works basically like the existing
    portfwdmgr_connect(), in that it opens an SSH forwarding channel and
    gateways it to a Socket. But where portfwdmgr_connect() started from a
    (hostname,port) pair and used mgr->conf to inform name lookup and
    proxy settings, portfwdmgr_connect_socket() simply takes a callback
    that it will call when it wants you to make a Socket for a given Plug,
    and that callback can make any kind of Socket it likes.
    
    The idea is that this way you can make port forwardings that talk to
    things other than genuine TCP connections, by simply providing an
    appropriate callback.
    
    My immediate use case for this is for agent forwarding, and will
    appear in the next commit. But it's easy to imagine other purposes you
    might use a thing like this for, such as forwarding SSH channels to
    AF_UNIX sockets in general.

 portfwd.c | 58 +++++++++++++++++++++++++++++++++++++++++-----------------
 ssh.h     |  3 +++
 2 files changed, 44 insertions(+), 17 deletions(-)

commit ae1148267d2f55a647ab765c9735f1a8442ec838
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=ae1148267d2f55a647ab765c9735f1a8442ec838;hp=09954a87c24e84dac133a9c29ffaef45f145eeca
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 16:46:44 2020 +0000

    Stream-oriented agent forwarding on Unix.
    
    Historically, because of the way Windows Pageant's IPC works, PuTTY's
    agent forwarding has always been message-oriented. The channel
    implementation in agentf.c deals with receiving a data stream from the
    remote agent client and breaking it up into messages, and then it
    passes each message individually to agent_query().
    
    On Unix, this is more work than is really needed, and I've always
    meant to get round to doing the more obvious thing: making an agent
    forwarding channel into simply a stream-oriented proxy, passing raw
    data back and forth between the SSH channel and the local AF_UNIX
    socket without having to know or care about the message boundaries in
    the stream.
    
    The portfwdmgr_connect_socket() facility introduced by the previous
    commit is the missing piece of infrastructure to make that possible.
    Now, the agent client module provides an API that includes a callback
    you can pass to portfwdmgr_connect_socket() to open a streamed agent
    connection, and the agent forwarding setup function tries to use that
    where possible, only falling back to the message-based agentf.c system
    if it can't be done. On Windows, the new piece of agent-client API
    returns failure, so we still fall back to agentf.c there.
    
    There are two benefits to doing it this way. One is that it's just
    simpler and more robust: if PuTTY isn't trying to parse the agent
    connection, then it has less work to do and fewer places to introduce
    bugs. The other is that it's futureproof against changes in the agent
    protocol: if any kind of extension is ever introduced that requires
    keeping state within a single agent connection, or that changes the
    protocol itself so that agentf's message-boundary detection stops
    working, then this forwarding system will still work.

 putty.h                 | 10 ++++++++++
 ssh1connection-client.c | 25 ++++++++++++++++++++++++-
 ssh2connection-client.c | 24 ++++++++++++++++++++++++
 unix/uxagentc.c         | 35 +++++++++++++++++++++++++++++++++--
 windows/winpgntc.c      | 14 ++++++++++++++
 5 files changed, 105 insertions(+), 3 deletions(-)

commit b89d17fbca4271a476b5faeaf84bc6f0cac532bc
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b89d17fbca4271a476b5faeaf84bc6f0cac532bc;hp=ae1148267d2f55a647ab765c9735f1a8442ec838
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 11:10:22 2020 +0000

    Centralise implementations of Windows do_select().
    
    Windows Plink and PSFTP had very similar implementations, and now they
    share one that lives in a new file winselcli.c. I've similarly moved
    GUI PuTTY's implementation out of window.c into winselgui.c, where
    other GUI programs wanting to do networking will be able to access
    that too.
    
    In the spirit of centralisation, I've also taken the opportunity to
    make both functions use the reasonably complete winsock_error_string()
    rather than (for some historical reason) each inlining a minimal
    version that reports most errors as 'unknown'.

 Recipe              |  8 +++---
 windows/window.c    | 27 +------------------
 windows/winplink.c  | 26 ++----------------
 windows/winselcli.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 windows/winselgui.c | 38 ++++++++++++++++++++++++++
 windows/winsftp.c   | 52 +++++++----------------------------
 windows/winstuff.h  | 17 ++++++++++--
 7 files changed, 147 insertions(+), 99 deletions(-)

commit 58e2a35bdfbc144a51e02354376777e2f872cd3c
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=58e2a35bdfbc144a51e02354376777e2f872cd3c;hp=b89d17fbca4271a476b5faeaf84bc6f0cac532bc
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 15:46:59 2020 +0000

    Const-correctness in do_select() return value.
    
    The error message it returns on failure is a string literal, so it
    shouldn't be returned as a mutable 'char *'.

 windows/winnet.c    | 6 +++---
 windows/winselcli.c | 2 +-
 windows/winselgui.c | 2 +-
 windows/winstuff.h  | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

commit e305974313b22515cbe1782a56b775866c8ae7df
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e305974313b22515cbe1782a56b775866c8ae7df;hp=58e2a35bdfbc144a51e02354376777e2f872cd3c
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 31 07:42:02 2019 +0000

    Move obfuscate_name out of winshare.c.
    
    Now it lives in wincapi.c (under a slightly less generic name), so it
    can be reused in other contexts.

 windows/wincapi.c  | 77 +++++++++++++++++++++++++++++++++++++++++++++++++
 windows/wincapi.h  | 24 ++++++++++++++--
 windows/winshare.c | 84 +-----------------------------------------------------
 3 files changed, 99 insertions(+), 86 deletions(-)

commit 39248737a4cd406956effb95934bc55d5b319b68
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=39248737a4cd406956effb95934bc55d5b319b68;hp=e305974313b22515cbe1782a56b775866c8ae7df
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 18:58:11 2020 +0000

    winnpc.c: add low-level connect_to_named_pipe() function.
    
    This contains most of the guts of the previously monolithic function
    new_named_pipe_client(), but it directly returns the HANDLE to the
    opened pipe, or a string error message on failure.
    
    new_named_pipe_client() is now a thin veneer on top of that, which
    returns a Socket * by wrapping up the HANDLE into a HandleSocket or
    the error message into an ErrorSocket as appropriate.
    
    So it's now possible to connect to a named pipe, using all our usual
    infrastructure (including in particular the ownership check of the
    server, to defend against spoofing attacks), without having to have a
    Socket-capable event loop in progress.

 errsock.c          |  4 ++--
 network.h          |  4 ++++
 windows/winnpc.c   | 39 +++++++++++++++++++++++++++------------
 windows/winstuff.h |  6 ++++++
 4 files changed, 39 insertions(+), 14 deletions(-)

commit f93b2606940e5af7ec558987c8b62b06b5e43608
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f93b2606940e5af7ec558987c8b62b06b5e43608;hp=39248737a4cd406956effb95934bc55d5b319b68
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 15:55:06 2020 +0000

    Windows Pageant: establish a named-pipe server.
    
    This reuses all the named-pipe IPC code I set up for connection
    sharing a few years ago, to set up a named pipe with a predictable
    name and speak the stream-oriented SSH agent protocol over it.
    
    In this commit, we just set up the server, and there's no code that
    speaks the client end of the new IPC yet. But my plan is that clients
    should switch over to using this interface if possible, because it's
    generally better: it doesn't have to be handled synchronously in the
    middle of a GUI event loop (either in Pageant itself _or_ in its
    client), and it's a better fit to the connection-oriented nature of
    forwarded agent connections (so if any features ever appear in the
    agent protocol that require state within a connection, we'll now be
    able to support them).

 Recipe             |  3 ++-
 windows/winpgnt.c  | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 windows/winpgntc.c | 16 ++++++++++++++
 windows/winstuff.h |  5 +++++
 4 files changed, 83 insertions(+), 4 deletions(-)

commit cf29125fb464169d1bab88a0bc9c18a4ca5a983a
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=cf29125fb464169d1bab88a0bc9c18a4ca5a983a;hp=f93b2606940e5af7ec558987c8b62b06b5e43608
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 16:47:11 2020 +0000

    Windows: use named-pipe IPC for stream agent forwarding.
    
    Now that Pageant runs a named-pipe server as well as a WM_COPYDATA
    server, we prefer the former (if available) for agent forwarding, for
    the same reasons as on Unix: it lets us establish a simple raw-data
    streaming connection instead of agentf.c's complicated message
    boundary detection and buffer management, and if agent connections
    ever become stateful, this technique will cope.
    
    On Windows, another advantage of this change is that forwarded agent
    requests can now be asynchronous: if the agent takes time to respond
    to a request for any reason, then the rest of PuTTY's GUI and SSH
    connection are not blocked, and you can carry on working while the
    agent is thinking about the request.
    
    (I didn't list that as a benefit of doing the same thing for Unix in
    commit ae1148267, because on Unix, agent_query() could _already_ run
    asynchronously. It's only on Windows that that's new.)

 windows/winpgntc.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

commit c2b135c92aa69ae128afa960ac5e7a66105d8882
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=c2b135c92aa69ae128afa960ac5e7a66105d8882;hp=cf29125fb464169d1bab88a0bc9c18a4ca5a983a
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jan 1 19:28:29 2020 +0000

    Windows: use the named pipe for normal agent queries.
    
    As in the previous commit, this means that agent_query() is now able
    to operate in an asynchronous mode, so that if Pageant takes time to
    answer a request, the GUI of the PuTTY instance making the request
    won't be blocked.
    
    Also as in the previous commit, we still fall back to the WM_COPYDATA
    protocol if the new named pipe protocol isn't available.

 Recipe             |   2 +-
 windows/winpgntc.c | 189 +++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 177 insertions(+), 14 deletions(-)



More information about the tartarus-commits mailing list