]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - psftp.c
Move MODULE files out of individual project directories into a
[PuTTY.git] / psftp.c
diff --git a/psftp.c b/psftp.c
index 2bf0ded54ef79cd6aa80b4a3e1758496a205c638..b2904364b8c32c98e20e8b3b6f133e69aa578593 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -1446,7 +1446,7 @@ static int verbose = 0;
  */
 void fatalbox(char *fmt, ...)
 {
-    char str[0x100];                  /* Make the size big enough */
+    char str[512];                    /* Make the size big enough */
     va_list ap;
     va_start(ap, fmt);
     strcpy(str, "Fatal:");
@@ -1459,7 +1459,7 @@ void fatalbox(char *fmt, ...)
 }
 void connection_fatal(char *fmt, ...)
 {
-    char str[0x100];                  /* Make the size big enough */
+    char str[512];                    /* Make the size big enough */
     va_list ap;
     va_start(ap, fmt);
     strcpy(str, "Fatal:");
@@ -1690,7 +1690,15 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
        do_defaults(NULL, &cfg);
        strncpy(cfg.host, host, sizeof(cfg.host) - 1);
        cfg.host[sizeof(cfg.host) - 1] = '\0';
-       cfg.port = 22;
+    }
+
+    /*
+     * Force use of SSH. (If they got the protocol wrong we assume the
+     * port is useless too.)
+     */
+    if (cfg.protocol != PROT_SSH) {
+        cfg.protocol = PROT_SSH;
+        cfg.port = 22;
     }
 
     /*
@@ -1741,9 +1749,6 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
        }
     }
 
-    if (cfg.protocol != PROT_SSH)
-       cfg.port = 22;
-
     if (portnumber)
        cfg.port = portnumber;
 
@@ -1852,8 +1857,6 @@ int main(int argc, char *argv[])
        } else if (strcmp(argv[i], "-h") == 0 ||
                   strcmp(argv[i], "-?") == 0) {
            usage();
-       } else if (strcmp(argv[i], "-l") == 0 && i + 1 < argc) {
-           user = argv[++i];
        } else if (strcmp(argv[i], "-batch") == 0) {
            console_batch_mode = 1;
        } else if (strcmp(argv[i], "-b") == 0 && i + 1 < argc) {