]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Loose end from r5031: the Kex panel should only be displayed in
authorSimon Tatham <anakin@pobox.com>
Wed, 29 Dec 2004 12:32:25 +0000 (12:32 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 29 Dec 2004 12:32:25 +0000 (12:32 +0000)
mid-session if we are not using SSHv1. I've done this by introducing
a generic `cfg_info' function which every back end can use to
communicate an int's worth of data to setup_config_box; in SSH
that's the protocol version in use, and in everything else it's
currently zero.

[originally from svn r5040]
[r5031 == d77102a8d535a7000d6d909529a61a1564f6d678]

16 files changed:
config.c
mac/macdlg.c
putty.h
raw.c
rlogin.c
ssh.c
telnet.c
testback.c
unix/gtkdlg.c
unix/pterm.c
unix/pty.c
unix/unix.h
unix/uxputty.c
windows/windlg.c
windows/window.c
windows/winstuff.h

index 6d918c2c5ef93fa0847cdc03c9dae344e917ffb4..6a5961c457e1fa7857125735e2c1d947c0dbef95 100644 (file)
--- a/config.c
+++ b/config.c
@@ -770,7 +770,7 @@ static void portfwd_handler(union control *ctrl, void *dlg,
 }
 
 void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
-                     int midsession, int protocol)
+                     int midsession, int protocol, int protcfginfo)
 {
     struct controlset *s;
     struct sessionsaver_data *ssd;
@@ -1583,33 +1583,36 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
 
        /*
         * The Connection/SSH/Kex panel. (Owing to repeat key
-        * exchange, this is all meaningful in mid-session.)
+        * exchange, this is all meaningful in mid-session _if_
+        * we're using SSH2 or haven't decided yet.)
         */
-       ctrl_settitle(b, "Connection/SSH/Kex",
-                     "Options controlling SSH key exchange");
-
-       s = ctrl_getset(b, "Connection/SSH/Kex", "main",
-                       "Key exchange algorithm options");
-       c = ctrl_draglist(s, "Algorithm selection policy", 's',
-                         HELPCTX(ssh_kexlist),
-                         kexlist_handler, P(NULL));
-       c->listbox.height = 5;
-
-       s = ctrl_getset(b, "Connection/SSH/Kex", "repeat",
-                       "Options controlling key re-exchange");
-
-       ctrl_editbox(s, "Max minutes before rekey (0 for no limit)", 't', 20,
-                    HELPCTX(ssh_kex_repeat),
-                    dlg_stdeditbox_handler,
-                    I(offsetof(Config,ssh_rekey_time)),
-                    I(-1));
-       ctrl_editbox(s, "Max data before rekey (0 for no limit)", 'x', 20,
-                    HELPCTX(ssh_kex_repeat),
-                    dlg_stdeditbox_handler,
-                    I(offsetof(Config,ssh_rekey_data)),
-                    I(16));
-       ctrl_text(s, "(Use 1M for 1 megabyte, 1G for 1 gigabyte etc)",
-                 HELPCTX(ssh_kex_repeat));
+       if (protcfginfo != 1) {
+           ctrl_settitle(b, "Connection/SSH/Kex",
+                         "Options controlling SSH key exchange");
+
+           s = ctrl_getset(b, "Connection/SSH/Kex", "main",
+                           "Key exchange algorithm options");
+           c = ctrl_draglist(s, "Algorithm selection policy", 's',
+                             HELPCTX(ssh_kexlist),
+                             kexlist_handler, P(NULL));
+           c->listbox.height = 5;
+
+           s = ctrl_getset(b, "Connection/SSH/Kex", "repeat",
+                           "Options controlling key re-exchange");
+
+           ctrl_editbox(s, "Max minutes before rekey (0 for no limit)", 't', 20,
+                        HELPCTX(ssh_kex_repeat),
+                        dlg_stdeditbox_handler,
+                        I(offsetof(Config,ssh_rekey_time)),
+                        I(-1));
+           ctrl_editbox(s, "Max data before rekey (0 for no limit)", 'x', 20,
+                        HELPCTX(ssh_kex_repeat),
+                        dlg_stdeditbox_handler,
+                        I(offsetof(Config,ssh_rekey_data)),
+                        I(16));
+           ctrl_text(s, "(Use 1M for 1 megabyte, 1G for 1 gigabyte etc)",
+                     HELPCTX(ssh_kex_repeat));
+       }
 
        if (!midsession) {
 
index 872d1894b37c00a8b43f0a9741d09321676a93a7..544d9a19f2926cdc83c706b1a0e9bcb35f2ce47a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: macdlg.c,v 1.18 2003/04/05 15:01:16 ben Exp $ */
+/* $Id$ */
 /*
  * Copyright (c) 2002 Ben Harris
  * All rights reserved.
@@ -67,7 +67,7 @@ void mac_newsession(void)
 
     get_sesslist(&sesslist, TRUE);
     s->ctrlbox = ctrl_new_box();
-    setup_config_box(s->ctrlbox, &sesslist, FALSE, 0);
+    setup_config_box(s->ctrlbox, &sesslist, FALSE, 0, 0);
 
     s->settings_ctrls.data = &s->cfg;
     s->settings_ctrls.end = &mac_enddlg;
diff --git a/putty.h b/putty.h
index 4b0e3fefdc3eb678cbadf3818d827d627e180d7a..0d74e9404751938cd482645b2ebb8444c80acae2 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -340,6 +340,7 @@ struct backend_tag {
      * buffer is clearing.
      */
     void (*unthrottle) (void *handle, int);
+    int (*cfg_info) (void *handle);
     int default_port;
 };
 
@@ -920,7 +921,7 @@ void cmdline_error(char *, ...);
  */
 struct controlbox;
 void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
-                     int midsession, int protocol);
+                     int midsession, int protocol, int protcfginfo);
 
 /*
  * Exports from minibidi.c.
diff --git a/raw.c b/raw.c
index 8b1b1e9b15e9e843e9854f775c95d358f6ab8ab1..631320c0f8f20376e82f5b955d9a79af552c9a42 100644 (file)
--- a/raw.c
+++ b/raw.c
@@ -236,6 +236,14 @@ static int raw_exitcode(void *handle)
         return 0;
 }
 
+/*
+ * cfg_info for Raw does nothing at all.
+ */
+static int raw_cfg_info(void *handle)
+{
+    return 0;
+}
+
 Backend raw_backend = {
     raw_init,
     raw_free,
@@ -252,5 +260,6 @@ Backend raw_backend = {
     raw_provide_ldisc,
     raw_provide_logctx,
     raw_unthrottle,
+    raw_cfg_info,
     1
 };
index 06c8b12b4561047dbec931cecd5f0ec6af003c44..2f262300b441682c320b447cde29a4a216e060b2 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -303,6 +303,14 @@ static int rlogin_exitcode(void *handle)
         return 0;
 }
 
+/*
+ * cfg_info for rlogin does nothing at all.
+ */
+static int rlogin_cfg_info(void *handle)
+{
+    return 0;
+}
+
 Backend rlogin_backend = {
     rlogin_init,
     rlogin_free,
@@ -319,5 +327,6 @@ Backend rlogin_backend = {
     rlogin_provide_ldisc,
     rlogin_provide_logctx,
     rlogin_unthrottle,
+    rlogin_cfg_info,
     1
 };
diff --git a/ssh.c b/ssh.c
index de768d3d76455c0f5170afd4c82b9af49ef0f00f..f92975d994a6bf3688e10a3329bd093c0030e122 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -7860,6 +7860,16 @@ static int ssh_return_exitcode(void *handle)
         return (ssh->exitcode >= 0 ? ssh->exitcode : 0);
 }
 
+/*
+ * cfg_info for SSH is the currently running version of the
+ * protocol. (1 for 1; 2 for 2; 0 for not-decided-yet.)
+ */
+static int ssh_cfg_info(void *handle)
+{
+    Ssh ssh = (Ssh) handle;
+    return ssh->version;
+}
+
 /*
  * Gross hack: pscp will try to start SFTP but fall back to scp1 if
  * that fails. This variable is the means by which scp.c can reach
@@ -7887,5 +7897,6 @@ Backend ssh_backend = {
     ssh_provide_ldisc,
     ssh_provide_logctx,
     ssh_unthrottle,
+    ssh_cfg_info,
     22
 };
index 8b2c4289ffd00f484d9e8f329315686d5bc14090..13c2d3c2b74ae0c185a8447921eb727afbd549ad 100644 (file)
--- a/telnet.c
+++ b/telnet.c
@@ -1050,6 +1050,14 @@ static int telnet_exitcode(void *handle)
         return 0;
 }
 
+/*
+ * cfg_info for Telnet does nothing at all.
+ */
+static int telnet_cfg_info(void *handle)
+{
+    return 0;
+}
+
 Backend telnet_backend = {
     telnet_init,
     telnet_free,
@@ -1066,5 +1074,6 @@ Backend telnet_backend = {
     telnet_provide_ldisc,
     telnet_provide_logctx,
     telnet_unthrottle,
+    telnet_cfg_info,
     23
 };
index bc2eb31f498d2b8a26ae3b637f4b962788076770..4bfb52d89dcd5d39598e86a2ed2a2c00fdd13920 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: testback.c,v 1.10 2004/06/20 17:07:32 jacob Exp $ */
+/* $Id$ */
 /*
  * Copyright (c) 1999 Simon Tatham
  * Copyright (c) 1999 Ben Harris
@@ -57,13 +57,15 @@ static void null_unthrottle(void *, int);
 Backend null_backend = {
     null_init, null_free, null_reconfig, null_send, null_sendbuffer, null_size,
     null_special, null_get_specials, null_socket, null_exitcode, null_sendok,
-    null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle, 0
+    null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
+    null_cfg_info, 0
 };
 
 Backend loop_backend = {
     loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
     null_special, null_get_specials, null_socket, null_exitcode, null_sendok,
-    null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle, 0
+    null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
+    null_cfg_info, 0
 };
 
 struct loop_state {
@@ -163,6 +165,12 @@ static void null_provide_logctx(void *handle, void *logctx) {
 
 }
 
+static int null_cfg_info(void *handle)
+{
+    return 0;
+}
+
+
 /*
  * Emacs magic:
  * Local Variables:
index 6b5659c2d41b13bc305321b6079ac067076f210b..0ea6615fd637015ebe7729432716b482517bf7d3 100644 (file)
@@ -1945,7 +1945,8 @@ int get_listitemheight(void)
     return req.height;
 }
 
-int do_config_box(const char *title, Config *cfg, int midsession)
+int do_config_box(const char *title, Config *cfg, int midsession,
+                 int protcfginfo)
 {
     GtkWidget *window, *hbox, *vbox, *cols, *label,
        *tree, *treescroll, *panels, *panelvbox;
@@ -1974,7 +1975,7 @@ int do_config_box(const char *title, Config *cfg, int midsession)
     window = gtk_dialog_new();
 
     ctrlbox = ctrl_new_box();
-    setup_config_box(ctrlbox, &sl, midsession, cfg->protocol);
+    setup_config_box(ctrlbox, &sl, midsession, cfg->protocol, protcfginfo);
     unix_setup_config_box(ctrlbox, midsession, window);
 
     gtk_window_set_title(GTK_WINDOW(window), title);
index 54ab31d8a4e71fc0a643c29f9fc7cb5ed376a946..b1cd7d0ff324821aedeb214c64b3251c2448be8d 100644 (file)
@@ -2857,7 +2857,8 @@ void change_settings_menuitem(GtkMenuItem *item, gpointer data)
 
     cfg2 = inst->cfg;                  /* structure copy */
 
-    if (do_config_box(title, &cfg2, 1)) {
+    if (do_config_box(title, &cfg2, 1,
+                     inst->back?inst->back->cfg_info(inst->backhandle):0)) {
 
         oldcfg = inst->cfg;            /* structure copy */
         inst->cfg = cfg2;              /* structure copy */
index bef9f2fab429a5b60f8f09ec02b2e99f40949e38..d99d4e505ce72e6e6c3f6c5c727c5ba3bea3e407 100644 (file)
@@ -804,6 +804,11 @@ static int pty_exitcode(void *handle)
        return pty_exit_code;
 }
 
+static int pty_cfg_info(void *handle)
+{
+    return 0;
+}
+
 Backend pty_backend = {
     pty_init,
     pty_free,
@@ -820,5 +825,6 @@ Backend pty_backend = {
     pty_provide_ldisc,
     pty_provide_logctx,
     pty_unthrottle,
+    pty_cfg_info,
     1
 };
index 969cdbbf55028663d8d81f45b499a7c24b72a19e..909b3d49ec2a5c87d0b504822b064791d3150798 100644 (file)
@@ -60,7 +60,8 @@ long get_windowid(void *frontend);
 void *get_window(void *frontend);      /* void * to avoid depending on gtk.h */
 
 /* Things pterm.c needs from gtkdlg.c */
-int do_config_box(const char *title, Config *cfg, int midsession);
+int do_config_box(const char *title, Config *cfg,
+                 int midsession, int protcfginfo);
 void fatal_message_box(void *window, char *msg);
 void about_box(void *window);
 void *eventlogstuff_new(void);
index d71d28988d6501138455a36aeb9a6f0dc7e2b1c0..58ae24dab09c898d868c27bb6167d89287e5277e 100644 (file)
@@ -40,7 +40,7 @@ Backend *select_backend(Config *cfg)
 
 int cfgbox(Config *cfg)
 {
-    return do_config_box("PuTTY Configuration", cfg, 0);
+    return do_config_box("PuTTY Configuration", cfg, 0, 0);
 }
 
 static int got_host = 0;
index 285691bf78a893364b8913680b46995503c883f2..ba67ef5659872b965257b63d9958531cb2f3fc07 100644 (file)
@@ -598,7 +598,7 @@ int do_config(void)
     int ret;
 
     ctrlbox = ctrl_new_box();
-    setup_config_box(ctrlbox, &sesslist, FALSE, 0);
+    setup_config_box(ctrlbox, &sesslist, FALSE, 0, 0);
     win_setup_config_box(ctrlbox, &dp.hwnd, (help_path != NULL), FALSE);
     dp_init(&dp);
     winctrl_init(&ctrls_base);
@@ -624,7 +624,7 @@ int do_config(void)
     return ret;
 }
 
-int do_reconfig(HWND hwnd)
+int do_reconfig(HWND hwnd, int protcfginfo)
 {
     Config backup_cfg;
     int ret;
@@ -632,7 +632,7 @@ int do_reconfig(HWND hwnd)
     backup_cfg = cfg;                 /* structure copy */
 
     ctrlbox = ctrl_new_box();
-    setup_config_box(ctrlbox, &sesslist, TRUE, cfg.protocol);
+    setup_config_box(ctrlbox, &sesslist, TRUE, cfg.protocol, protcfginfo);
     win_setup_config_box(ctrlbox, &dp.hwnd, (help_path != NULL), TRUE);
     dp_init(&dp);
     winctrl_init(&ctrls_base);
index b0d7d5c25f5c24651dae3b5d002520c3f9642efc..68ba61f78cf5ad3b40e8d6a82097804fdb0b59e2 100644 (file)
@@ -1900,7 +1900,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                GetWindowText(hwnd, cfg.wintitle, sizeof(cfg.wintitle));
                prev_cfg = cfg;
 
-               if (!do_reconfig(hwnd))
+               if (!do_reconfig(hwnd, back ? back->cfg_info(backhandle) : 0))
                    break;
 
                {
index 84db7b04dfb8a1842ace2f2978323bc3a6e465c9..020f43b8883da491f5bdcae9d365f1613d7d8718 100644 (file)
@@ -327,7 +327,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,
  */
 void defuse_showwindow(void);
 int do_config(void);
-int do_reconfig(HWND);
+int do_reconfig(HWND, int);
 void showeventlog(HWND);
 void showabout(HWND);
 void force_normal(HWND hwnd);