X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/e7aabca4fc183293cb2c80e5a1354b2ddf50b1da..d13c2ee931d199203803d9ce1a0029329512f79a:/plink.c diff --git a/plink.c b/plink.c index fc420ef9..7023f9d1 100644 --- a/plink.c +++ b/plink.c @@ -162,6 +162,25 @@ void askcipher(char *ciphername, int cs) } } +/* + * Warn about the obsolescent key file format. + */ +void old_keyfile_warning(void) +{ + static const char message[] = + "You are loading an SSH 2 private key which has an\n" + "old version of the file format. This means your key\n" + "file is not fully tamperproof. Future versions of\n" + "PuTTY may stop supporting this private key format,\n" + "so we recommend you convert your key to the new\n" + "format.\n" + "\n" + "Once the key is loaded into PuTTYgen, you can perform\n" + "this conversion simply by saving it again.\n"; + + fputs(message, stderr); +} + HANDLE inhandle, outhandle, errhandle; DWORD orig_console_mode; @@ -433,6 +452,9 @@ int main(int argc, char **argv) } else if (!strcmp(p, "-telnet")) { default_protocol = cfg.protocol = PROT_TELNET; default_port = cfg.port = 23; + } else if (!strcmp(p, "-rlogin")) { + default_protocol = cfg.protocol = PROT_RLOGIN; + default_port = cfg.port = 513; } else if (!strcmp(p, "-raw")) { default_protocol = cfg.protocol = PROT_RAW; } else if (!strcmp(p, "-v")) { @@ -447,7 +469,7 @@ int main(int argc, char **argv) strncpy(cfg.username, username, sizeof(cfg.username)); cfg.username[sizeof(cfg.username) - 1] = '\0'; } else if ((!strcmp(p, "-L") || !strcmp(p, "-R")) && argc > 1) { - char *fwd, *ptr; + char *fwd, *ptr, *q; int i=0; --argc, fwd = *++argv; ptr = extra_portfwd; @@ -460,7 +482,8 @@ int main(int argc, char **argv) } ptr[0] = p[1]; /* insert a 'L' or 'R' at the start */ strncpy(ptr+1, fwd, sizeof(extra_portfwd) - i); - ptr[strcspn(ptr, ":")] = '\t'; /* replace first : with \t */ + q = strchr(ptr, ':'); + if (q) *q = '\t'; /* replace first : with \t */ ptr[strlen(ptr)+1] = '\000'; /* append two '\000' */ extra_portfwd[sizeof(extra_portfwd) - 1] = '\0'; } else if (!strcmp(p, "-m") && argc > 1) { @@ -715,8 +738,11 @@ int main(int argc, char **argv) { char *error; char *realhost; + /* nodelay is only useful if stdin is a character device (console) */ + int nodelay = cfg.tcp_nodelay && + (GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR); - error = back->init(cfg.host, cfg.port, &realhost); + error = back->init(cfg.host, cfg.port, &realhost, nodelay); if (error) { fprintf(stderr, "Unable to open connection:\n%s", error); return 1;