--- runopts.h +++ runopts.h @@ -68,6 +68,10 @@ typedef struct svr_runopts { +#ifdef DROPBEAR_SFTPSERVER + char * sftppath; +#endif + char * bannerfile; int forkbg; --- svr-chansession.c +++ svr-chansession.c @@ -680,7 +680,7 @@ #if DROPBEAR_SFTPSERVER if ((cmdlen == 4) && strncmp(chansess->cmd, "sftp", 4) == 0) { m_free(chansess->cmd); - chansess->cmd = m_strdup(SFTPSERVER_PATH); + chansess->cmd = m_strdup(svr_opts.sftppath); } else #endif { --- svr-runopts.c +++ svr-runopts.c @@ -63,6 +63,10 @@ #if DROPBEAR_DELAY_HOSTKEY "-R Create hostkeys as required\n" #endif +#ifdef DROPBEAR_SFTPSERVER + "-S sftpserver Set path to sftp server\n" + " (default: %s)\n" +#endif "-F Don't fork into background\n" #ifdef DISABLE_SYSLOG "(Syslog support not compiled in, using stderr)\n" @@ -124,6 +128,9 @@ #if DROPBEAR_ED25519 ED25519_PRIV_FILENAME, #endif +#ifdef DROPBEAR_SFTPSERVER + SFTPSERVER_PATH, +#endif MAX_AUTH_TRIES, DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE, DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); @@ -146,6 +153,9 @@ /* see printhelp() for options */ +#ifdef DROPBEAR_SFTPSERVER + svr_opts.sftppath = NULL; +#endif svr_opts.bannerfile = NULL; svr_opts.banner = NULL; svr_opts.forced_command = NULL; @@ -217,6 +227,11 @@ case 'R': svr_opts.delay_hostkey = 1; break; +#ifdef DROPBEAR_SFTPSERVER + case 'S': + next = &svr_opts.sftppath; + break; +#endif case 'F': svr_opts.forkbg = 0; break; @@ -353,6 +368,12 @@ svr_opts.portcount = 1; } +#ifdef DROPBEAR_SFTPSERVER + if (svr_opts.sftppath == NULL) { + svr_opts.sftppath = SFTPSERVER_PATH; + } +#endif + if (svr_opts.bannerfile) { struct stat buf; if (stat(svr_opts.bannerfile, &buf) != 0) {