diff --git a/unix/uxcons.c b/unix/uxcons.c index 653f868b..fc741b06 100644 --- a/unix/uxcons.c +++ b/unix/uxcons.c @@ -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); diff --git a/windows/wincons.c b/windows/wincons.c index f05d2a84..2badf792 100644 --- a/windows/wincons.c +++ b/windows/wincons.c @@ -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;