Plink and PSCP were failing to load the `Default Settings' options
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 23 Oct 2000 12:20:53 +0000 (12:20 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 23 Oct 2000 12:20:53 +0000 (12:20 +0000)
when connecting to an arbitrary hostname. In particular, setting a
default user name didn't work. Now it does.

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

plink.c
scp.c

diff --git a/plink.c b/plink.c
index f5f6c8a..2fe882f 100644 (file)
--- a/plink.c
+++ b/plink.c
@@ -370,13 +370,15 @@ int main(int argc, char **argv) {
                         /*
                          * One string.
                          */
-                        do_defaults (p, &cfg);
-                        if (cfg.host[0] == '\0') {
+                        Config cfg2;
+                        do_defaults (p, &cfg2);
+                        if (cfg2.host[0] == '\0') {
                             /* No settings for this host; use defaults */
                             strncpy(cfg.host, p, sizeof(cfg.host)-1);
                             cfg.host[sizeof(cfg.host)-1] = '\0';
                             cfg.port = 22;
-                        }
+                        } else
+                            cfg = cfg2;
                     } else {
                         *r++ = '\0';
                         strncpy(cfg.username, p, sizeof(cfg.username)-1);
diff --git a/scp.c b/scp.c
index 81f925b..b831fbb 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -444,6 +444,7 @@ static void do_cmd(char *host, char *user, char *cmd)
     do_defaults(host, &cfg);
     if (cfg.host[0] == '\0') {
        /* No settings for this host; use defaults */
+        do_defaults(NULL, &cfg);
        strncpy(cfg.host, host, sizeof(cfg.host)-1);
        cfg.host[sizeof(cfg.host)-1] = '\0';
        cfg.port = 22;