1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/windows
Simon Tatham cd8a7181fd Complete rework of terminal userpass input system.
The system for handling seat_get_userpass_input has always been
structured differently between GUI PuTTY and CLI tools like Plink.

In the CLI tools, password input is read directly from the OS
terminal/console device by console_get_userpass_input; this means that
you need to ensure the same terminal input data _hasn't_ already been
consumed by the main event loop and sent on to the backend. This is
achieved by the backend_sendok() method, which tells the event loop
when the backend has finished issuing password prompts, and hence,
when it's safe to start passing standard input to backend_send().

But in the GUI tools, input generated by the terminal window has
always been sent straight to backend_send(), regardless of whether
backend_sendok() says it wants it. So the terminal-based
implementation of username and password prompts has to work by
consuming input data that had _already_ been passed to the backend -
hence, any backend that needs to do that must keep its input on a
bufchain, and pass that bufchain to seat_get_userpass_input.

It's awkward that these two totally different systems coexist in the
first place. And now that SSH proxying needs to present interactive
prompts of its own, it's clear which one should win: the CLI style is
the Right Thing. So this change reworks the GUI side of the mechanism
to be more similar: terminal data now goes into a queue in the Ldisc,
and is not sent on to the backend until the backend says it's ready
for it via backend_sendok(). So terminal-based userpass prompts can
now consume data directly from that queue during the connection setup
stage.

As a result, the 'bufchain *' parameter has vanished from all the
userpass_input functions (both the official implementations of the
Seat trait method, and term_get_userpass_input() to which some of
those implementations delegate). The only function that actually used
that bufchain, namely term_get_userpass_input(), now instead reads
from the ldisc's input queue via a couple of new Ldisc functions.

(Not _trivial_ functions, since input buffered by Ldisc can be a
mixture of raw bytes and session specials like SS_EOL! The input queue
inside Ldisc is a bufchain containing a fiddly binary encoding that
can represent an arbitrary interleaving of those things.)

This greatly simplifies the calls to seat_get_userpass_input in
backends, which now don't have to mess about with passing their own
user_input bufchain around, or toggling their want_user_input flag
back and forth to request data to put on to that bufchain.

But the flip side is that now there has to be some _other_ method for
notifying the terminal when there's more input to be consumed during
an interactive prompt, and for notifying the backend when prompt input
has finished so that it can proceed to the next stage of the protocol.
This is done by a pair of extra callbacks: when more data is put on to
Ldisc's input queue, it triggers a call to term_get_userpass_input,
and when term_get_userpass_input finishes, it calls a callback
function provided in the prompts_t.

Therefore, any use of a prompts_t which *might* be asynchronous must
fill in the latter callback when setting up the prompts_t. In SSH, the
callback is centralised into a common PPL helper function, which
reinvokes the same PPL's process_queue coroutine; in rlogin we have to
set it up ourselves.

