mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-28 01:07:08 -05:00
Windows: make is_interactive() match Unix.
This reverts the change to is_interactive() by commit 80aed962862ec73, which switched it to using the new conio system. Now we're back to doing it the same way as we used to: we check if stdin is a console. The only use of is_interactive() on Windows is deciding whether to present the console antispoof prompt. (On Unix it has an additional use in cmdgen, for deciding whether to emit progress reports, but on Windows that doesn't come up). On Unix this is based on stdin being a tty, which means that a command such as "plink host do stuff </dev/null" omits the antispoof prompt. That's deliberate: the prompt is to defend against attacks where the user sends interactive input to the SSH session channel believing it to be directed at userauth, but if the input _isn't_ coming from the interactive terminal where the user is answering userauth prompts, then they can't do that even if they are fooled. On Windows, I think the same argument applies, now that we're reading userauth prompts from the console in the same way as Unix. So is_interactive() now does the analogous thing on Windows. Conveniently, this _also_ means is_interactive() is back to exactly how it was before the conio rewrite, which means it's one fewer thing that can unexpectedly change and break someone's workflow. (Otherwise I might also have wanted to change its behaviour based on -legacy-stdio-handling, which would be extra ugly.)
This commit is contained in:
parent
5a9f8c3062
commit
0b4f758e8a
@ -502,10 +502,7 @@ SeatPromptResult console_confirm_weak_cached_hostkey(
|
||||
|
||||
bool is_interactive(void)
|
||||
{
|
||||
ConsoleIO *conio = conio_setup(false, STD_ERROR_HANDLE /* irrelevant */);
|
||||
bool toret = conio->hin_is_console;
|
||||
conio_free(conio);
|
||||
return toret;
|
||||
return is_console_handle(GetStdHandle(STD_INPUT_HANDLE));
|
||||
}
|
||||
|
||||
bool console_antispoof_prompt = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user