1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Console host key prompt: accept 'q' for 'abandon'.

During testing just now, I found I kept absentmindedly expecting it to
work, and I don't see any reason I shouldn't indulge that expectation.
This commit is contained in:
Simon Tatham 2021-03-07 09:58:15 +00:00
parent cb4f78e611
commit 0bc78dea68
2 changed files with 8 additions and 2 deletions

View File

@ -154,7 +154,10 @@ int console_verify_ssh_host_key(
/* handled below */;
tcsetattr(0, TCSANOW, &oldmode);
if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n') {
/* In case of misplaced reflexes from another program, also recognise 'q'
* as 'abandon connection rather than trust this key' */
if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n' &&
line[0] != 'q' && line[0] != 'Q') {
if (line[0] == 'y' || line[0] == 'Y')
store_host_key(host, port, keytype, keystr);
postmsg(&cf);

View File

@ -83,7 +83,10 @@ int console_verify_ssh_host_key(
ReadFile(hin, line, sizeof(line) - 1, &i, NULL);
SetConsoleMode(hin, savemode);
if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n') {
/* In case of misplaced reflexes from another program, also recognise 'q'
* as 'abandon connection rather than trust this key' */
if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n' &&
line[0] != 'q' && line[0] != 'Q') {
if (line[0] == 'y' || line[0] == 'Y')
store_host_key(host, port, keytype, keystr);
return 1;