From bebf22d0b9d2f0bd19089feee92980125f4dcccc Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 5 Sep 2001 19:48:52 +0000 Subject: [PATCH] PSFTP will now attempt to find /usr/[local]/lib/sftp-server if it can't start the sftp subsystem. This should enable convenient sftp access to SSH1-only systems: all the admin needs is to install sftp-server in the right place. git-svn-id: svn://svn.tartarus.org/sgt/putty@1228 cda61777-01e9-0310-a592-d414129be87e --- psftp.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/psftp.c b/psftp.c index 3ffc671f..3a50c257 100644 --- a/psftp.c +++ b/psftp.c @@ -1504,11 +1504,37 @@ int main(int argc, char *argv[]) /* SFTP uses SSH2 by default always */ cfg.sshprot = 2; - /* Set up subsystem name. FIXME: fudge for SSH1. */ + /* Set up subsystem name. */ strcpy(cfg.remote_cmd, "sftp"); cfg.ssh_subsys = TRUE; cfg.nopty = TRUE; + /* + * Set up fallback option, for SSH1 servers or servers with the + * sftp subsystem not enabled but the server binary installed + * in the usual place. We only support fallback on Unix + * systems, and we use the kludgy command string + * + * if test ! -x /usr/lib/sftp-server -a -x /usr/local/lib/sftp-server + * then + * exec /usr/local/lib/sftp-server + * else + * exec /usr/lib/sftp-server + * fi + * + * the idea being that this will attempt to use either of the + * obvious pathnames and then give up, and when it does give up + * it will print the preferred pathname in the error messages. + */ + cfg.remote_cmd_ptr2 = + "if test ! -x /usr/lib/sftp-server -a -x /usr/local/lib/sftp-server\n" + "then\n" + " exec /usr/local/lib/sftp-server\n" + "else\n" + " exec /usr/lib/sftp-server\n" + "fi"; + cfg.ssh_subsys2 = FALSE; + back = &ssh_backend; err = back->init(cfg.host, cfg.port, &realhost); -- 2.11.0