• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28632 (tree)
Zeit2019-07-21 23:36:16
Autorcsware

Log Message

Apply the TortoisePlink patch and update the project files

Ändern Zusammenfassung

Diff

--- trunk/ext/TortoisePlink/be_all_s.c (revision 28631)
+++ trunk/ext/TortoisePlink/be_all_s.c (revision 28632)
@@ -14,7 +14,7 @@
1414 * have tiny little source modules containing nothing but
1515 * declarations of appname, for as long as I can...
1616 */
17-const char *const appname = "PuTTY";
17+const char *const appname = "TortoisePlink";
1818
1919 #ifdef TELNET_DEFAULT
2020 const int be_default_protocol = PROT_TELNET;
--- trunk/ext/TortoisePlink/cmdline.c (revision 28631)
+++ trunk/ext/TortoisePlink/cmdline.c (revision 28632)
@@ -586,7 +586,7 @@
586586 conf_set_bool(conf, CONF_nopty, true); /* command => no terminal */
587587 strbuf_free(command);
588588 }
589- if (!strcmp(p, "-P")) {
589+ if ((!strcmp(p, "-P"))||(!strcmp(p, "-p"))) {
590590 RETURN(2);
591591 UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
592592 SAVEABLE(1); /* lower priority than -ssh,-telnet */
--- trunk/ext/TortoisePlink/version.h (revision 28631)
+++ trunk/ext/TortoisePlink/version.h (revision 28632)
@@ -1,6 +1,6 @@
11 /* Generated by automated build script */
22 #define RELEASE 0.72
33 #define TEXTVER "Release 0.72"
4-#define SSHVER "-Release-0.72"
4+#define SSHVER "TortoisePlink-Release-0.72"
55 #define BINARY_VERSION 0,72,0,0
66 #define SOURCE_COMMIT "75cd6c8b2703137e574223d90d2f3ead9ca34acc"
--- trunk/ext/TortoisePlink/windows/wincons.c (revision 28631)
+++ trunk/ext/TortoisePlink/windows/wincons.c (revision 28632)
@@ -11,6 +11,8 @@
1111 #include "storage.h"
1212 #include "ssh.h"
1313
14+#include "LoginDialog.h"
15+
1416 bool console_batch_mode = false;
1517
1618 /*
@@ -28,40 +30,17 @@
2830 exit(code);
2931 }
3032
31-/*
32- * Various error message and/or fatal exit functions.
33- */
34-void console_print_error_msg(const char *prefix, const char *msg)
35-{
36- fputs(prefix, stderr);
37- fputs(": ", stderr);
38- fputs(msg, stderr);
39- fputc('\n', stderr);
40- fflush(stderr);
41-}
42-
43-void console_print_error_msg_fmt_v(
44- const char *prefix, const char *fmt, va_list ap)
45-{
46- char *msg = dupvprintf(fmt, ap);
47- console_print_error_msg(prefix, msg);
48- sfree(msg);
49-}
50-
51-void console_print_error_msg_fmt(const char *prefix, const char *fmt, ...)
52-{
53- va_list ap;
54- va_start(ap, fmt);
55- console_print_error_msg_fmt_v(prefix, fmt, ap);
56- va_end(ap);
57-}
58-
5933 void modalfatalbox(const char *fmt, ...)
6034 {
6135 va_list ap;
36+ char *stuff, morestuff[100];
6237 va_start(ap, fmt);
63- console_print_error_msg_fmt_v("FATAL ERROR", fmt, ap);
38+ stuff = dupvprintf(fmt, ap);
6439 va_end(ap);
40+ sprintf(morestuff, "%.70s Fatal Error", appname);
41+ MessageBox(GetParentHwnd(), stuff, morestuff,
42+ MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
43+ sfree(stuff);
6544 cleanup_exit(1);
6645 }
6746
@@ -68,14 +47,22 @@
6847 void nonfatal(const char *fmt, ...)
6948 {
7049 va_list ap;
50+ char *stuff, morestuff[100];
7151 va_start(ap, fmt);
72- console_print_error_msg_fmt_v("ERROR", fmt, ap);
52+ stuff = dupvprintf(fmt, ap);
7353 va_end(ap);
54+ sprintf(morestuff, "%.70s Error", appname);
55+ MessageBox(GetParentHwnd(), stuff, morestuff,
56+ MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
57+ sfree(stuff);
7458 }
7559
7660 void console_connection_fatal(Seat *seat, const char *msg)
7761 {
78- console_print_error_msg("FATAL ERROR", msg);
62+ char morestuff[100];
63+ sprintf(morestuff, "%.70s Fatal Error", appname);
64+ MessageBox(GetParentHwnd(), msg, morestuff,
65+ MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
7966 cleanup_exit(1);
8067 }
8168
@@ -89,8 +76,6 @@
8976 void (*callback)(void *ctx, int result), void *ctx)
9077 {
9178 int ret;
92- HANDLE hin;
93- DWORD savemode, i;
9479
9580 static const char absentmsg_batch[] =
9681 "The server's host key is not cached in the registry. You\n"
@@ -105,13 +90,12 @@
10590 "think it is.\n"
10691 "The server's %s key fingerprint is:\n"
10792 "%s\n"
108- "If you trust this host, enter \"y\" to add the key to\n"
93+ "If you trust this host, hit Yes to add the key to\n"
10994 "PuTTY's cache and carry on connecting.\n"
11095 "If you want to carry on connecting just once, without\n"
111- "adding the key to the cache, enter \"n\".\n"
112- "If you do not trust this host, press Return to abandon the\n"
113- "connection.\n"
114- "Store key in cache? (y/n) ";
96+ "adding the key to the cache, hit No.\n"
97+ "If you do not trust this host, hit Cancel to abandon the\n"
98+ "connection.\n";
11599
116100 static const char wrongmsg_batch[] =
117101 "WARNING - POTENTIAL SECURITY BREACH!\n"
@@ -125,6 +109,7 @@
125109 "Connection abandoned.\n";
126110 static const char wrongmsg[] =
127111 "WARNING - POTENTIAL SECURITY BREACH!\n"
112+ "\n"
128113 "The server's host key does not match the one PuTTY has\n"
129114 "cached in the registry. This means that either the\n"
130115 "server administrator has changed the host key, or you\n"
@@ -133,17 +118,15 @@
133118 "The new %s key fingerprint is:\n"
134119 "%s\n"
135120 "If you were expecting this change and trust the new key,\n"
136- "enter \"y\" to update PuTTY's cache and continue connecting.\n"
121+ "hit Yes to update PuTTY's cache and continue connecting.\n"
137122 "If you want to carry on connecting but without updating\n"
138- "the cache, enter \"n\".\n"
139- "If you want to abandon the connection completely, press\n"
140- "Return to cancel. Pressing Return is the ONLY guaranteed\n"
141- "safe choice.\n"
142- "Update cached key? (y/n, Return cancels connection) ";
123+ "the cache, hit No.\n"
124+ "If you want to abandon the connection completely, hit\n"
125+ "Cancel. Hitting Cancel is the ONLY guaranteed safe\n" "choice.\n";
143126
144127 static const char abandoned[] = "Connection abandoned.\n";
145128
146- char line[32];
129+ static const char mbtitle[] = "%s Security Alert";
147130
148131 /*
149132 * Verify the key against the registry.
@@ -154,39 +137,49 @@
154137 return 1;
155138
156139 if (ret == 2) { /* key was different */
157- if (console_batch_mode) {
158- fprintf(stderr, wrongmsg_batch, keytype, fingerprint);
159- return 0;
140+ int mbret;
141+ char *message, *title;
142+
143+ message = dupprintf(wrongmsg, keytype, fingerprint);
144+ title = dupprintf(mbtitle, appname);
145+
146+ mbret = MessageBox(GetParentHwnd(), message, title, MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON3);
147+ sfree(message);
148+ sfree(title);
149+ if (mbret == IDYES) {
150+ store_host_key(host, port, keytype, keystr);
151+ return 1;
160152 }
161- fprintf(stderr, wrongmsg, keytype, fingerprint);
162- fflush(stderr);
163- }
153+ else if (mbret == IDNO)
154+ {
155+ return 1;
156+ }
157+ else
158+ return 0;
159+ }
160+
164161 if (ret == 1) { /* key was absent */
165- if (console_batch_mode) {
166- fprintf(stderr, absentmsg_batch, keytype, fingerprint);
167- return 0;
162+ int mbret;
163+ char *message, *title;
164+ message = dupprintf(absentmsg, keytype, fingerprint);
165+ title = dupprintf(mbtitle, appname);
166+ mbret = MessageBox(GetParentHwnd(), message, title,
167+ MB_ICONWARNING | MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON3);
168+ sfree(message);
169+ sfree(title);
170+ if (mbret == IDYES)
171+ {
172+ store_host_key(host, port, keytype, keystr);
173+ return 1;
168174 }
169- fprintf(stderr, absentmsg, keytype, fingerprint);
170- fflush(stderr);
175+ else if (mbret == IDNO)
176+ {
177+ return 1;
178+ }
179+ else
180+ return 0;
171181 }
172-
173- line[0] = '\0'; /* fail safe if ReadFile returns no data */
174-
175- hin = GetStdHandle(STD_INPUT_HANDLE);
176- GetConsoleMode(hin, &savemode);
177- SetConsoleMode(hin, (savemode | ENABLE_ECHO_INPUT |
178- ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT));
179- ReadFile(hin, line, sizeof(line) - 1, &i, NULL);
180- SetConsoleMode(hin, savemode);
181-
182- if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n') {
183- if (line[0] == 'y' || line[0] == 'Y')
184- store_host_key(host, port, keytype, keystr);
185- return 1;
186- } else {
187- fprintf(stderr, abandoned);
188- return 0;
189- }
182+ return 1;
190183 }
191184
192185 int console_confirm_weak_crypto_primitive(
@@ -193,42 +186,26 @@
193186 Seat *seat, const char *algtype, const char *algname,
194187 void (*callback)(void *ctx, int result), void *ctx)
195188 {
196- HANDLE hin;
197- DWORD savemode, i;
198-
199189 static const char msg[] =
200190 "The first %s supported by the server is\n"
201191 "%s, which is below the configured warning threshold.\n"
202192 "Continue with connection? (y/n) ";
203- static const char msg_batch[] =
204- "The first %s supported by the server is\n"
205- "%s, which is below the configured warning threshold.\n"
206- "Connection abandoned.\n";
207- static const char abandoned[] = "Connection abandoned.\n";
208193
209- char line[32];
194+ static const char mbtitle[] = "%s Security Alert";
210195
211- if (console_batch_mode) {
212- fprintf(stderr, msg_batch, algtype, algname);
213- return 0;
214- }
196+ int mbret;
197+ char *message, *title;
215198
216- fprintf(stderr, msg, algtype, algname);
217- fflush(stderr);
199+ message = dupprintf(msg, algtype, algname);
200+ title = dupprintf(mbtitle, appname);
218201
219- hin = GetStdHandle(STD_INPUT_HANDLE);
220- GetConsoleMode(hin, &savemode);
221- SetConsoleMode(hin, (savemode | ENABLE_ECHO_INPUT |
222- ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT));
223- ReadFile(hin, line, sizeof(line) - 1, &i, NULL);
224- SetConsoleMode(hin, savemode);
225-
226- if (line[0] == 'y' || line[0] == 'Y') {
227- return 1;
228- } else {
229- fprintf(stderr, abandoned);
230- return 0;
231- }
202+ mbret = MessageBox(GetParentHwnd(), message, title, MB_ICONWARNING|MB_YESNO);
203+ sfree(message);
204+ sfree(title);
205+ if (mbret == IDYES)
206+ return 1;
207+ else
208+ return 0;
232209 }
233210
234211 int console_confirm_weak_cached_hostkey(
@@ -256,25 +233,20 @@
256233
257234 char line[32];
258235
259- if (console_batch_mode) {
260- fprintf(stderr, msg_batch, algname, betteralgs);
261- return 0;
262- }
236+ int mbret;
237+ char *message, *title;
238+ static const char mbtitle[] = "%s Security Alert";
263239
264- fprintf(stderr, msg, algname, betteralgs);
265- fflush(stderr);
240+ message = dupprintf(msg, algname, betteralgs);
241+ title = dupprintf(mbtitle, appname);
266242
267- hin = GetStdHandle(STD_INPUT_HANDLE);
268- GetConsoleMode(hin, &savemode);
269- SetConsoleMode(hin, (savemode | ENABLE_ECHO_INPUT |
270- ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT));
271- ReadFile(hin, line, sizeof(line) - 1, &i, NULL);
272- SetConsoleMode(hin, savemode);
243+ mbret = MessageBox(GetParentHwnd(), message, title, MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON3);
244+ sfree(message);
245+ sfree(title);
273246
274- if (line[0] == 'y' || line[0] == 'Y') {
247+ if (mbret == IDYES) {
275248 return 1;
276249 } else {
277- fprintf(stderr, abandoned);
278250 return 0;
279251 }
280252 }
@@ -332,25 +304,20 @@
332304 "Logging will not be enabled.\n";
333305
334306 char line[32];
307+ int mbret;
308+ char *message, *title;
309+ static const char mbtitle[] = "%s Session log";
335310
336- if (console_batch_mode) {
337- fprintf(stderr, msgtemplate_batch, FILENAME_MAX, filename->path);
338- fflush(stderr);
339- return 0;
340- }
341- fprintf(stderr, msgtemplate, FILENAME_MAX, filename->path);
342- fflush(stderr);
311+ message = dupprintf(msgtemplate, FILENAME_MAX, filename->path);
312+ title = dupprintf(mbtitle, appname);
343313
344- hin = GetStdHandle(STD_INPUT_HANDLE);
345- GetConsoleMode(hin, &savemode);
346- SetConsoleMode(hin, (savemode | ENABLE_ECHO_INPUT |
347- ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT));
348- ReadFile(hin, line, sizeof(line) - 1, &i, NULL);
349- SetConsoleMode(hin, savemode);
314+ mbret = MessageBox(GetParentHwnd(), message, title, MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON3);
315+ sfree(message);
316+ sfree(title);
350317
351- if (line[0] == 'y' || line[0] == 'Y')
318+ if (mbret == IDYES)
352319 return 2;
353- else if (line[0] == 'n' || line[0] == 'N')
320+ else if (mbret == IDNO)
354321 return 1;
355322 else
356323 return 0;
@@ -430,7 +397,6 @@
430397
431398 int console_get_userpass_input(prompts_t *p)
432399 {
433- HANDLE hin = INVALID_HANDLE_VALUE, hout = INVALID_HANDLE_VALUE;
434400 size_t curr_prompt;
435401
436402 /*
@@ -442,97 +408,13 @@
442408 prompt_set_result(p->prompts[i], "");
443409 }
444410
445- /*
446- * The prompts_t might contain a message to be displayed but no
447- * actual prompt. More usually, though, it will contain
448- * questions that the user needs to answer, in which case we
449- * need to ensure that we're able to get the answers.
450- */
451- if (p->n_prompts) {
452- if (console_batch_mode)
453- return 0;
454- hin = GetStdHandle(STD_INPUT_HANDLE);
455- if (hin == INVALID_HANDLE_VALUE) {
456- fprintf(stderr, "Cannot get standard input handle\n");
457- cleanup_exit(1);
458- }
459- }
411+ if (console_batch_mode)
412+ return 0;
460413
461- /*
462- * And if we have anything to print, we need standard output.
463- */
464- if ((p->name_reqd && p->name) || p->instruction || p->n_prompts) {
465- hout = GetStdHandle(STD_OUTPUT_HANDLE);
466- if (hout == INVALID_HANDLE_VALUE) {
467- fprintf(stderr, "Cannot get standard output handle\n");
468- cleanup_exit(1);
469- }
470- }
471-
472- /*
473- * Preamble.
474- */
475- /* We only print the `name' caption if we have to... */
476- if (p->name_reqd && p->name) {
477- ptrlen plname = ptrlen_from_asciz(p->name);
478- console_write(hout, plname);
479- if (!ptrlen_endswith(plname, PTRLEN_LITERAL("\n"), NULL))
480- console_write(hout, PTRLEN_LITERAL("\n"));
481- }
482- /* ...but we always print any `instruction'. */
483- if (p->instruction) {
484- ptrlen plinst = ptrlen_from_asciz(p->instruction);
485- console_write(hout, plinst);
486- if (!ptrlen_endswith(plinst, PTRLEN_LITERAL("\n"), NULL))
487- console_write(hout, PTRLEN_LITERAL("\n"));
488- }
489-
490414 for (curr_prompt = 0; curr_prompt < p->n_prompts; curr_prompt++) {
491-
492- DWORD savemode, newmode;
493- size_t len;
494415 prompt_t *pr = p->prompts[curr_prompt];
495-
496- GetConsoleMode(hin, &savemode);
497- newmode = savemode | ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT;
498- if (!pr->echo)
499- newmode &= ~ENABLE_ECHO_INPUT;
500- else
501- newmode |= ENABLE_ECHO_INPUT;
502- SetConsoleMode(hin, newmode);
503-
504- console_write(hout, ptrlen_from_asciz(pr->prompt));
505-
506- len = 0;
507- while (1) {
508- DWORD ret = 0;
509-
510- prompt_ensure_result_size(pr, len * 5 / 4 + 512);
511-
512- if (!ReadFile(hin, pr->result + len, pr->resultsize - len - 1,
513- &ret, NULL) || ret == 0) {
514- len = (size_t)-1;
515- break;
516- }
517- len += ret;
518- if (pr->result[len - 1] == '\n') {
519- len--;
520- if (pr->result[len - 1] == '\r')
521- len--;
522- break;
523- }
524- }
525-
526- SetConsoleMode(hin, savemode);
527-
528- if (!pr->echo)
529- console_write(hout, PTRLEN_LITERAL("\r\n"));
530-
531- if (len == (size_t)-1) {
532- return 0; /* failure due to read error */
533- }
534-
535- pr->result[len] = '\0';
416+ if (!DoLoginDialog(pr->result, pr->resultsize-1, pr->prompt))
417+ return 0;
536418 }
537419
538420 return 1; /* success */
--- trunk/ext/TortoisePlink/windows/winplink.c (revision 28631)
+++ trunk/ext/TortoisePlink/windows/winplink.c (revision 28632)
@@ -15,6 +15,10 @@
1515
1616 #define WM_AGENT_CALLBACK (WM_APP + 4)
1717
18+#include <commctrl.h>
19+#pragma comment(lib, "comctl32.lib")
20+#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
21+
1822 struct agent_callback {
1923 void (*callback)(void *, void *, int);
2024 void *callback_ctx;
@@ -24,11 +28,15 @@
2428
2529 void cmdline_error(const char *fmt, ...)
2630 {
27- va_list ap;
28- va_start(ap, fmt);
29- console_print_error_msg_fmt_v("plink", fmt, ap);
30- va_end(ap);
31- exit(1);
31+ va_list ap;
32+ char *stuff, morestuff[100];
33+ va_start(ap, fmt);
34+ stuff = dupvprintf(fmt, ap);
35+ va_end(ap);
36+ sprintf(morestuff, "%.70s Command Line Error", appname);
37+ MessageBox(GetParentHwnd(), stuff, morestuff, MB_ICONERROR | MB_OK);
38+ sfree(stuff);
39+ exit(1);
3240 }
3341
3442 HANDLE inhandle, outhandle, errhandle;
@@ -124,69 +132,74 @@
124132 */
125133 static void usage(void)
126134 {
127- printf("Plink: command-line connection utility\n");
128- printf("%s\n", ver);
129- printf("Usage: plink [options] [user@]host [command]\n");
130- printf(" (\"host\" can also be a PuTTY saved session name)\n");
131- printf("Options:\n");
132- printf(" -V print version information and exit\n");
133- printf(" -pgpfp print PGP key fingerprints and exit\n");
134- printf(" -v show verbose messages\n");
135- printf(" -load sessname Load settings from saved session\n");
136- printf(" -ssh -telnet -rlogin -raw -serial\n");
137- printf(" force use of a particular protocol\n");
138- printf(" -P port connect to specified port\n");
139- printf(" -l user connect with specified username\n");
140- printf(" -batch disable all interactive prompts\n");
141- printf(" -proxycmd command\n");
142- printf(" use 'command' as local proxy\n");
143- printf(" -sercfg configuration-string (e.g. 19200,8,n,1,X)\n");
144- printf(" Specify the serial configuration (serial only)\n");
145- printf("The following options only apply to SSH connections:\n");
146- printf(" -pw passw login with specified password\n");
147- printf(" -D [listen-IP:]listen-port\n");
148- printf(" Dynamic SOCKS-based port forwarding\n");
149- printf(" -L [listen-IP:]listen-port:host:port\n");
150- printf(" Forward local port to remote address\n");
151- printf(" -R [listen-IP:]listen-port:host:port\n");
152- printf(" Forward remote port to local address\n");
153- printf(" -X -x enable / disable X11 forwarding\n");
154- printf(" -A -a enable / disable agent forwarding\n");
155- printf(" -t -T enable / disable pty allocation\n");
156- printf(" -1 -2 force use of particular protocol version\n");
157- printf(" -4 -6 force use of IPv4 or IPv6\n");
158- printf(" -C enable compression\n");
159- printf(" -i key private key file for user authentication\n");
160- printf(" -noagent disable use of Pageant\n");
161- printf(" -agent enable use of Pageant\n");
162- printf(" -noshare disable use of connection sharing\n");
163- printf(" -share enable use of connection sharing\n");
164- printf(" -hostkey aa:bb:cc:...\n");
165- printf(" manually specify a host key (may be repeated)\n");
166- printf(" -sanitise-stderr, -sanitise-stdout, "
167- "-no-sanitise-stderr, -no-sanitise-stdout\n");
168- printf(" do/don't strip control chars from standard "
169- "output/error\n");
170- printf(" -no-antispoof omit anti-spoofing prompt after "
171- "authentication\n");
172- printf(" -m file read remote command(s) from file\n");
173- printf(" -s remote command is an SSH subsystem (SSH-2 only)\n");
174- printf(" -N don't start a shell/command (SSH-2 only)\n");
175- printf(" -nc host:port\n");
176- printf(" open tunnel in place of session (SSH-2 only)\n");
177- printf(" -sshlog file\n");
178- printf(" -sshrawlog file\n");
179- printf(" log protocol details to a file\n");
180- printf(" -shareexists\n");
181- printf(" test whether a connection-sharing upstream exists\n");
135+ char buf[10000];
136+ int j = 0;
137+ j += sprintf(buf+j, "TortoisePlink: command-line connection utility (based on PuTTY Plink)\n");
138+ j += sprintf(buf+j, "%s\n", ver);
139+ j += sprintf(buf+j, "Usage: tortoiseplink [options] [user@]host [command]\n");
140+ j += sprintf(buf+j, " (\"host\" can also be a PuTTY saved session name)\n");
141+ j += sprintf(buf+j, "Options:\n");
142+ j += sprintf(buf+j, " -V print version information and exit\n");
143+ j += sprintf(buf+j, " -pgpfp print PGP key fingerprints and exit\n");
144+ j += sprintf(buf+j, " -v show verbose messages\n");
145+ j += sprintf(buf+j, " -load sessname Load settings from saved session\n");
146+ j += sprintf(buf+j, " -ssh -telnet -rlogin -raw -serial\n");
147+ j += sprintf(buf+j, " force use of a particular protocol\n");
148+ j += sprintf(buf+j, " -P port connect to specified port\n");
149+ j += sprintf(buf+j, " -l user connect with specified username\n");
150+ j += sprintf(buf+j, " -batch disable all interactive prompts\n");
151+ j += sprintf(buf+j, " -proxycmd command\n");
152+ j += sprintf(buf+j, " use 'command' as local proxy\n");
153+ j += sprintf(buf+j, " -sercfg configuration-string (e.g. 19200,8,n,1,X)\n");
154+ j += sprintf(buf+j, " Specify the serial configuration (serial only)\n");
155+ j += sprintf(buf+j, "The following options only apply to SSH connections:\n");
156+ j += sprintf(buf+j, " -pw passw login with specified password\n");
157+ j += sprintf(buf+j, " -D [listen-IP:]listen-port\n");
158+ j += sprintf(buf+j, " Dynamic SOCKS-based port forwarding\n");
159+ j += sprintf(buf+j, " -L [listen-IP:]listen-port:host:port\n");
160+ j += sprintf(buf+j, " Forward local port to remote address\n");
161+ j += sprintf(buf+j, " -R [listen-IP:]listen-port:host:port\n");
162+ j += sprintf(buf+j, " Forward remote port to local address\n");
163+ j += sprintf(buf+j, " -X -x enable / disable X11 forwarding\n");
164+ j += sprintf(buf+j, " -A -a enable / disable agent forwarding\n");
165+ j += sprintf(buf+j, " -t -T enable / disable pty allocation\n");
166+ j += sprintf(buf+j, " -1 -2 force use of particular protocol version\n");
167+ j += sprintf(buf+j, " -4 -6 force use of IPv4 or IPv6\n");
168+ j += sprintf(buf+j, " -C enable compression\n");
169+ j += sprintf(buf+j, " -i key private key file for user authentication\n");
170+ j += sprintf(buf+j, " -noagent disable use of Pageant\n");
171+ j += sprintf(buf+j, " -agent enable use of Pageant\n");
172+ j += sprintf(buf+j, " -noshare disable use of connection sharing\n");
173+ j += sprintf(buf+j, " -share enable use of connection sharing\n");
174+ j += sprintf(buf+j, " -hostkey aa:bb:cc:...\n");
175+ j += sprintf(buf+j, " manually specify a host key (may be repeated)\n");
176+ j += sprintf(buf+j, " -sanitise-stderr, -sanitise-stdout,\n");
177+ j += sprintf(buf+j, " -no-sanitise-stderr, -no-sanitise-stdout\n");
178+ j += sprintf(buf+j, " do/don't strip control chars from standard\n");
179+ j += sprintf(buf+j, " output/error\n");
180+ j += sprintf(buf+j, " -no-antispoof omit anti-spoofing prompt after\n");
181+ j += sprintf(buf+j, " authentication\n");
182+ j += sprintf(buf+j, " -m file read remote command(s) from file\n");
183+ j += sprintf(buf+j, " -s remote command is an SSH subsystem (SSH-2 only)\n");
184+ j += sprintf(buf+j, " -N don't start a shell/command (SSH-2 only)\n");
185+ j += sprintf(buf+j, " -nc host:port\n");
186+ j += sprintf(buf+j, " open tunnel in place of session (SSH-2 only)\n");
187+ j += sprintf(buf+j, " -sshlog file\n");
188+ j += sprintf(buf+j, " -sshrawlog file\n");
189+ j += sprintf(buf+j, " log protocol details to a file\n");
190+ j += sprintf(buf+j, " -shareexists\n");
191+ j += sprintf(buf+j, " test whether a connection-sharing upstream exists\n");
192+ MessageBox(NULL, buf, "TortoisePlink", MB_ICONINFORMATION);
182193 exit(1);
183194 }
184195
185196 static void version(void)
186197 {
198+ char buf[1000];
187199 char *buildinfo_text = buildinfo("\n");
188- printf("plink: %s\n%s\n", ver, buildinfo_text);
200+ sprintf(buf, "TortoisePlink: %s\n%s\n", ver, buildinfo_text);
189201 sfree(buildinfo_text);
202+ MessageBox(NULL, buf, "TortoisePlink", MB_ICONINFORMATION);
190203 exit(0);
191204 }
192205
@@ -273,6 +286,7 @@
273286
274287 dll_hijacking_protection();
275288
289+ InitCommonControls();
276290 sklist = NULL;
277291 skcount = sksize = 0;
278292 /*
@@ -295,24 +309,11 @@
295309 conf = conf_new();
296310 do_defaults(NULL, conf);
297311 loaded_session = false;
298- default_protocol = conf_get_int(conf, CONF_protocol);
299- default_port = conf_get_int(conf, CONF_port);
300312 errors = false;
301- {
302- /*
303- * Override the default protocol if PLINK_PROTOCOL is set.
304- */
305- char *p = getenv("PLINK_PROTOCOL");
306- if (p) {
307- const struct BackendVtable *vt = backend_vt_from_name(p);
308- if (vt) {
309- default_protocol = vt->protocol;
310- default_port = vt->default_port;
311- conf_set_int(conf, CONF_protocol, default_protocol);
312- conf_set_int(conf, CONF_port, default_port);
313- }
314- }
315- }
313+ conf_set_int(conf, CONF_protocol, default_protocol);
314+ conf_set_int(conf, CONF_port, default_port);
315+ conf_set_bool(conf, CONF_agentfwd, FALSE);
316+ conf_set_bool(conf, CONF_x11_forward, FALSE);
316317 while (--argc) {
317318 char *p = *++argv;
318319 int ret = cmdline_process_param(p, (argc > 1 ? argv[1] : NULL),
@@ -319,7 +320,7 @@
319320 1, conf);
320321 if (ret == -2) {
321322 fprintf(stderr,
322- "plink: option \"%s\" requires an argument\n", p);
323+ "TortoisePlink: option \"%s\" requires an argument\n", p);
323324 errors = true;
324325 } else if (ret == 2) {
325326 --argc, ++argv;
@@ -326,7 +327,7 @@
326327 } else if (ret == 1) {
327328 continue;
328329 } else if (!strcmp(p, "-batch")) {
329- console_batch_mode = true;
330+ // ignore and do not print an error message
330331 } else if (!strcmp(p, "-s")) {
331332 /* Save status to write to conf later. */
332333 use_subsystem = true;
@@ -371,7 +372,7 @@
371372 strbuf_free(cmdbuf);
372373 break; /* done with cmdline */
373374 } else {
374- fprintf(stderr, "plink: unknown option \"%s\"\n", p);
375+ fprintf(stderr, "TortoisePlink: unknown option \"%s\"\n", p);
375376 errors = true;
376377 }
377378 }
@@ -414,7 +415,7 @@
414415
415416 sk_init();
416417 if (p_WSAEventSelect == NULL) {
417- fprintf(stderr, "Plink requires WinSock 2\n");
418+ fprintf(stderr, "TortoisePlink requires WinSock 2\n");
418419 return 1;
419420 }
420421
Show on old repository browser