]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Plink and PSCP were failing to load the `Default Settings' options
authorSimon Tatham <anakin@pobox.com>
Mon, 23 Oct 2000 12:20:53 +0000 (12:20 +0000)
committerSimon Tatham <anakin@pobox.com>
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.

[originally from svn r747]

plink.c
scp.c

diff --git a/plink.c b/plink.c
index f5f6c8a0df37a7e15145fa0883a7e90cf0d657af..2fe882f73a55c178d68531eb39e36b57a58cfed7 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 81f925bb21bd68f45600f743f40ff8fc5abe19c5..b831fbbfb7d0db0bbe4d0dd4a7e1798b0acce501 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;