Aha, _that's_ why the icon title didn't work properly in pterm:
[u/mdw/putty] / config.c
CommitLineData
fe8abbf4 1/*
2 * config.c - the platform-independent parts of the PuTTY
3 * configuration box.
4 */
5
6#include <assert.h>
7#include <stdlib.h>
8
9#include "putty.h"
10#include "dialog.h"
11#include "storage.h"
12
13#define PRINTER_DISABLED_STRING "None (printing disabled)"
14
15static void protocolbuttons_handler(union control *ctrl, void *dlg,
16 void *data, int event)
17{
18 int button, defport;
19 Config *cfg = (Config *)data;
20 /*
21 * This function works just like the standard radio-button
22 * handler, except that it also has to change the setting of
23 * the port box. We expect the context parameter to point at
24 * the `union control' structure for the port box.
25 */
26 if (event == EVENT_REFRESH) {
27 for (button = 0; button < ctrl->radio.nbuttons; button++)
28 if (cfg->protocol == ctrl->radio.buttondata[button].i)
29 break;
30 /* We expected that `break' to happen, in all circumstances. */
31 assert(button < ctrl->radio.nbuttons);
32 dlg_radiobutton_set(ctrl, dlg, button);
33 } else if (event == EVENT_VALCHANGE) {
34 int oldproto = cfg->protocol;
35 button = dlg_radiobutton_get(ctrl, dlg);
36 assert(button >= 0 && button < ctrl->radio.nbuttons);
37 cfg->protocol = ctrl->radio.buttondata[button].i;
38 if (oldproto != cfg->protocol) {
39 defport = -1;
40 switch (cfg->protocol) {
41 case PROT_SSH: defport = 22; break;
42 case PROT_TELNET: defport = 23; break;
43 case PROT_RLOGIN: defport = 513; break;
44 }
45 if (defport > 0 && cfg->port != defport) {
46 cfg->port = defport;
47 dlg_refresh((union control *)ctrl->radio.context.p, dlg);
48 }
49 }
50 }
51}
52
53static void numeric_keypad_handler(union control *ctrl, void *dlg,
54 void *data, int event)
55{
56 int button;
57 Config *cfg = (Config *)data;
58 /*
59 * This function works much like the standard radio button
60 * handler, but it has to handle two fields in Config.
61 */
62 if (event == EVENT_REFRESH) {
63 if (cfg->nethack_keypad)
64 button = 2;
65 else if (cfg->app_keypad)
66 button = 1;
67 else
68 button = 0;
69 assert(button < ctrl->radio.nbuttons);
70 dlg_radiobutton_set(ctrl, dlg, button);
71 } else if (event == EVENT_VALCHANGE) {
72 button = dlg_radiobutton_get(ctrl, dlg);
73 assert(button >= 0 && button < ctrl->radio.nbuttons);
74 if (button == 2) {
75 cfg->app_keypad = FALSE;
76 cfg->nethack_keypad = TRUE;
77 } else {
78 cfg->app_keypad = (button != 0);
79 cfg->nethack_keypad = FALSE;
80 }
81 }
82}
83
84static void cipherlist_handler(union control *ctrl, void *dlg,
85 void *data, int event)
86{
87 Config *cfg = (Config *)data;
88 if (event == EVENT_REFRESH) {
89 int i;
90
91 static const struct { char *s; int c; } ciphers[] = {
92 { "3DES", CIPHER_3DES },
93 { "Blowfish", CIPHER_BLOWFISH },
94 { "DES", CIPHER_DES },
95 { "AES (SSH 2 only)", CIPHER_AES },
96 { "-- warn below here --", CIPHER_WARN }
97 };
98
99 /* Set up the "selected ciphers" box. */
100 /* (cipherlist assumed to contain all ciphers) */
101 dlg_update_start(ctrl, dlg);
102 dlg_listbox_clear(ctrl, dlg);
103 for (i = 0; i < CIPHER_MAX; i++) {
104 int c = cfg->ssh_cipherlist[i];
105 int j;
106 char *cstr = NULL;
107 for (j = 0; j < (sizeof ciphers) / (sizeof ciphers[0]); j++) {
108 if (ciphers[j].c == c) {
109 cstr = ciphers[j].s;
110 break;
111 }
112 }
4eaff8d4 113 dlg_listbox_addwithid(ctrl, dlg, cstr, c);
fe8abbf4 114 }
115 dlg_update_done(ctrl, dlg);
116
117 } else if (event == EVENT_VALCHANGE) {
118 int i;
119
120 /* Update array to match the list box. */
121 for (i=0; i < CIPHER_MAX; i++)
122 cfg->ssh_cipherlist[i] = dlg_listbox_getid(ctrl, dlg, i);
123
124 }
125}
126
127static void printerbox_handler(union control *ctrl, void *dlg,
128 void *data, int event)
129{
130 Config *cfg = (Config *)data;
131 if (event == EVENT_REFRESH) {
132 int nprinters, i;
133 printer_enum *pe;
134
135 dlg_update_start(ctrl, dlg);
0f915619 136 /*
137 * Some backends may wish to disable the drop-down list on
138 * this edit box. Be prepared for this.
139 */
140 if (ctrl->editbox.has_list) {
141 dlg_listbox_clear(ctrl, dlg);
142 dlg_listbox_add(ctrl, dlg, PRINTER_DISABLED_STRING);
143 pe = printer_start_enum(&nprinters);
144 for (i = 0; i < nprinters; i++)
145 dlg_listbox_add(ctrl, dlg, printer_get_name(pe, i));
146 printer_finish_enum(pe);
147 }
fe8abbf4 148 dlg_editbox_set(ctrl, dlg,
149 (*cfg->printer ? cfg->printer :
150 PRINTER_DISABLED_STRING));
151 dlg_update_done(ctrl, dlg);
152 } else if (event == EVENT_VALCHANGE) {
153 dlg_editbox_get(ctrl, dlg, cfg->printer, sizeof(cfg->printer));
154 if (!strcmp(cfg->printer, PRINTER_DISABLED_STRING))
155 *cfg->printer = '\0';
156 }
157}
158
159static void codepage_handler(union control *ctrl, void *dlg,
160 void *data, int event)
161{
162 Config *cfg = (Config *)data;
163 if (event == EVENT_REFRESH) {
164 int i;
d4413bd2 165 const char *cp;
fe8abbf4 166 dlg_update_start(ctrl, dlg);
167 strcpy(cfg->line_codepage,
168 cp_name(decode_codepage(cfg->line_codepage)));
169 dlg_listbox_clear(ctrl, dlg);
170 for (i = 0; (cp = cp_enumerate(i)) != NULL; i++)
171 dlg_listbox_add(ctrl, dlg, cp);
172 dlg_editbox_set(ctrl, dlg, cfg->line_codepage);
173 dlg_update_done(ctrl, dlg);
174 } else if (event == EVENT_VALCHANGE) {
175 dlg_editbox_get(ctrl, dlg, cfg->line_codepage,
176 sizeof(cfg->line_codepage));
177 strcpy(cfg->line_codepage,
178 cp_name(decode_codepage(cfg->line_codepage)));
179 }
180}
181
182static void sshbug_handler(union control *ctrl, void *dlg,
183 void *data, int event)
184{
185 if (event == EVENT_REFRESH) {
186 dlg_update_start(ctrl, dlg);
187 dlg_listbox_clear(ctrl, dlg);
4eaff8d4 188 dlg_listbox_addwithid(ctrl, dlg, "Auto", AUTO);
189 dlg_listbox_addwithid(ctrl, dlg, "Off", FORCE_OFF);
190 dlg_listbox_addwithid(ctrl, dlg, "On", FORCE_ON);
fe8abbf4 191 switch (*(int *)ATOFFSET(data, ctrl->listbox.context.i)) {
192 case AUTO: dlg_listbox_select(ctrl, dlg, 0); break;
193 case FORCE_OFF: dlg_listbox_select(ctrl, dlg, 1); break;
194 case FORCE_ON: dlg_listbox_select(ctrl, dlg, 2); break;
195 }
196 dlg_update_done(ctrl, dlg);
197 } else if (event == EVENT_SELCHANGE) {
198 int i = dlg_listbox_index(ctrl, dlg);
199 if (i < 0)
200 i = AUTO;
201 else
202 i = dlg_listbox_getid(ctrl, dlg, i);
203 *(int *)ATOFFSET(data, ctrl->listbox.context.i) = i;
204 }
205}
206
4e6d4091 207#define SAVEDSESSION_LEN 2048
208
fe8abbf4 209struct sessionsaver_data {
210 union control *editbox, *listbox, *loadbutton, *savebutton, *delbutton;
211 union control *okbutton, *cancelbutton;
fe8abbf4 212 struct sesslist *sesslist;
213};
214
215/*
216 * Helper function to load the session selected in the list box, if
217 * any, as this is done in more than one place below. Returns 0 for
218 * failure.
219 */
220static int load_selected_session(struct sessionsaver_data *ssd,
4e6d4091 221 char *savedsession,
fe8abbf4 222 void *dlg, Config *cfg)
223{
224 int i = dlg_listbox_index(ssd->listbox, dlg);
225 int isdef;
226 if (i < 0) {
227 dlg_beep(dlg);
228 return 0;
229 }
230 isdef = !strcmp(ssd->sesslist->sessions[i], "Default Settings");
231 load_settings(ssd->sesslist->sessions[i], !isdef, cfg);
232 if (!isdef) {
4e6d4091 233 strncpy(savedsession, ssd->sesslist->sessions[i],
234 SAVEDSESSION_LEN);
235 savedsession[SAVEDSESSION_LEN-1] = '\0';
fe8abbf4 236 } else {
4e6d4091 237 savedsession[0] = '\0';
fe8abbf4 238 }
239 dlg_refresh(NULL, dlg);
240 /* Restore the selection, which might have been clobbered by
241 * changing the value of the edit box. */
242 dlg_listbox_select(ssd->listbox, dlg, i);
243 return 1;
244}
245
246static void sessionsaver_handler(union control *ctrl, void *dlg,
247 void *data, int event)
248{
249 Config *cfg = (Config *)data;
250 struct sessionsaver_data *ssd =
251 (struct sessionsaver_data *)ctrl->generic.context.p;
4e6d4091 252 char *savedsession;
253
254 /*
255 * The first time we're called in a new dialog, we must
256 * allocate space to store the current contents of the saved
257 * session edit box (since it must persist even when we switch
258 * panels, but is not part of the Config).
56b9b9a7 259 *
260 * Of course, this doesn't need to be done mid-session.
4e6d4091 261 */
56b9b9a7 262 if (!ssd->editbox) {
263 savedsession = NULL;
264 } else if (!dlg_get_privdata(ssd->editbox, dlg)) {
4e6d4091 265 savedsession = (char *)
266 dlg_alloc_privdata(ssd->editbox, dlg, SAVEDSESSION_LEN);
267 savedsession[0] = '\0';
268 } else {
269 savedsession = dlg_get_privdata(ssd->editbox, dlg);
270 }
fe8abbf4 271
272 if (event == EVENT_REFRESH) {
273 if (ctrl == ssd->editbox) {
4e6d4091 274 dlg_editbox_set(ctrl, dlg, savedsession);
fe8abbf4 275 } else if (ctrl == ssd->listbox) {
276 int i;
277 dlg_update_start(ctrl, dlg);
278 dlg_listbox_clear(ctrl, dlg);
279 for (i = 0; i < ssd->sesslist->nsessions; i++)
280 dlg_listbox_add(ctrl, dlg, ssd->sesslist->sessions[i]);
281 dlg_update_done(ctrl, dlg);
282 }
283 } else if (event == EVENT_VALCHANGE) {
284 if (ctrl == ssd->editbox) {
4e6d4091 285 dlg_editbox_get(ctrl, dlg, savedsession,
286 SAVEDSESSION_LEN);
fe8abbf4 287 }
288 } else if (event == EVENT_ACTION) {
289 if (ctrl == ssd->listbox || ctrl == ssd->loadbutton) {
290 /*
291 * The user has double-clicked a session, or hit Load.
292 * We must load the selected session, and then
293 * terminate the configuration dialog _if_ there was a
294 * double-click on the list box _and_ that session
295 * contains a hostname.
296 */
4e6d4091 297 if (load_selected_session(ssd, savedsession, dlg, cfg) &&
fe8abbf4 298 (ctrl == ssd->listbox && cfg->host[0])) {
299 dlg_end(dlg, 1); /* it's all over, and succeeded */
300 }
301 } else if (ctrl == ssd->savebutton) {
4e6d4091 302 int isdef = !strcmp(savedsession, "Default Settings");
303 if (!savedsession[0]) {
8b0cb5aa 304 int i = dlg_listbox_index(ssd->listbox, dlg);
fe8abbf4 305 if (i < 0) {
306 dlg_beep(dlg);
307 return;
308 }
309 isdef = !strcmp(ssd->sesslist->sessions[i], "Default Settings");
310 if (!isdef) {
4e6d4091 311 strncpy(savedsession, ssd->sesslist->sessions[i],
312 SAVEDSESSION_LEN);
313 savedsession[SAVEDSESSION_LEN-1] = '\0';
fe8abbf4 314 } else {
4e6d4091 315 savedsession[0] = '\0';
fe8abbf4 316 }
317 }
3f935d5b 318 {
319 char *errmsg = save_settings(savedsession, !isdef, cfg);
320 if (errmsg) {
321 dlg_error_msg(dlg, errmsg);
322 sfree(errmsg);
323 }
324 }
fe8abbf4 325 get_sesslist(ssd->sesslist, FALSE);
326 get_sesslist(ssd->sesslist, TRUE);
327 dlg_refresh(ssd->editbox, dlg);
328 dlg_refresh(ssd->listbox, dlg);
329 } else if (ctrl == ssd->delbutton) {
6f87d111 330 int i = dlg_listbox_index(ssd->listbox, dlg);
fe8abbf4 331 if (i <= 0) {
332 dlg_beep(dlg);
333 } else {
334 del_settings(ssd->sesslist->sessions[i]);
335 get_sesslist(ssd->sesslist, FALSE);
336 get_sesslist(ssd->sesslist, TRUE);
337 dlg_refresh(ssd->listbox, dlg);
338 }
339 } else if (ctrl == ssd->okbutton) {
56b9b9a7 340 if (!savedsession) {
341 /* In a mid-session Change Settings, Apply is always OK. */
342 dlg_end(dlg, 1);
343 return;
344 }
fe8abbf4 345 /*
346 * Annoying special case. If the `Open' button is
347 * pressed while no host name is currently set, _and_
348 * the session list previously had the focus, _and_
349 * there was a session selected in that which had a
350 * valid host name in it, then load it and go.
351 */
0bd8d76d 352 if (dlg_last_focused(ctrl, dlg) == ssd->listbox && !*cfg->host) {
fe8abbf4 353 Config cfg2;
4e6d4091 354 if (!load_selected_session(ssd, savedsession, dlg, &cfg2)) {
fe8abbf4 355 dlg_beep(dlg);
356 return;
357 }
358 /* If at this point we have a valid session, go! */
359 if (*cfg2.host) {
360 *cfg = cfg2; /* structure copy */
361 dlg_end(dlg, 1);
362 } else
363 dlg_beep(dlg);
364 }
365
366 /*
367 * Otherwise, do the normal thing: if we have a valid
368 * session, get going.
369 */
370 if (*cfg->host) {
371 dlg_end(dlg, 1);
372 } else
373 dlg_beep(dlg);
374 } else if (ctrl == ssd->cancelbutton) {
375 dlg_end(dlg, 0);
376 }
377 }
378}
379
380struct charclass_data {
381 union control *listbox, *editbox, *button;
382};
383
384static void charclass_handler(union control *ctrl, void *dlg,
385 void *data, int event)
386{
387 Config *cfg = (Config *)data;
388 struct charclass_data *ccd =
389 (struct charclass_data *)ctrl->generic.context.p;
390
391 if (event == EVENT_REFRESH) {
392 if (ctrl == ccd->listbox) {
393 int i;
394 dlg_update_start(ctrl, dlg);
395 dlg_listbox_clear(ctrl, dlg);
396 for (i = 0; i < 128; i++) {
397 char str[100];
398 sprintf(str, "%d\t(0x%02X)\t%c\t%d", i, i,
399 (i >= 0x21 && i != 0x7F) ? i : ' ', cfg->wordness[i]);
400 dlg_listbox_add(ctrl, dlg, str);
401 }
402 dlg_update_done(ctrl, dlg);
403 }
404 } else if (event == EVENT_ACTION) {
405 if (ctrl == ccd->button) {
406 char str[100];
407 int i, n;
408 dlg_editbox_get(ccd->editbox, dlg, str, sizeof(str));
409 n = atoi(str);
410 for (i = 0; i < 128; i++) {
411 if (dlg_listbox_issel(ccd->listbox, dlg, i))
412 cfg->wordness[i] = n;
413 }
414 dlg_refresh(ccd->listbox, dlg);
415 }
416 }
417}
418
419struct colour_data {
18c2f87c 420 union control *listbox, *redit, *gedit, *bedit, *button;
fe8abbf4 421};
422
423static const char *const colours[] = {
424 "Default Foreground", "Default Bold Foreground",
425 "Default Background", "Default Bold Background",
426 "Cursor Text", "Cursor Colour",
427 "ANSI Black", "ANSI Black Bold",
428 "ANSI Red", "ANSI Red Bold",
429 "ANSI Green", "ANSI Green Bold",
430 "ANSI Yellow", "ANSI Yellow Bold",
431 "ANSI Blue", "ANSI Blue Bold",
432 "ANSI Magenta", "ANSI Magenta Bold",
433 "ANSI Cyan", "ANSI Cyan Bold",
434 "ANSI White", "ANSI White Bold"
435};
436
437static void colour_handler(union control *ctrl, void *dlg,
438 void *data, int event)
439{
440 Config *cfg = (Config *)data;
441 struct colour_data *cd =
442 (struct colour_data *)ctrl->generic.context.p;
443 int update = FALSE, r, g, b;
444
445 if (event == EVENT_REFRESH) {
446 if (ctrl == cd->listbox) {
447 int i;
448 dlg_update_start(ctrl, dlg);
449 dlg_listbox_clear(ctrl, dlg);
450 for (i = 0; i < lenof(colours); i++)
451 dlg_listbox_add(ctrl, dlg, colours[i]);
452 dlg_update_done(ctrl, dlg);
18c2f87c 453 dlg_editbox_set(cd->redit, dlg, "");
454 dlg_editbox_set(cd->gedit, dlg, "");
455 dlg_editbox_set(cd->bedit, dlg, "");
fe8abbf4 456 }
457 } else if (event == EVENT_SELCHANGE) {
458 if (ctrl == cd->listbox) {
459 /* The user has selected a colour. Update the RGB text. */
460 int i = dlg_listbox_index(ctrl, dlg);
461 if (i < 0) {
462 dlg_beep(dlg);
463 return;
464 }
465 r = cfg->colours[i][0];
466 g = cfg->colours[i][1];
467 b = cfg->colours[i][2];
468 update = TRUE;
469 }
18c2f87c 470 } else if (event == EVENT_VALCHANGE) {
471 if (ctrl == cd->redit || ctrl == cd->gedit || ctrl == cd->bedit) {
472 /* The user has changed the colour using the edit boxes. */
473 char buf[80];
474 int i, cval;
475
476 dlg_editbox_get(ctrl, dlg, buf, lenof(buf));
477 cval = atoi(buf) & 255;
478
479 i = dlg_listbox_index(cd->listbox, dlg);
480 if (i >= 0) {
481 if (ctrl == cd->redit)
482 cfg->colours[i][0] = cval;
483 else if (ctrl == cd->gedit)
484 cfg->colours[i][1] = cval;
485 else if (ctrl == cd->bedit)
486 cfg->colours[i][2] = cval;
487 }
488 }
fe8abbf4 489 } else if (event == EVENT_ACTION) {
490 if (ctrl == cd->button) {
491 int i = dlg_listbox_index(cd->listbox, dlg);
492 if (i < 0) {
493 dlg_beep(dlg);
494 return;
495 }
496 /*
497 * Start a colour selector, which will send us an
498 * EVENT_CALLBACK when it's finished and allow us to
499 * pick up the results.
500 */
501 dlg_coloursel_start(ctrl, dlg,
502 cfg->colours[i][0],
503 cfg->colours[i][1],
504 cfg->colours[i][2]);
505 }
506 } else if (event == EVENT_CALLBACK) {
507 if (ctrl == cd->button) {
508 int i = dlg_listbox_index(cd->listbox, dlg);
509 /*
510 * Collect the results of the colour selector. Will
511 * return nonzero on success, or zero if the colour
512 * selector did nothing (user hit Cancel, for example).
513 */
514 if (dlg_coloursel_results(ctrl, dlg, &r, &g, &b)) {
515 cfg->colours[i][0] = r;
516 cfg->colours[i][1] = g;
517 cfg->colours[i][2] = b;
518 update = TRUE;
519 }
520 }
521 }
522
523 if (update) {
524 char buf[40];
18c2f87c 525 sprintf(buf, "%d", r); dlg_editbox_set(cd->redit, dlg, buf);
526 sprintf(buf, "%d", g); dlg_editbox_set(cd->gedit, dlg, buf);
527 sprintf(buf, "%d", b); dlg_editbox_set(cd->bedit, dlg, buf);
fe8abbf4 528 }
529}
530
531struct environ_data {
532 union control *varbox, *valbox, *addbutton, *rembutton, *listbox;
533};
534
535static void environ_handler(union control *ctrl, void *dlg,
536 void *data, int event)
537{
538 Config *cfg = (Config *)data;
539 struct environ_data *ed =
540 (struct environ_data *)ctrl->generic.context.p;
541
542 if (event == EVENT_REFRESH) {
543 if (ctrl == ed->listbox) {
544 char *p = cfg->environmt;
545 dlg_update_start(ctrl, dlg);
546 dlg_listbox_clear(ctrl, dlg);
547 while (*p) {
548 dlg_listbox_add(ctrl, dlg, p);
549 p += strlen(p) + 1;
550 }
551 dlg_update_done(ctrl, dlg);
552 }
553 } else if (event == EVENT_ACTION) {
554 if (ctrl == ed->addbutton) {
555 char str[sizeof(cfg->environmt)];
556 char *p;
557 dlg_editbox_get(ed->varbox, dlg, str, sizeof(str)-1);
558 if (!*str) {
559 dlg_beep(dlg);
560 return;
561 }
562 p = str + strlen(str);
563 *p++ = '\t';
564 dlg_editbox_get(ed->valbox, dlg, p, sizeof(str)-1 - (p - str));
565 if (!*p) {
566 dlg_beep(dlg);
567 return;
568 }
569 p = cfg->environmt;
570 while (*p) {
571 while (*p)
572 p++;
573 p++;
574 }
575 if ((p - cfg->environmt) + strlen(str) + 2 <
576 sizeof(cfg->environmt)) {
577 strcpy(p, str);
578 p[strlen(str) + 1] = '\0';
579 dlg_listbox_add(ed->listbox, dlg, str);
580 dlg_editbox_set(ed->varbox, dlg, "");
581 dlg_editbox_set(ed->valbox, dlg, "");
582 } else {
583 dlg_error_msg(dlg, "Environment too big");
584 }
585 } else if (ctrl == ed->rembutton) {
586 int i = dlg_listbox_index(ed->listbox, dlg);
587 if (i < 0) {
588 dlg_beep(dlg);
589 } else {
590 char *p, *q;
591
592 dlg_listbox_del(ed->listbox, dlg, i);
593 p = cfg->environmt;
594 while (i > 0) {
595 if (!*p)
596 goto disaster;
597 while (*p)
598 p++;
599 p++;
600 i--;
601 }
602 q = p;
603 if (!*p)
604 goto disaster;
605 while (*p)
606 p++;
607 p++;
608 while (*p) {
609 while (*p)
610 *q++ = *p++;
611 *q++ = *p++;
612 }
613 *q = '\0';
614 disaster:;
615 }
616 }
617 }
618}
619
620struct portfwd_data {
621 union control *addbutton, *rembutton, *listbox;
622 union control *sourcebox, *destbox, *direction;
623};
624
625static void portfwd_handler(union control *ctrl, void *dlg,
626 void *data, int event)
627{
628 Config *cfg = (Config *)data;
629 struct portfwd_data *pfd =
630 (struct portfwd_data *)ctrl->generic.context.p;
631
632 if (event == EVENT_REFRESH) {
633 if (ctrl == pfd->listbox) {
634 char *p = cfg->portfwd;
635 dlg_update_start(ctrl, dlg);
636 dlg_listbox_clear(ctrl, dlg);
637 while (*p) {
638 dlg_listbox_add(ctrl, dlg, p);
639 p += strlen(p) + 1;
640 }
641 dlg_update_done(ctrl, dlg);
07e4d76d 642 } else if (ctrl == pfd->direction) {
643 /*
644 * Default is Local.
645 */
646 dlg_radiobutton_set(ctrl, dlg, 0);
fe8abbf4 647 }
648 } else if (event == EVENT_ACTION) {
649 if (ctrl == pfd->addbutton) {
650 char str[sizeof(cfg->portfwd)];
651 char *p;
820ebe3b 652 int whichbutton = dlg_radiobutton_get(pfd->direction, dlg);
653 if (whichbutton == 0)
fe8abbf4 654 str[0] = 'L';
820ebe3b 655 else if (whichbutton == 1)
fe8abbf4 656 str[0] = 'R';
820ebe3b 657 else
658 str[0] = 'D';
fe8abbf4 659 dlg_editbox_get(pfd->sourcebox, dlg, str+1, sizeof(str) - 2);
660 if (!str[1]) {
661 dlg_error_msg(dlg, "You need to specify a source port number");
662 return;
663 }
664 p = str + strlen(str);
820ebe3b 665 if (str[0] != 'D') {
666 *p++ = '\t';
667 dlg_editbox_get(pfd->destbox, dlg, p,
668 sizeof(str)-1 - (p - str));
669 if (!*p || !strchr(p, ':')) {
670 dlg_error_msg(dlg,
671 "You need to specify a destination address\n"
672 "in the form \"host.name:port\"");
673 return;
674 }
675 } else
676 *p = '\0';
fe8abbf4 677 p = cfg->portfwd;
678 while (*p) {
679 while (*p)
680 p++;
681 p++;
682 }
683 if ((p - cfg->portfwd) + strlen(str) + 2 <
684 sizeof(cfg->portfwd)) {
685 strcpy(p, str);
686 p[strlen(str) + 1] = '\0';
687 dlg_listbox_add(pfd->listbox, dlg, str);
688 dlg_editbox_set(pfd->sourcebox, dlg, "");
689 dlg_editbox_set(pfd->destbox, dlg, "");
690 } else {
691 dlg_error_msg(dlg, "Too many forwardings");
692 }
693 } else if (ctrl == pfd->rembutton) {
694 int i = dlg_listbox_index(pfd->listbox, dlg);
695 if (i < 0)
696 dlg_beep(dlg);
697 else {
698 char *p, *q;
699
700 dlg_listbox_del(pfd->listbox, dlg, i);
701 p = cfg->portfwd;
702 while (i > 0) {
703 if (!*p)
704 goto disaster2;
705 while (*p)
706 p++;
707 p++;
708 i--;
709 }
710 q = p;
711 if (!*p)
712 goto disaster2;
713 while (*p)
714 p++;
715 p++;
716 while (*p) {
717 while (*p)
718 *q++ = *p++;
719 *q++ = *p++;
720 }
721 *q = '\0';
722 disaster2:;
723 }
724 }
725 }
726}
727
728void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
729 int midsession, int protocol)
730{
731 struct controlset *s;
732 struct sessionsaver_data *ssd;
733 struct charclass_data *ccd;
734 struct colour_data *cd;
735 struct environ_data *ed;
736 struct portfwd_data *pfd;
737 union control *c;
f6f450e2 738 char *str;
fe8abbf4 739
740 ssd = (struct sessionsaver_data *)
741 ctrl_alloc(b, sizeof(struct sessionsaver_data));
56b9b9a7 742 memset(ssd, 0, sizeof(*ssd));
fe8abbf4 743 ssd->sesslist = (midsession ? NULL : sesslist);
744
745 /*
746 * The standard panel that appears at the bottom of all panels:
747 * Open, Cancel, Apply etc.
748 */
749 s = ctrl_getset(b, "", "", "");
750 ctrl_columns(s, 5, 20, 20, 20, 20, 20);
751 ssd->okbutton = ctrl_pushbutton(s,
752 (midsession ? "Apply" : "Open"),
753 (char)(midsession ? 'a' : 'o'),
754 HELPCTX(no_help),
755 sessionsaver_handler, P(ssd));
756 ssd->okbutton->button.isdefault = TRUE;
757 ssd->okbutton->generic.column = 3;
758 ssd->cancelbutton = ctrl_pushbutton(s, "Cancel", 'c', HELPCTX(no_help),
759 sessionsaver_handler, P(ssd));
0bd8d76d 760 ssd->cancelbutton->button.iscancel = TRUE;
fe8abbf4 761 ssd->cancelbutton->generic.column = 4;
762 /* We carefully don't close the 5-column part, so that platform-
763 * specific add-ons can put extra buttons alongside Open and Cancel. */
764
765 /*
766 * The Session panel.
767 */
f6f450e2 768 str = dupprintf("Basic options for your %s session", appname);
769 ctrl_settitle(b, "Session", str);
770 sfree(str);
fe8abbf4 771
772 if (!midsession) {
773 s = ctrl_getset(b, "Session", "hostport",
774 "Specify your connection by host name or IP address");
775 ctrl_columns(s, 2, 75, 25);
776 c = ctrl_editbox(s, "Host Name (or IP address)", 'n', 100,
777 HELPCTX(session_hostname),
778 dlg_stdeditbox_handler, I(offsetof(Config,host)),
779 I(sizeof(((Config *)0)->host)));
780 c->generic.column = 0;
781 c = ctrl_editbox(s, "Port", 'p', 100, HELPCTX(session_hostname),
782 dlg_stdeditbox_handler,
783 I(offsetof(Config,port)), I(-1));
784 c->generic.column = 1;
785 ctrl_columns(s, 1, 100);
d9b15094 786 if (backends[3].name == NULL) {
fe8abbf4 787 ctrl_radiobuttons(s, "Protocol:", NO_SHORTCUT, 3,
788 HELPCTX(session_hostname),
789 protocolbuttons_handler, P(c),
790 "Raw", 'r', I(PROT_RAW),
791 "Telnet", 't', I(PROT_TELNET),
792 "Rlogin", 'i', I(PROT_RLOGIN),
793 NULL);
794 } else {
795 ctrl_radiobuttons(s, "Protocol:", NO_SHORTCUT, 4,
796 HELPCTX(session_hostname),
797 protocolbuttons_handler, P(c),
798 "Raw", 'r', I(PROT_RAW),
799 "Telnet", 't', I(PROT_TELNET),
800 "Rlogin", 'i', I(PROT_RLOGIN),
801 "SSH", 's', I(PROT_SSH),
802 NULL);
803 }
804
805 s = ctrl_getset(b, "Session", "savedsessions",
806 "Load, save or delete a stored session");
807 ctrl_columns(s, 2, 75, 25);
fe8abbf4 808 ssd->sesslist = sesslist;
809 ssd->editbox = ctrl_editbox(s, "Saved Sessions", 'e', 100,
810 HELPCTX(session_saved),
811 sessionsaver_handler, P(ssd), P(NULL));
812 ssd->editbox->generic.column = 0;
813 /* Reset columns so that the buttons are alongside the list, rather
814 * than alongside that edit box. */
815 ctrl_columns(s, 1, 100);
816 ctrl_columns(s, 2, 75, 25);
0bd8d76d 817 ssd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
818 HELPCTX(session_saved),
819 sessionsaver_handler, P(ssd));
820 ssd->listbox->generic.column = 0;
821 ssd->listbox->listbox.height = 7;
fe8abbf4 822 ssd->loadbutton = ctrl_pushbutton(s, "Load", 'l',
823 HELPCTX(session_saved),
824 sessionsaver_handler, P(ssd));
825 ssd->loadbutton->generic.column = 1;
826 ssd->savebutton = ctrl_pushbutton(s, "Save", 'v',
827 HELPCTX(session_saved),
828 sessionsaver_handler, P(ssd));
829 ssd->savebutton->generic.column = 1;
830 ssd->delbutton = ctrl_pushbutton(s, "Delete", 'd',
831 HELPCTX(session_saved),
832 sessionsaver_handler, P(ssd));
833 ssd->delbutton->generic.column = 1;
fe8abbf4 834 ctrl_columns(s, 1, 100);
835 }
836
837 s = ctrl_getset(b, "Session", "otheropts", NULL);
838 c = ctrl_radiobuttons(s, "Close window on exit:", 'w', 4,
839 HELPCTX(session_coe),
840 dlg_stdradiobutton_handler,
841 I(offsetof(Config, close_on_exit)),
842 "Always", I(FORCE_ON),
843 "Never", I(FORCE_OFF),
844 "Only on clean exit", I(AUTO), NULL);
845
846 /*
847 * The Session/Logging panel.
848 */
849 ctrl_settitle(b, "Session/Logging", "Options controlling session logging");
850
851 s = ctrl_getset(b, "Session/Logging", "main", NULL);
852 ctrl_radiobuttons(s, "Session logging:", NO_SHORTCUT, 1,
853 HELPCTX(logging_main),
854 dlg_stdradiobutton_handler, I(offsetof(Config, logtype)),
855 "Logging turned off completely", 't', I(LGTYP_NONE),
856 "Log printable output only", 'p', I(LGTYP_ASCII),
857 "Log all session output", 'l', I(LGTYP_DEBUG),
858 "Log SSH packet data", 's', I(LGTYP_PACKETS),
859 NULL);
860 ctrl_filesel(s, "Log file name:", 'f',
861 NULL, TRUE, "Select session log file name",
862 HELPCTX(logging_filename),
863 dlg_stdfilesel_handler, I(offsetof(Config, logfilename)));
864 ctrl_text(s, "(Log file name can contain &Y, &M, &D for date,"
865 " &T for time, and &H for host name)",
866 HELPCTX(logging_filename));
867 ctrl_radiobuttons(s, "What to do if the log file already exists:", 'e', 1,
868 HELPCTX(logging_exists),
869 dlg_stdradiobutton_handler, I(offsetof(Config,logxfovr)),
870 "Always overwrite it", I(LGXF_OVR),
871 "Always append to the end of it", I(LGXF_APN),
872 "Ask the user every time", I(LGXF_ASK), NULL);
873
874 /*
875 * The Terminal panel.
876 */
877 ctrl_settitle(b, "Terminal", "Options controlling the terminal emulation");
878
879 s = ctrl_getset(b, "Terminal", "general", "Set various terminal options");
880 ctrl_checkbox(s, "Auto wrap mode initially on", 'w',
881 HELPCTX(terminal_autowrap),
882 dlg_stdcheckbox_handler, I(offsetof(Config,wrap_mode)));
883 ctrl_checkbox(s, "DEC Origin Mode initially on", 'd',
884 HELPCTX(terminal_decom),
885 dlg_stdcheckbox_handler, I(offsetof(Config,dec_om)));
886 ctrl_checkbox(s, "Implicit CR in every LF", 'r',
887 HELPCTX(terminal_lfhascr),
888 dlg_stdcheckbox_handler, I(offsetof(Config,lfhascr)));
889 ctrl_checkbox(s, "Use background colour to erase screen", 'e',
890 HELPCTX(terminal_bce),
891 dlg_stdcheckbox_handler, I(offsetof(Config,bce)));
892 ctrl_checkbox(s, "Enable blinking text", 'n',
893 HELPCTX(terminal_blink),
894 dlg_stdcheckbox_handler, I(offsetof(Config,blinktext)));
895 ctrl_editbox(s, "Answerback to ^E:", 's', 100,
896 HELPCTX(terminal_answerback),
897 dlg_stdeditbox_handler, I(offsetof(Config,answerback)),
898 I(sizeof(((Config *)0)->answerback)));
899
900 s = ctrl_getset(b, "Terminal", "ldisc", "Line discipline options");
901 ctrl_radiobuttons(s, "Local echo:", 'l', 3,
902 HELPCTX(terminal_localecho),
903 dlg_stdradiobutton_handler,I(offsetof(Config,localecho)),
904 "Auto", I(AUTO),
905 "Force on", I(FORCE_ON),
906 "Force off", I(FORCE_OFF), NULL);
907 ctrl_radiobuttons(s, "Local line editing:", 't', 3,
908 HELPCTX(terminal_localedit),
909 dlg_stdradiobutton_handler,I(offsetof(Config,localedit)),
910 "Auto", I(AUTO),
911 "Force on", I(FORCE_ON),
912 "Force off", I(FORCE_OFF), NULL);
913
914 s = ctrl_getset(b, "Terminal", "printing", "Remote-controlled printing");
915 ctrl_combobox(s, "Printer to send ANSI printer output to:", 'p', 100,
916 HELPCTX(terminal_printing),
917 printerbox_handler, P(NULL), P(NULL));
918
919 /*
920 * The Terminal/Keyboard panel.
921 */
922 ctrl_settitle(b, "Terminal/Keyboard",
923 "Options controlling the effects of keys");
924
925 s = ctrl_getset(b, "Terminal/Keyboard", "mappings",
926 "Change the sequences sent by:");
927 ctrl_radiobuttons(s, "The Backspace key", 'b', 2,
928 HELPCTX(keyboard_backspace),
929 dlg_stdradiobutton_handler,
930 I(offsetof(Config, bksp_is_delete)),
931 "Control-H", I(0), "Control-? (127)", I(1), NULL);
932 ctrl_radiobuttons(s, "The Home and End keys", 'e', 2,
933 HELPCTX(keyboard_homeend),
934 dlg_stdradiobutton_handler,
935 I(offsetof(Config, rxvt_homeend)),
936 "Standard", I(0), "rxvt", I(1), NULL);
937 ctrl_radiobuttons(s, "The Function keys and keypad", 'f', 3,
938 HELPCTX(keyboard_funkeys),
939 dlg_stdradiobutton_handler,
940 I(offsetof(Config, funky_type)),
941 "ESC[n~", I(0), "Linux", I(1), "Xterm R6", I(2),
942 "VT400", I(3), "VT100+", I(4), "SCO", I(5), NULL);
943
944 s = ctrl_getset(b, "Terminal/Keyboard", "appkeypad",
945 "Application keypad settings:");
946 ctrl_radiobuttons(s, "Initial state of cursor keys:", 'r', 3,
947 HELPCTX(keyboard_appcursor),
948 dlg_stdradiobutton_handler,
949 I(offsetof(Config, app_cursor)),
950 "Normal", I(0), "Application", I(1), NULL);
951 ctrl_radiobuttons(s, "Initial state of numeric keypad:", 'n', 3,
952 HELPCTX(keyboard_appkeypad),
953 numeric_keypad_handler, P(NULL),
954 "Normal", I(0), "Application", I(1), "NetHack", I(2),
955 NULL);
956
957 /*
958 * The Terminal/Bell panel.
959 */
960 ctrl_settitle(b, "Terminal/Bell",
961 "Options controlling the terminal bell");
962
963 s = ctrl_getset(b, "Terminal/Bell", "style", "Set the style of bell");
964 ctrl_radiobuttons(s, "Action to happen when a bell occurs:", 'b', 1,
965 HELPCTX(bell_style),
966 dlg_stdradiobutton_handler, I(offsetof(Config, beep)),
967 "None (bell disabled)", I(BELL_DISABLED),
968 "Make default system alert sound", I(BELL_DEFAULT),
969 "Visual bell (flash window)", I(BELL_VISUAL), NULL);
970
971 s = ctrl_getset(b, "Terminal/Bell", "overload",
972 "Control the bell overload behaviour");
973 ctrl_checkbox(s, "Bell is temporarily disabled when over-used", 'd',
974 HELPCTX(bell_overload),
975 dlg_stdcheckbox_handler, I(offsetof(Config,bellovl)));
976 ctrl_editbox(s, "Over-use means this many bells...", 'm', 20,
977 HELPCTX(bell_overload),
978 dlg_stdeditbox_handler, I(offsetof(Config,bellovl_n)), I(-1));
979 ctrl_editbox(s, "... in this many seconds", 't', 20,
980 HELPCTX(bell_overload),
981 dlg_stdeditbox_handler, I(offsetof(Config,bellovl_t)),
62697e04 982 I(-TICKSPERSEC));
fe8abbf4 983 ctrl_text(s, "The bell is re-enabled after a few seconds of silence.",
984 HELPCTX(bell_overload));
985 ctrl_editbox(s, "Seconds of silence required", 's', 20,
986 HELPCTX(bell_overload),
987 dlg_stdeditbox_handler, I(offsetof(Config,bellovl_s)),
62697e04 988 I(-TICKSPERSEC));
fe8abbf4 989
990 /*
991 * The Terminal/Features panel.
992 */
993 ctrl_settitle(b, "Terminal/Features",
994 "Enabling and disabling advanced terminal features");
995
996 s = ctrl_getset(b, "Terminal/Features", "main", NULL);
997 ctrl_checkbox(s, "Disable application cursor keys mode", 'u',
998 HELPCTX(features_application),
999 dlg_stdcheckbox_handler, I(offsetof(Config,no_applic_c)));
1000 ctrl_checkbox(s, "Disable application keypad mode", 'k',
1001 HELPCTX(features_application),
1002 dlg_stdcheckbox_handler, I(offsetof(Config,no_applic_k)));
1003 ctrl_checkbox(s, "Disable xterm-style mouse reporting", 'x',
1004 HELPCTX(features_mouse),
1005 dlg_stdcheckbox_handler, I(offsetof(Config,no_mouse_rep)));
1006 ctrl_checkbox(s, "Disable remote-controlled terminal resizing", 's',
1007 HELPCTX(features_resize),
1008 dlg_stdcheckbox_handler,
1009 I(offsetof(Config,no_remote_resize)));
1010 ctrl_checkbox(s, "Disable switching to alternate terminal screen", 'w',
1011 HELPCTX(features_altscreen),
1012 dlg_stdcheckbox_handler, I(offsetof(Config,no_alt_screen)));
1013 ctrl_checkbox(s, "Disable remote-controlled window title changing", 't',
1014 HELPCTX(features_retitle),
1015 dlg_stdcheckbox_handler,
1016 I(offsetof(Config,no_remote_wintitle)));
7fcdebd3 1017 ctrl_checkbox(s, "Disable remote window title querying (SECURITY)",
1018 'q', HELPCTX(features_qtitle), dlg_stdcheckbox_handler,
1019 I(offsetof(Config,no_remote_qtitle)));
fe8abbf4 1020 ctrl_checkbox(s, "Disable destructive backspace on server sending ^?",'b',
1021 HELPCTX(features_dbackspace),
1022 dlg_stdcheckbox_handler, I(offsetof(Config,no_dbackspace)));
1023 ctrl_checkbox(s, "Disable remote-controlled character set configuration",
1024 'r', HELPCTX(features_charset), dlg_stdcheckbox_handler,
1025 I(offsetof(Config,no_remote_charset)));
1026
1027 /*
1028 * The Window panel.
1029 */
f6f450e2 1030 str = dupprintf("Options controlling %s's window", appname);
1031 ctrl_settitle(b, "Window", str);
1032 sfree(str);
fe8abbf4 1033
1034 s = ctrl_getset(b, "Window", "size", "Set the size of the window");
1035 ctrl_columns(s, 2, 50, 50);
1036 c = ctrl_editbox(s, "Rows", 'r', 100,
1037 HELPCTX(window_size),
1038 dlg_stdeditbox_handler, I(offsetof(Config,height)),I(-1));
1039 c->generic.column = 0;
1040 c = ctrl_editbox(s, "Columns", 'm', 100,
1041 HELPCTX(window_size),
1042 dlg_stdeditbox_handler, I(offsetof(Config,width)), I(-1));
1043 c->generic.column = 1;
1044 ctrl_columns(s, 1, 100);
1045
1046 s = ctrl_getset(b, "Window", "scrollback",
1047 "Control the scrollback in the window");
1048 ctrl_editbox(s, "Lines of scrollback", 's', 50,
1049 HELPCTX(window_scrollback),
1050 dlg_stdeditbox_handler, I(offsetof(Config,savelines)), I(-1));
1051 ctrl_checkbox(s, "Display scrollbar", 'd',
1052 HELPCTX(window_scrollback),
1053 dlg_stdcheckbox_handler, I(offsetof(Config,scrollbar)));
fe8abbf4 1054 ctrl_checkbox(s, "Reset scrollback on keypress", 'k',
1055 HELPCTX(window_scrollback),
1056 dlg_stdcheckbox_handler, I(offsetof(Config,scroll_on_key)));
1057 ctrl_checkbox(s, "Reset scrollback on display activity", 'p',
1058 HELPCTX(window_scrollback),
1059 dlg_stdcheckbox_handler, I(offsetof(Config,scroll_on_disp)));
876e5d5e 1060 ctrl_checkbox(s, "Push erased text into scrollback", 'e',
1061 HELPCTX(window_erased),
1062 dlg_stdcheckbox_handler,
1063 I(offsetof(Config,erase_to_scrollback)));
fe8abbf4 1064
1065 /*
1066 * The Window/Appearance panel.
1067 */
f6f450e2 1068 str = dupprintf("Configure the appearance of %s's window", appname);
1069 ctrl_settitle(b, "Window/Appearance", str);
1070 sfree(str);
fe8abbf4 1071
1072 s = ctrl_getset(b, "Window/Appearance", "cursor",
1073 "Adjust the use of the cursor");
1074 ctrl_radiobuttons(s, "Cursor appearance:", NO_SHORTCUT, 3,
1075 HELPCTX(appearance_cursor),
1076 dlg_stdradiobutton_handler,
1077 I(offsetof(Config, cursor_type)),
1078 "Block", 'l', I(0),
1079 "Underline", 'u', I(1),
1080 "Vertical line", 'v', I(2), NULL);
1081 ctrl_checkbox(s, "Cursor blinks", 'b',
1082 HELPCTX(appearance_cursor),
1083 dlg_stdcheckbox_handler, I(offsetof(Config,blink_cur)));
1084
1085 s = ctrl_getset(b, "Window/Appearance", "font",
1086 "Font settings");
1087 ctrl_fontsel(s, "Font used in the terminal window", 'n',
1088 HELPCTX(appearance_font),
1089 dlg_stdfontsel_handler, I(offsetof(Config, font)));
1090
1091 s = ctrl_getset(b, "Window/Appearance", "mouse",
1092 "Adjust the use of the mouse pointer");
1093 ctrl_checkbox(s, "Hide mouse pointer when typing in window", 'p',
1094 HELPCTX(appearance_hidemouse),
1095 dlg_stdcheckbox_handler, I(offsetof(Config,hide_mouseptr)));
1096
1097 s = ctrl_getset(b, "Window/Appearance", "border",
1098 "Adjust the window border");
1099 ctrl_editbox(s, "Gap between text and window edge:", NO_SHORTCUT, 20,
1100 HELPCTX(appearance_border),
1101 dlg_stdeditbox_handler,
1102 I(offsetof(Config,window_border)), I(-1));
1103
1104 /*
1105 * The Window/Behaviour panel.
1106 */
f6f450e2 1107 str = dupprintf("Configure the behaviour of %s's window", appname);
1108 ctrl_settitle(b, "Window/Behaviour", str);
1109 sfree(str);
fe8abbf4 1110
1111 s = ctrl_getset(b, "Window/Behaviour", "title",
1112 "Adjust the behaviour of the window title");
1113 ctrl_editbox(s, "Window title:", 't', 100,
1114 HELPCTX(appearance_title),
1115 dlg_stdeditbox_handler, I(offsetof(Config,wintitle)),
1116 I(sizeof(((Config *)0)->wintitle)));
1117 ctrl_checkbox(s, "Separate window and icon titles", 'i',
1118 HELPCTX(appearance_title),
1119 dlg_stdcheckbox_handler,
1120 I(CHECKBOX_INVERT | offsetof(Config,win_name_always)));
1121
1122 s = ctrl_getset(b, "Window/Behaviour", "main", NULL);
1123 ctrl_checkbox(s, "Warn before closing window", 'w',
1124 HELPCTX(behaviour_closewarn),
1125 dlg_stdcheckbox_handler, I(offsetof(Config,warn_on_close)));
1126
1127 /*
1128 * The Window/Translation panel.
1129 */
1130 ctrl_settitle(b, "Window/Translation",
1131 "Options controlling character set translation");
1132
1133 s = ctrl_getset(b, "Window/Translation", "trans",
1134 "Character set translation on received data");
1135 ctrl_combobox(s, "Received data assumed to be in which character set:",
1136 'r', 100, HELPCTX(translation_codepage),
1137 codepage_handler, P(NULL), P(NULL));
1138
f6f450e2 1139 str = dupprintf("Adjust how %s displays line drawing characters", appname);
1140 s = ctrl_getset(b, "Window/Translation", "linedraw", str);
1141 sfree(str);
fe8abbf4 1142 ctrl_radiobuttons(s, "Handling of line drawing characters:", NO_SHORTCUT,1,
1143 HELPCTX(translation_linedraw),
1144 dlg_stdradiobutton_handler,
1145 I(offsetof(Config, vtmode)),
1146 "Font has XWindows encoding", 'x', I(VT_XWINDOWS),
1147 "Poor man's line drawing (+, - and |)",'p',I(VT_POORMAN),
1148 "Unicode mode", 'u', I(VT_UNICODE), NULL);
1149
1150 /*
1151 * The Window/Selection panel.
1152 */
1153 ctrl_settitle(b, "Window/Selection", "Options controlling copy and paste");
1154
1155 s = ctrl_getset(b, "Window/Selection", "trans",
1156 "Translation of pasted characters");
931e13e1 1157 ctrl_checkbox(s, "Paste VT100 line drawing chars as lqqqk",'d',
fe8abbf4 1158 HELPCTX(selection_linedraw),
1159 dlg_stdcheckbox_handler, I(offsetof(Config,rawcnp)));
1160
1161 s = ctrl_getset(b, "Window/Selection", "mouse",
1162 "Control use of mouse");
1163 ctrl_checkbox(s, "Shift overrides application's use of mouse", 'p',
1164 HELPCTX(selection_shiftdrag),
1165 dlg_stdcheckbox_handler, I(offsetof(Config,mouse_override)));
1166 ctrl_radiobuttons(s,
1167 "Default selection mode (Alt+drag does the other one):",
1168 NO_SHORTCUT, 2,
1169 HELPCTX(selection_rect),
1170 dlg_stdradiobutton_handler,
1171 I(offsetof(Config, rect_select)),
1172 "Normal", 'n', I(0),
1173 "Rectangular block", 'r', I(1), NULL);
1174
1175 s = ctrl_getset(b, "Window/Selection", "charclass",
1176 "Control the select-one-word-at-a-time mode");
1177 ccd = (struct charclass_data *)
1178 ctrl_alloc(b, sizeof(struct charclass_data));
1179 ccd->listbox = ctrl_listbox(s, "Character classes:", 'e',
1180 HELPCTX(selection_charclasses),
1181 charclass_handler, P(ccd));
1182 ccd->listbox->listbox.multisel = 1;
1183 ccd->listbox->listbox.ncols = 4;
3d88e64d 1184 ccd->listbox->listbox.percentages = snewn(4, int);
fe8abbf4 1185 ccd->listbox->listbox.percentages[0] = 15;
1186 ccd->listbox->listbox.percentages[1] = 25;
1187 ccd->listbox->listbox.percentages[2] = 20;
1188 ccd->listbox->listbox.percentages[3] = 40;
1189 ctrl_columns(s, 2, 67, 33);
1190 ccd->editbox = ctrl_editbox(s, "Set to class", 't', 50,
1191 HELPCTX(selection_charclasses),
1192 charclass_handler, P(ccd), P(NULL));
1193 ccd->editbox->generic.column = 0;
1194 ccd->button = ctrl_pushbutton(s, "Set", 's',
1195 HELPCTX(selection_charclasses),
1196 charclass_handler, P(ccd));
1197 ccd->button->generic.column = 1;
1198 ctrl_columns(s, 1, 100);
1199
1200 /*
1201 * The Window/Colours panel.
1202 */
1203 ctrl_settitle(b, "Window/Colours", "Options controlling use of colours");
1204
1205 s = ctrl_getset(b, "Window/Colours", "general",
1206 "General options for colour usage");
1207 ctrl_checkbox(s, "Bolded text is a different colour", 'b',
1208 HELPCTX(colours_bold),
1209 dlg_stdcheckbox_handler, I(offsetof(Config,bold_colour)));
1210
f6f450e2 1211 str = dupprintf("Adjust the precise colours %s displays", appname);
1212 s = ctrl_getset(b, "Window/Colours", "adjust", str);
1213 sfree(str);
fe8abbf4 1214 ctrl_text(s, "Select a colour from the list, and then click the"
1215 " Modify button to change its appearance.",
1216 HELPCTX(colours_config));
1217 ctrl_columns(s, 2, 67, 33);
1218 cd = (struct colour_data *)ctrl_alloc(b, sizeof(struct colour_data));
1219 cd->listbox = ctrl_listbox(s, "Select a colour to adjust:", 'u',
1220 HELPCTX(colours_config), colour_handler, P(cd));
1221 cd->listbox->generic.column = 0;
18c2f87c 1222 cd->listbox->listbox.height = 7;
fe8abbf4 1223 c = ctrl_text(s, "RGB value:", HELPCTX(colours_config));
1224 c->generic.column = 1;
18c2f87c 1225 cd->redit = ctrl_editbox(s, "Red", 'r', 50, HELPCTX(colours_config),
1226 colour_handler, P(cd), P(NULL));
1227 cd->redit->generic.column = 1;
1228 cd->gedit = ctrl_editbox(s, "Green", 'n', 50, HELPCTX(colours_config),
1229 colour_handler, P(cd), P(NULL));
1230 cd->gedit->generic.column = 1;
1231 cd->bedit = ctrl_editbox(s, "Blue", 'e', 50, HELPCTX(colours_config),
1232 colour_handler, P(cd), P(NULL));
1233 cd->bedit->generic.column = 1;
fe8abbf4 1234 cd->button = ctrl_pushbutton(s, "Modify", 'm', HELPCTX(colours_config),
1235 colour_handler, P(cd));
1236 cd->button->generic.column = 1;
1237 ctrl_columns(s, 1, 100);
1238
1239 /*
1240 * The Connection panel.
1241 */
1242 ctrl_settitle(b, "Connection", "Options controlling the connection");
1243
1244 if (!midsession) {
1245 s = ctrl_getset(b, "Connection", "data", "Data to send to the server");
1246 ctrl_editbox(s, "Terminal-type string", 't', 50,
1247 HELPCTX(connection_termtype),
1248 dlg_stdeditbox_handler, I(offsetof(Config,termtype)),
1249 I(sizeof(((Config *)0)->termtype)));
1250 ctrl_editbox(s, "Auto-login username", 'u', 50,
1251 HELPCTX(connection_username),
1252 dlg_stdeditbox_handler, I(offsetof(Config,username)),
1253 I(sizeof(((Config *)0)->username)));
1254 }
1255
1256 s = ctrl_getset(b, "Connection", "keepalive",
1257 "Sending of null packets to keep session active");
1258 ctrl_editbox(s, "Seconds between keepalives (0 to turn off)", 'k', 20,
1259 HELPCTX(connection_keepalive),
1260 dlg_stdeditbox_handler, I(offsetof(Config,ping_interval)),
1261 I(-1));
1262
1263 if (!midsession) {
1264 s = ctrl_getset(b, "Connection", "tcp",
1265 "Low-level TCP connection options");
1266 ctrl_checkbox(s, "Disable Nagle's algorithm (TCP_NODELAY option)", 'n',
1267 HELPCTX(connection_nodelay),
1268 dlg_stdcheckbox_handler,
1269 I(offsetof(Config,tcp_nodelay)));
1270 }
1271
1272 if (!midsession) {
1273 /*
1274 * The Connection/Proxy panel.
1275 */
1276 ctrl_settitle(b, "Connection/Proxy",
1277 "Options controlling proxy usage");
1278
1279 s = ctrl_getset(b, "Connection/Proxy", "basics", "Proxy basics");
1280 ctrl_radiobuttons(s, "Proxy type:", NO_SHORTCUT, 4,
1281 HELPCTX(proxy_type),
1282 dlg_stdradiobutton_handler,
1283 I(offsetof(Config, proxy_type)),
1284 "None", 'n', I(PROXY_NONE),
1285 "HTTP", 't', I(PROXY_HTTP),
1286 "SOCKS", 's', I(PROXY_SOCKS),
1287 "Telnet", 'l', I(PROXY_TELNET),
1288 NULL);
1289 ctrl_columns(s, 2, 80, 20);
1290 c = ctrl_editbox(s, "Proxy hostname", 'y', 100,
1291 HELPCTX(proxy_main),
1292 dlg_stdeditbox_handler,
1293 I(offsetof(Config,proxy_host)),
1294 I(sizeof(((Config *)0)->proxy_host)));
1295 c->generic.column = 0;
1296 c = ctrl_editbox(s, "Port", 'p', 100,
1297 HELPCTX(proxy_main),
1298 dlg_stdeditbox_handler,
1299 I(offsetof(Config,proxy_port)),
1300 I(-1));
1301 c->generic.column = 1;
1302 ctrl_columns(s, 1, 100);
1303 ctrl_editbox(s, "Exclude Hosts/IPs", 'e', 100,
1304 HELPCTX(proxy_exclude),
1305 dlg_stdeditbox_handler,
1306 I(offsetof(Config,proxy_exclude_list)),
1307 I(sizeof(((Config *)0)->proxy_exclude_list)));
1308 ctrl_checkbox(s, "Consider proxying local host connections", 'x',
1309 HELPCTX(proxy_exclude),
1310 dlg_stdcheckbox_handler,
1311 I(offsetof(Config,even_proxy_localhost)));
1312 ctrl_radiobuttons(s, "Do DNS name lookup at proxy end:", 'd', 3,
1313 HELPCTX(proxy_dns),
1314 dlg_stdradiobutton_handler,
1315 I(offsetof(Config, proxy_dns)),
1316 "No", I(FORCE_OFF),
1317 "Auto", I(AUTO),
1318 "Yes", I(FORCE_ON), NULL);
1319 ctrl_editbox(s, "Username", 'u', 60,
1320 HELPCTX(proxy_auth),
1321 dlg_stdeditbox_handler,
1322 I(offsetof(Config,proxy_username)),
1323 I(sizeof(((Config *)0)->proxy_username)));
1324 c = ctrl_editbox(s, "Password", 'w', 60,
1325 HELPCTX(proxy_auth),
1326 dlg_stdeditbox_handler,
1327 I(offsetof(Config,proxy_password)),
1328 I(sizeof(((Config *)0)->proxy_password)));
1329 c->editbox.password = 1;
1330
1331 s = ctrl_getset(b, "Connection/Proxy", "misc",
1332 "Miscellaneous proxy settings");
1333 ctrl_editbox(s, "Telnet command", 'm', 100,
1334 HELPCTX(proxy_command),
1335 dlg_stdeditbox_handler,
1336 I(offsetof(Config,proxy_telnet_command)),
1337 I(sizeof(((Config *)0)->proxy_telnet_command)));
1338 ctrl_radiobuttons(s, "SOCKS Version", 'v', 2,
1339 HELPCTX(proxy_socksver),
1340 dlg_stdradiobutton_handler,
1341 I(offsetof(Config, proxy_socks_version)),
1342 "Version 5", I(5), "Version 4", I(4), NULL);
1343 }
1344
1345 /*
1346 * The Telnet panel exists in the base config box, and in a
1347 * mid-session reconfig box _if_ we're using Telnet.
1348 */
1349 if (!midsession || protocol == PROT_TELNET) {
1350 /*
1351 * The Connection/Telnet panel.
1352 */
1353 ctrl_settitle(b, "Connection/Telnet",
1354 "Options controlling Telnet connections");
1355
1356 if (!midsession) {
1357 s = ctrl_getset(b, "Connection/Telnet", "data",
1358 "Data to send to the server");
1359 ctrl_editbox(s, "Terminal-speed string", 's', 50,
1360 HELPCTX(telnet_termspeed),
1361 dlg_stdeditbox_handler, I(offsetof(Config,termspeed)),
1362 I(sizeof(((Config *)0)->termspeed)));
1363 ctrl_text(s, "Environment variables:", HELPCTX(telnet_environ));
1364 ctrl_columns(s, 2, 80, 20);
1365 ed = (struct environ_data *)
1366 ctrl_alloc(b, sizeof(struct environ_data));
1367 ed->varbox = ctrl_editbox(s, "Variable", 'v', 60,
1368 HELPCTX(telnet_environ),
1369 environ_handler, P(ed), P(NULL));
1370 ed->varbox->generic.column = 0;
1371 ed->valbox = ctrl_editbox(s, "Value", 'l', 60,
1372 HELPCTX(telnet_environ),
1373 environ_handler, P(ed), P(NULL));
1374 ed->valbox->generic.column = 0;
1375 ed->addbutton = ctrl_pushbutton(s, "Add", 'd',
1376 HELPCTX(telnet_environ),
1377 environ_handler, P(ed));
1378 ed->addbutton->generic.column = 1;
1379 ed->rembutton = ctrl_pushbutton(s, "Remove", 'r',
1380 HELPCTX(telnet_environ),
1381 environ_handler, P(ed));
1382 ed->rembutton->generic.column = 1;
1383 ctrl_columns(s, 1, 100);
1384 ed->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
1385 HELPCTX(telnet_environ),
1386 environ_handler, P(ed));
1387 ed->listbox->listbox.height = 3;
d437fc9d 1388 ed->listbox->listbox.ncols = 2;
3d88e64d 1389 ed->listbox->listbox.percentages = snewn(2, int);
d437fc9d 1390 ed->listbox->listbox.percentages[0] = 30;
1391 ed->listbox->listbox.percentages[1] = 70;
fe8abbf4 1392 }
1393
1394 s = ctrl_getset(b, "Connection/Telnet", "protocol",
1395 "Telnet protocol adjustments");
1396
1397 if (!midsession) {
1398 ctrl_radiobuttons(s, "Handling of OLD_ENVIRON ambiguity:",
1399 NO_SHORTCUT, 2,
1400 HELPCTX(telnet_oldenviron),
1401 dlg_stdradiobutton_handler,
1402 I(offsetof(Config, rfc_environ)),
1403 "BSD (commonplace)", 'b', I(0),
1404 "RFC 1408 (unusual)", 'f', I(1), NULL);
1405 ctrl_radiobuttons(s, "Telnet negotiation mode:", 't', 2,
1406 HELPCTX(telnet_passive),
1407 dlg_stdradiobutton_handler,
1408 I(offsetof(Config, passive_telnet)),
1409 "Passive", I(1), "Active", I(0), NULL);
1410 }
1411 ctrl_checkbox(s, "Keyboard sends telnet Backspace and Interrupt", 'k',
1412 HELPCTX(telnet_specialkeys),
1413 dlg_stdcheckbox_handler,
1414 I(offsetof(Config,telnet_keyboard)));
1415 ctrl_checkbox(s, "Return key sends telnet New Line instead of ^M",
1416 NO_SHORTCUT, HELPCTX(telnet_newline),
1417 dlg_stdcheckbox_handler,
1418 I(offsetof(Config,telnet_newline)));
1419 }
1420
1421 if (!midsession) {
1422
1423 /*
1424 * The Connection/Rlogin panel.
1425 */
1426 ctrl_settitle(b, "Connection/Rlogin",
1427 "Options controlling Rlogin connections");
1428
1429 s = ctrl_getset(b, "Connection/Rlogin", "data",
1430 "Data to send to the server");
1431 ctrl_editbox(s, "Terminal-speed string", 's', 50,
1432 HELPCTX(rlogin_termspeed),
1433 dlg_stdeditbox_handler, I(offsetof(Config,termspeed)),
1434 I(sizeof(((Config *)0)->termspeed)));
1435 ctrl_editbox(s, "Local username:", 'l', 50,
1436 HELPCTX(rlogin_localuser),
1437 dlg_stdeditbox_handler, I(offsetof(Config,localusername)),
1438 I(sizeof(((Config *)0)->localusername)));
1439
1440 }
1441
1442 /*
1443 * All the SSH stuff is omitted in PuTTYtel.
1444 */
1445
d9b15094 1446 if (!midsession && backends[3].name != NULL) {
fe8abbf4 1447
1448 /*
1449 * The Connection/SSH panel.
1450 */
1451 ctrl_settitle(b, "Connection/SSH",
1452 "Options controlling SSH connections");
1453
1454 s = ctrl_getset(b, "Connection/SSH", "data",
1455 "Data to send to the server");
1456 ctrl_editbox(s, "Remote command:", 'r', 100,
1457 HELPCTX(ssh_command),
1458 dlg_stdeditbox_handler, I(offsetof(Config,remote_cmd)),
1459 I(sizeof(((Config *)0)->remote_cmd)));
1460
1461 s = ctrl_getset(b, "Connection/SSH", "protocol", "Protocol options");
1462 ctrl_checkbox(s, "Don't allocate a pseudo-terminal", 'p',
1463 HELPCTX(ssh_nopty),
1464 dlg_stdcheckbox_handler,
1465 I(offsetof(Config,nopty)));
1466 ctrl_checkbox(s, "Enable compression", 'e',
1467 HELPCTX(ssh_compress),
1468 dlg_stdcheckbox_handler,
1469 I(offsetof(Config,compression)));
1470 ctrl_radiobuttons(s, "Preferred SSH protocol version:", NO_SHORTCUT, 4,
1471 HELPCTX(ssh_protocol),
1472 dlg_stdradiobutton_handler,
1473 I(offsetof(Config, sshprot)),
1474 "1 only", 'l', I(0),
1475 "1", '1', I(1),
1476 "2", '2', I(2),
1477 "2 only", 'n', I(3), NULL);
1478
1479 s = ctrl_getset(b, "Connection/SSH", "encryption", "Encryption options");
bb524800 1480 c = ctrl_draglist(s, "Encryption cipher selection policy:", 's',
1481 HELPCTX(ssh_ciphers),
1482 cipherlist_handler, P(NULL));
1483 c->listbox.height = 6;
1484
fe8abbf4 1485 ctrl_checkbox(s, "Enable non-standard use of single-DES in SSH 2", 'i',
1486 HELPCTX(ssh_ciphers),
1487 dlg_stdcheckbox_handler,
1488 I(offsetof(Config,ssh2_des_cbc)));
1489
1490 /*
1491 * The Connection/SSH/Auth panel.
1492 */
1493 ctrl_settitle(b, "Connection/SSH/Auth",
1494 "Options controlling SSH authentication");
1495
1496 s = ctrl_getset(b, "Connection/SSH/Auth", "methods",
1497 "Authentication methods");
1498 ctrl_checkbox(s, "Attempt TIS or CryptoCard auth (SSH1)", 'm',
1499 HELPCTX(ssh_auth_tis),
1500 dlg_stdcheckbox_handler,
1501 I(offsetof(Config,try_tis_auth)));
1502 ctrl_checkbox(s, "Attempt \"keyboard-interactive\" auth (SSH2)",
1503 'i', HELPCTX(ssh_auth_ki),
1504 dlg_stdcheckbox_handler,
1505 I(offsetof(Config,try_ki_auth)));
1506
1507 s = ctrl_getset(b, "Connection/SSH/Auth", "params",
1508 "Authentication parameters");
1509 ctrl_checkbox(s, "Allow agent forwarding", 'f',
1510 HELPCTX(ssh_auth_agentfwd),
1511 dlg_stdcheckbox_handler, I(offsetof(Config,agentfwd)));
1512 ctrl_checkbox(s, "Allow attempted changes of username in SSH2", 'u',
1513 HELPCTX(ssh_auth_changeuser),
1514 dlg_stdcheckbox_handler,
1515 I(offsetof(Config,change_username)));
1516 ctrl_filesel(s, "Private key file for authentication:", 'k',
1517 FILTER_KEY_FILES, FALSE, "Select private key file",
1518 HELPCTX(ssh_auth_privkey),
1519 dlg_stdfilesel_handler, I(offsetof(Config, keyfile)));
1520
1521 /*
1522 * The Connection/SSH/Tunnels panel.
1523 */
1524 ctrl_settitle(b, "Connection/SSH/Tunnels",
1525 "Options controlling SSH tunnelling");
1526
1527 s = ctrl_getset(b, "Connection/SSH/Tunnels", "x11", "X11 forwarding");
1528 ctrl_checkbox(s, "Enable X11 forwarding", 'e',
1529 HELPCTX(ssh_tunnels_x11),
1530 dlg_stdcheckbox_handler,I(offsetof(Config,x11_forward)));
1531 ctrl_editbox(s, "X display location", 'x', 50,
1532 HELPCTX(ssh_tunnels_x11),
1533 dlg_stdeditbox_handler, I(offsetof(Config,x11_display)),
1534 I(sizeof(((Config *)0)->x11_display)));
1535 ctrl_radiobuttons(s, "Remote X11 authentication protocol", 'u', 2,
1536 HELPCTX(ssh_tunnels_x11auth),
1537 dlg_stdradiobutton_handler,
1538 I(offsetof(Config, x11_auth)),
1539 "MIT-Magic-Cookie-1", I(X11_MIT),
1540 "XDM-Authorization-1", I(X11_XDM), NULL);
1541
1542 s = ctrl_getset(b, "Connection/SSH/Tunnels", "portfwd",
1543 "Port forwarding");
1544 ctrl_checkbox(s, "Local ports accept connections from other hosts",'t',
1545 HELPCTX(ssh_tunnels_portfwd_localhost),
1546 dlg_stdcheckbox_handler,
1547 I(offsetof(Config,lport_acceptall)));
1548 ctrl_checkbox(s, "Remote ports do the same (SSH v2 only)", 'p',
1549 HELPCTX(ssh_tunnels_portfwd_localhost),
1550 dlg_stdcheckbox_handler,
1551 I(offsetof(Config,rport_acceptall)));
1552
1553 ctrl_columns(s, 3, 55, 20, 25);
1554 c = ctrl_text(s, "Forwarded ports:", HELPCTX(ssh_tunnels_portfwd));
1555 c->generic.column = COLUMN_FIELD(0,2);
1556 /* You want to select from the list, _then_ hit Remove. So tab order
1557 * should be that way round. */
1558 pfd = (struct portfwd_data *)ctrl_alloc(b,sizeof(struct portfwd_data));
1559 pfd->rembutton = ctrl_pushbutton(s, "Remove", 'r',
1560 HELPCTX(ssh_tunnels_portfwd),
1561 portfwd_handler, P(pfd));
1562 pfd->rembutton->generic.column = 2;
1563 pfd->rembutton->generic.tabdelay = 1;
1564 pfd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
1565 HELPCTX(ssh_tunnels_portfwd),
1566 portfwd_handler, P(pfd));
1567 pfd->listbox->listbox.height = 3;
37dbf11c 1568 pfd->listbox->listbox.ncols = 2;
3d88e64d 1569 pfd->listbox->listbox.percentages = snewn(2, int);
37dbf11c 1570 pfd->listbox->listbox.percentages[0] = 20;
1571 pfd->listbox->listbox.percentages[1] = 80;
fe8abbf4 1572 ctrl_tabdelay(s, pfd->rembutton);
1573 ctrl_text(s, "Add new forwarded port:", HELPCTX(ssh_tunnels_portfwd));
1574 /* You want to enter source, destination and type, _then_ hit Add.
1575 * Again, we adjust the tab order to reflect this. */
1576 pfd->addbutton = ctrl_pushbutton(s, "Add", 'd',
1577 HELPCTX(ssh_tunnels_portfwd),
1578 portfwd_handler, P(pfd));
1579 pfd->addbutton->generic.column = 2;
1580 pfd->addbutton->generic.tabdelay = 1;
1581 pfd->sourcebox = ctrl_editbox(s, "Source port", 's', 40,
1582 HELPCTX(ssh_tunnels_portfwd),
1583 portfwd_handler, P(pfd), P(NULL));
1584 pfd->sourcebox->generic.column = 0;
1585 pfd->destbox = ctrl_editbox(s, "Destination", 'i', 67,
1586 HELPCTX(ssh_tunnels_portfwd),
1587 portfwd_handler, P(pfd), P(NULL));
820ebe3b 1588 pfd->direction = ctrl_radiobuttons(s, NULL, NO_SHORTCUT, 3,
fe8abbf4 1589 HELPCTX(ssh_tunnels_portfwd),
1590 portfwd_handler, P(pfd),
1591 "Local", 'l', P(NULL),
820ebe3b 1592 "Remote", 'm', P(NULL),
1593 "Dynamic", 'y', P(NULL),
1594 NULL);
fe8abbf4 1595 ctrl_tabdelay(s, pfd->addbutton);
1596 ctrl_columns(s, 1, 100);
1597
1598 /*
1599 * The Connection/SSH/Bugs panel.
1600 */
1601 ctrl_settitle(b, "Connection/SSH/Bugs",
1602 "Workarounds for SSH server bugs");
1603
1604 s = ctrl_getset(b, "Connection/SSH/Bugs", "main",
1605 "Detection of known bugs in SSH servers");
1606 ctrl_droplist(s, "Chokes on SSH1 ignore messages", 'i', 20,
1607 HELPCTX(ssh_bugs_ignore1),
1608 sshbug_handler, I(offsetof(Config,sshbug_ignore1)));
1609 ctrl_droplist(s, "Refuses all SSH1 password camouflage", 's', 20,
1610 HELPCTX(ssh_bugs_plainpw1),
1611 sshbug_handler, I(offsetof(Config,sshbug_plainpw1)));
1612 ctrl_droplist(s, "Chokes on SSH1 RSA authentication", 'r', 20,
1613 HELPCTX(ssh_bugs_rsa1),
1614 sshbug_handler, I(offsetof(Config,sshbug_rsa1)));
1615 ctrl_droplist(s, "Miscomputes SSH2 HMAC keys", 'm', 20,
1616 HELPCTX(ssh_bugs_hmac2),
1617 sshbug_handler, I(offsetof(Config,sshbug_hmac2)));
1618 ctrl_droplist(s, "Miscomputes SSH2 encryption keys", 'e', 20,
1619 HELPCTX(ssh_bugs_derivekey2),
1620 sshbug_handler, I(offsetof(Config,sshbug_derivekey2)));
1621 ctrl_droplist(s, "Requires padding on SSH2 RSA signatures", 'p', 20,
1622 HELPCTX(ssh_bugs_rsapad2),
1623 sshbug_handler, I(offsetof(Config,sshbug_rsapad2)));
1624 ctrl_droplist(s, "Chokes on Diffie-Hellman group exchange", 'd', 20,
1625 HELPCTX(ssh_bugs_dhgex2),
1626 sshbug_handler, I(offsetof(Config,sshbug_dhgex2)));
1627 ctrl_droplist(s, "Misuses the session ID in PK auth", 'n', 20,
1628 HELPCTX(ssh_bugs_pksessid2),
1629 sshbug_handler, I(offsetof(Config,sshbug_pksessid2)));
1630 }
1631}