Adjust the semantics of cfg.remote_cmd_ptr: it is now NULL when
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 17 Feb 2005 19:31:32 +0000 (19:31 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 17 Feb 2005 19:31:32 +0000 (19:31 +0000)
cfg.remote_cmd is to be used, rather than actually pointing at
cfg.remote_cmd. This change restores the ability to structure-copy
Configs without breaking them. (Though of course this is only a
temporary solution: really what wants doing is to fix
`config-struct'.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@5335 cda61777-01e9-0310-a592-d414129be87e

config.c
settings.c
ssh.c

index 8250e1c..1501f61 100644 (file)
--- a/config.c
+++ b/config.c
@@ -402,7 +402,7 @@ static void sessionsaver_handler(union control *ctrl, void *dlg,
                /* If at this point we have a valid session, go! */
                if (*cfg2.host) {
                    *cfg = cfg2;       /* structure copy */
-                   cfg->remote_cmd_ptr = cfg->remote_cmd; /* nasty */
+                   cfg->remote_cmd_ptr = NULL;
                    dlg_end(dlg, 1);
                } else
                    dlg_beep(dlg);
index aa234fe..c480486 100644 (file)
@@ -406,7 +406,7 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
     char prot[10];
 
     cfg->ssh_subsys = 0;              /* FIXME: load this properly */
-    cfg->remote_cmd_ptr = cfg->remote_cmd;
+    cfg->remote_cmd_ptr = NULL;
     cfg->remote_cmd_ptr2 = NULL;
 
     if (do_host) {
diff --git a/ssh.c b/ssh.c
index 58e72f5..72f142f 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -4618,6 +4618,8 @@ static void do_ssh1_connection(Ssh ssh, unsigned char *in, int inlen,
      */
     {
        char *cmd = ssh->cfg.remote_cmd_ptr;
+
+       if (!cmd) cmd = ssh->cfg.remote_cmd;
        
        if (ssh->cfg.ssh_subsys && ssh->cfg.remote_cmd_ptr2) {
            cmd = ssh->cfg.remote_cmd_ptr2;
@@ -7323,6 +7325,7 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
        } else {
            subsys = ssh->cfg.ssh_subsys;
            cmd = ssh->cfg.remote_cmd_ptr;
+           if (!cmd) cmd = ssh->cfg.remote_cmd;
        }
 
        s->pktout = ssh2_pkt_init(SSH2_MSG_CHANNEL_REQUEST);