]> asedeno.scripts.mit.edu Git - PuTTY.git/commit
Fix spurious EAGAIN in Plink host key (and other) prompts.
authorSimon Tatham <anakin@pobox.com>
Sat, 17 Oct 2015 16:30:53 +0000 (17:30 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 17 Oct 2015 16:30:53 +0000 (17:30 +0100)
commita815c3a8e1855e20e458571376039d36c5810642
tree5a43467d0c0f0eb14a1fb73469dd4cdd76cfd498
parent8c803e725e0b0071b5a454f423a805e1bd9b6be9
Fix spurious EAGAIN in Plink host key (and other) prompts.

Plink sets standard input into nonblocking mode, meaning that read()
from fd 0 in an interactive context will typically return -1 EAGAIN.
But the prompt functions in uxcons.c, used for verifying SSH host keys
and suchlike, were doing an unguarded read() from fd 0, and then
panicking and aborting the session when they got EAGAIN.

Fixed by inventing a wrapper around read(2) which handles EAGAIN but
passes all other errors back to the caller. (Seemed slightly less
dangerous than the stateful alternative of temporarily re-blockifying
the file descriptor.)

(cherry picked from commit bea758a7ae0507e0d4a24b370f8401661cc1a2c8)

Conflicts:
unix/uxcons.c

Cherry-picker's notes: the conflict was a trivial one. The new
function block_and_read() by this commit appears just before
verify_ssh_host_key(), which has a new prototype on the source branch,
close enough to disrupt the patch hunk's context. Easily fixed.
unix/uxcons.c