simon-git: putty (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Wed Dec 22 15:53:06 GMT 2021
TL;DR:
4944b4dd Remove duplicated string-literal formatter in Telnet proxy.
48b7ef21 Pass an Interactor to platform_new_connection.
ca70b128 Allow creating FdSocket/HandleSocket before the fds/handles.
c1ddacf7 Rewrite local-proxy system to allow interactive prompts.
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-12-22 15:53:06
commit 4944b4ddd5dfb00c2b573887c6f4919c40c9391a
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4944b4ddd5dfb00c2b573887c6f4919c40c9391a;hp=120723bf4011f492163a489cb530c149d09c92cf
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Dec 21 13:25:19 2021 +0000
Remove duplicated string-literal formatter in Telnet proxy.
Now it's done using the same code as in write_c_string_literal(), by
means of factoring the latter into a version that targets any old
BinarySink and a convenience wrapper taking a FILE *.
marshal.h | 5 +++++
proxy/telnet.c | 19 +------------------
utils/write_c_string_literal.c | 30 +++++++++++++++++++-----------
3 files changed, 25 insertions(+), 29 deletions(-)
commit 48b7ef21a104e66035bd75566a8d96f0e07b4c14
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=48b7ef21a104e66035bd75566a8d96f0e07b4c14;hp=4944b4ddd5dfb00c2b573887c6f4919c40c9391a
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Dec 21 13:35:51 2021 +0000
Pass an Interactor to platform_new_connection.
This will mean that platform-specific proxy types will also be able to
set themselves up as child Interactors and prompt the user
interactively for passwords and the like.
NFC: nothing uses the new parameter yet.
network.h | 2 +-
proxy/pproxy.c | 2 +-
proxy/proxy.c | 2 +-
unix/local-proxy.c | 2 +-
windows/local-proxy.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
commit ca70b1285d0f5ac9dc9654aaf60214d088a42def
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=ca70b1285d0f5ac9dc9654aaf60214d088a42def;hp=48b7ef21a104e66035bd75566a8d96f0e07b4c14
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Dec 22 09:31:06 2021 +0000
Allow creating FdSocket/HandleSocket before the fds/handles.
Previously, a setup function returning one of these socket types (such
as platform_new_connection) had to do all its setup synchronously,
because if it was going to call make_fd_socket or make_handle_socket,
it had to have the actual fds or HANDLEs ready-made. If some kind of
asynchronous operation were needed before those fds become available,
there would be no way the function could achieve it, except by
becoming a whole extra permanent Socket wrapper layer.
Now there is, because you can make an FdSocket when you don't yet have
the fds, or a HandleSocket without the HANDLEs. Instead, you provide
an instance of the new trait 'DeferredSocketOpener', which is
responsible for setting in motion whatever asynchronous setup
procedure it needs, and when that finishes, calling back to
setup_fd_socket / setup_handle_socket to provide the missing pieces.
In the meantime, the FdSocket or HandleSocket will sit there inertly,
buffering any data the client might eagerly hand it via sk_write(),
and waiting for its setup to finish. When it does finish, buffered
data will be released.
In FdSocket, this is easy enough, because we were doing our own
buffering anyway - we called the uxsel system to find out when the fds
were readable/writable, and then wrote to them from our own bufchain.
So more or less all I had to do was make the try_send function do
nothing if the setup phase wasn't finished yet.
In HandleSocket, on the other hand, we're passing all our data to the
underlying handle-io.c system, and making _that_ deferrable in the
same way would be much more painful, because that's the place where
the scary threads live. So instead I've arranged it by replacing the
whole vtable, so that a deferred HandleSocket and a normal
HandleSocket are effectively separate trait implementations that can
share their state structure. And in fact that state struct itself now
contains a big anonymous union, containing one branch to go with each
vtable.
Nothing yet uses this system, but the next commit will do so.
defs.h | 2 +
network.h | 27 ++++++++
unix/fd-socket.c | 66 ++++++++++++++----
unix/platform.h | 3 +
windows/handle-socket.c | 180 ++++++++++++++++++++++++++++++++++++++++++------
windows/platform.h | 4 ++
6 files changed, 245 insertions(+), 37 deletions(-)
commit c1ddacf78f75c463035a03371d2477d30ffa92ba
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=c1ddacf78f75c463035a03371d2477d30ffa92ba;hp=ca70b1285d0f5ac9dc9654aaf60214d088a42def
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Dec 22 12:03:28 2021 +0000
Rewrite local-proxy system to allow interactive prompts.
This fills in the remaining gap in the interactive prompt rework of
the proxy system in general. If you used the Telnet proxy with a
command containing %user or %pass, and hadn't filled in those
variables in the PuTTY config, then proxy/telnet.c would prompt you at
run time to enter the proxy auth details. But the local proxy command,
which uses the same format_telnet_command function, would not do that.
Now it does!
I've implemented this by moving the formatting of the proxy command
into a new module proxy/local.c, shared between both the Unix and
Windows local-proxy implementations. That module implements a
DeferredSocketOpener, which constructs the proxy command (prompting
first if necessary), and once it's constructed, hands it to a
per-platform function platform_setup_local_proxy().
So each platform-specific proxy function, instead of starting a
subprocess there and then and passing its details to make_fd_socket or
make_handle_socket, now returns a _deferred_ version of one of those
sockets, with the DeferredSocketOpener being the thing in
proxy/local.c. When that calls back to platform_setup_local_proxy(),
we actually start the subprocess and pass the resulting fds/handles to
the deferred socket to un-defer it.
A side effect of the rewrite is that when proxy commands are logged in
the Event Log, they now get the same amenities as in the Telnet proxy
type: the proxy password is sanitised out, and any difficult
characters are escaped.
CMakeLists.txt | 1 +
proxy/local.c | 266 ++++++++++++++++++++++++++++++++++++++++++++++++++
proxy/proxy.h | 6 ++
unix/local-proxy.c | 122 +++++++++++------------
windows/local-proxy.c | 62 ++++++------
5 files changed, 361 insertions(+), 96 deletions(-)
More information about the tartarus-commits
mailing list