I'm sorry for this large and sprawling patch: I tried fairly hard to
break it up into individually comprehensible sub-patches, but I just
couldn't tease out any part of it that would stand sensibly alone.
2021-09-14 13:19:33 +01:00
..
utils split_into_argv.c: tidy up large comment. 2021-09-13 12:06:45 +01:00
agent-client.c Close agent named-pipe handles when queries complete. 2021-05-13 18:22:05 +01:00
be_conpty.c New application: a Windows version of 'pterm'! 2021-05-08 17:51:27 +01:00
cliloop.c Reorganise Windows HANDLE management. 2021-05-24 15:27:38 +01:00
CMakeLists.txt Reorganise Windows HANDLE management. 2021-05-24 15:27:38 +01:00
config.c Initial support for in-process proxy SSH connections. 2021-05-22 14:13:52 +01:00
conpty.c Separate backend_send from backend_sendbuffer. 2021-09-12 09:52:46 +01:00
console.c Divide seat_set_trust_status into query and update. 2021-09-12 09:52:46 +01:00
controls.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
cryptoapi.h Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
dialog.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
gss.c Avoid crash in MIT Kerberos for Windows on session restart. 2021-07-01 18:59:44 +01:00
handle-io.c Close all thread handles returned from CreateThread. 2021-07-01 18:30:25 +01:00
handle-socket.c FdSocket, HandleSocket: store a notional peer address. 2021-09-13 14:38:44 +01:00
handle-wait.c Fix an unused variable. 2021-05-27 09:48:32 +01:00
help.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
help.h Bug workaround to delay sending our SSH greeting. 2021-08-14 11:46:21 +01:00
help.rc2 Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
installer.wxs Configurable CHM path in installer source. 2021-05-03 17:01:55 +01:00
jump-list.c Move some parts of window.c into putty.c. 2021-05-08 17:20:50 +01:00
local-proxy.c FdSocket, HandleSocket: store a notional peer address. 2021-09-13 14:38:44 +01:00
make_install_images.sh Remove white dialog background in MSI user interface. 2020-06-21 16:39:47 +01:00
msifixup.py Remove white dialog background in MSI user interface. 2020-06-21 16:39:47 +01:00
named-pipe-client.c FdSocket, HandleSocket: store a notional peer address. 2021-09-13 14:38:44 +01:00
named-pipe-server.c FdSocket, HandleSocket: store a notional peer address. 2021-09-13 14:38:44 +01:00
network.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
no-jump-list.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
nohelp.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
noise.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
pageant-rc.h winpgnt: say 'click to focus' in async passphrase prompt. 2021-04-22 20:00:46 +01:00
pageant.c Close all thread handles returned from CreateThread. 2021-07-01 18:30:25 +01:00
pageant.ico Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
pageant.mft Whitespace rationalisation of entire code base. 2019-09-08 20:29:21 +01:00
pageant.rc Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
pageants.ico Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
platform.h FdSocket, HandleSocket: store a notional peer address. 2021-09-13 14:38:44 +01:00
plink.c Complete rework of terminal userpass input system. 2021-09-14 13:19:33 +01:00
plink.rc `win-versioninfo': all builds of all Windows binaries now contain 2005-10-04 14:13:28 +00:00
printing.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
pscp.ico Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
pscp.rc `win-versioninfo': all builds of all Windows binaries now contain 2005-10-04 14:13:28 +00:00
psftp.rc `win-versioninfo': all builds of all Windows binaries now contain 2005-10-04 14:13:28 +00:00
psocks.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
pterm.c New application: a Windows version of 'pterm'! 2021-05-08 17:51:27 +01:00
pterm.ico Make Windows versions of the pterm icons. 2021-05-08 17:33:25 +01:00
pterm.rc New application: a Windows version of 'pterm'! 2021-05-08 17:51:27 +01:00
ptermcfg.ico Make Windows versions of the pterm icons. 2021-05-08 17:33:25 +01:00
putty-common.rc2 Move icon declarations out of putty-common.rc2. 2021-05-08 17:33:25 +01:00
putty-rc.h Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
putty.c Move some parts of window.c into putty.c. 2021-05-08 17:20:50 +01:00
putty.ico Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
putty.mft Windows 10: add per monitor DPI awareness support. 2021-04-02 19:04:19 +01:00
putty.rc Move icon declarations out of putty-common.rc2. 2021-05-08 17:33:25 +01:00
puttycfg.ico Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
puttygen-rc.h PuTTYgen: option to control Argon2 flavour. 2021-02-23 18:26:50 +00:00
puttygen.c Close all thread handles returned from CreateThread. 2021-07-01 18:30:25 +01:00
puttygen.ico Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
puttygen.mft Whitespace rationalisation of entire code base. 2019-09-08 20:29:21 +01:00
puttygen.rc Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
puttyins.ico `installer.ico' doesn't fit into 8.3, so gets truncated to INSTALLE.ICO in 2007-02-06 22:39:15 +00:00
puttytel.mft Windows 10: add per monitor DPI awareness support. 2021-04-02 19:04:19 +01:00
puttytel.rc Move icon declarations out of putty-common.rc2. 2021-05-08 17:33:25 +01:00
rcstuff.h Replace mkfiles.pl with a CMake build system. 2021-04-17 13:53:02 +01:00
README-msi.txt Remove note about .CHM on network drives. 2019-03-18 21:53:45 +00:00
security-api.h Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
select-cli.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
select-gui.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
serial.c Separate backend_send from backend_sendbuffer. 2021-09-12 09:52:46 +01:00
sftp.c Complete rework of terminal userpass input system. 2021-09-14 13:19:33 +01:00
sharing.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
sizetip.c Formatting change to braces around one case of a switch. 2020-02-16 11:26:21 +00:00
storage.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
unicode.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
version.rc2 FIXME about Windows resource CHMfulness hint. 2019-03-18 22:02:13 +00:00
website.url Switch chiark URLs to https. 2017-05-07 16:29:01 +01:00
win-gui-seat.h Rename most of the platform source files. 2021-04-26 18:00:01 +01:00
window.c Complete rework of terminal userpass input system. 2021-09-14 13:19:33 +01:00
x11.c Rename most of the platform source files. 2021-04-26 18:00:01 +01:00