simon-git: putty (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Tue Jan 19 20:42:19 GMT 2021
TL;DR:
c6ff548a wincliloop: cope with winselcli_event not existing.
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-01-19 20:42:19
commit c6ff548ae0cd3ef9d2a57f9f862dad9813e4c617
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=c6ff548ae0cd3ef9d2a57f9f862dad9813e4c617;hp=20d1c47484dc9ee330abea41b1fd345bce2e96d1
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Jan 19 20:26:04 2021 +0000
wincliloop: cope with winselcli_event not existing.
I found recently that if I ran Windows PSCP as a connection-sharing
downstream, it would send the SSH greeting down the named pipe, but
never receive anything back, though the upstream PuTTY was sending it.
PuTTY and Plink from the same build of the code would act happily as
downstreams.
It turned out that this was because the WaitForMultipleObjects call in
cli_main_loop() in wincliloop.c was failing with ERROR_ACCESS_DENIED.
That happened because it had an INVALID_HANDLE_VALUE in its list of
objects to wait for. That in turn happened because winselcli_event was
set to INVALID_HANDLE_VALUE.
Why was winselcli_event not set up? Because it's set up lazily by
do_select(), so if the program isn't handling any network sockets at
all (which is the case when PSCP is speaking over a named pipe
instead), then it never gets made into a valid event object.
So the problem wasn't that winselcli_event was in a bad state; it was
quite legitimately invalid. The problem was that wincliloop ought to
have _coped_ with it being invalid, by not inserting it in its list of
objects to wait for.
So now we check that case, and only insert winselcli_event in the list
if it's valid. And PSCP works again over connection sharing.
windows/wincliloop.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
More information about the tartarus-commits
mailing list