X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/6e1ebb76bc65c074b780b303a1f1550f5ae4dd3c..d74d141c2daed084c8a62c5dc5b88e801b81ee5a:/plink.c diff --git a/plink.c b/plink.c index a72a69be..4113a812 100644 --- a/plink.c +++ b/plink.c @@ -59,8 +59,11 @@ void verify_ssh_host_key(char *host, int port, char *keytype, "%s\n" "If you trust this host, enter \"y\" to add the key to\n" "PuTTY's cache and carry on connecting.\n" - "If you do not trust this host, enter \"n\" to abandon the\n" - "connection.\n" "Continue connecting? (y/n) "; + "If you want to carry on connecting just once, without\n" + "adding the key to the cache, enter \"n\".\n" + "If you do not trust this host, press Return to abandon the\n" + "connection.\n" + "Store key in cache? (y/n) "; static const char wrongmsg[] = "WARNING - POTENTIAL SECURITY BREACH!\n" @@ -108,22 +111,12 @@ void verify_ssh_host_key(char *host, int port, char *keytype, ReadFile(hin, line, sizeof(line) - 1, &i, NULL); SetConsoleMode(hin, savemode); - if (ret == 2) { /* key was different */ - if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n') { - if (line[0] == 'y' || line[0] == 'Y') - store_host_key(host, port, keytype, keystr); - } else { - fprintf(stderr, abandoned); - exit(0); - } - } - if (ret == 1) { /* key was absent */ + if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n') { if (line[0] == 'y' || line[0] == 'Y') store_host_key(host, port, keytype, keystr); - else { - fprintf(stderr, abandoned); - exit(0); - } + } else { + fprintf(stderr, abandoned); + exit(0); } } @@ -263,7 +256,7 @@ char *do_select(SOCKET skt, int startup) { int events; if (startup) { - events = FD_READ | FD_WRITE | FD_OOB | FD_CLOSE; + events = FD_READ | FD_WRITE | FD_OOB | FD_CLOSE | FD_ACCEPT; } else { events = 0; } @@ -296,6 +289,12 @@ int main(int argc, char **argv) sklist = NULL; skcount = sksize = 0; + /* + * Initialise port and protocol to sensible defaults. (These + * will be overridden by more or less anything.) + */ + default_protocol = PROT_SSH; + default_port = 22; flags = FLAG_STDERR; /* @@ -650,6 +649,9 @@ int main(int argc, char **argv) connopen &= select_result(wp, (LPARAM) FD_OOB); if (things.lNetworkEvents & FD_WRITE) connopen &= select_result(wp, (LPARAM) FD_WRITE); + if (things.lNetworkEvents & FD_ACCEPT) + connopen &= select_result(wp, (LPARAM) FD_ACCEPT); + } } } else if (n == 1) {