PSFTP was ignoring `-1' and `-2' and always using SSH-2 with fallback to
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sun, 25 Jul 2004 16:10:48 +0000 (16:10 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sun, 25 Jul 2004 16:10:48 +0000 (16:10 +0000)
SSH-1. It also ignored any settings forbidding fallback to SSH-1.

Ignoring `-1' and `-2' is hardly the end of the world, as it'd be difficult
to think of a realistic situation where fallback didn't do the right thing
and PSFTP was still useful. However, ignoring a user's `SSH-2 only' setting
was a bit rude.

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

psftp.c

diff --git a/psftp.c b/psftp.c
index 218d363..079a61f 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -1847,6 +1847,15 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
     }
 
     /*
+     * If saved session / Default Settings says SSH-1 (`1 only' or `1'),
+     * then change it to SSH-2, on the grounds that that's more likely to
+     * work for SFTP. (Can be overridden with `-1' option.)
+     * But if it says `2 only' or `2', respect which.
+     */
+    if (cfg.sshprot != 2 && cfg.sshprot != 3)
+       cfg.sshprot = 2;
+
+    /*
      * Enact command-line overrides.
      */
     cmdline_run_saved(&cfg);
@@ -1913,9 +1922,6 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
     if (portnumber)
        cfg.port = portnumber;
 
-    /* SFTP uses SSH2 by default always */
-    cfg.sshprot = 2;
-
     /*
      * Disable scary things which shouldn't be enabled for simple
      * things like SCP and SFTP: agent forwarding, port forwarding,