Skip to content
Snippets Groups Projects
Commit efe45cdd authored by Matt Johnston's avatar Matt Johnston
Browse files

- Enable -s for specifying a subsystem (such as sftp)

--HG--
extra : convert_revision : c7b916e6c522f16f06fe1bd52815ba13aa88b90b
parent b98d13ef
No related merge requests found
...@@ -321,7 +321,11 @@ static void send_chansess_shell_req(struct Channel *channel) { ...@@ -321,7 +321,11 @@ static void send_chansess_shell_req(struct Channel *channel) {
TRACE(("enter send_chansess_shell_req")) TRACE(("enter send_chansess_shell_req"))
if (cli_opts.cmd) { if (cli_opts.cmd) {
reqtype = "exec"; if (cli_opts.is_subsystem) {
reqtype = "subsystem";
} else {
reqtype = "exec";
}
} else { } else {
reqtype = "shell"; reqtype = "shell";
} }
......
...@@ -58,6 +58,7 @@ static void printhelp() { ...@@ -58,6 +58,7 @@ static void printhelp() {
"-N Don't run a remote command\n" "-N Don't run a remote command\n"
"-f Run in background after auth\n" "-f Run in background after auth\n"
"-y Always accept remote host key if unknown\n" "-y Always accept remote host key if unknown\n"
"-s Request a subsystem (use for sftp)\n"
#ifdef ENABLE_CLI_PUBKEY_AUTH #ifdef ENABLE_CLI_PUBKEY_AUTH
"-i <identityfile> (multiple allowed)\n" "-i <identityfile> (multiple allowed)\n"
#endif #endif
...@@ -116,6 +117,7 @@ void cli_getopts(int argc, char ** argv) { ...@@ -116,6 +117,7 @@ void cli_getopts(int argc, char ** argv) {
cli_opts.backgrounded = 0; cli_opts.backgrounded = 0;
cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */ cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */
cli_opts.always_accept_key = 0; cli_opts.always_accept_key = 0;
cli_opts.is_subsystem = 0;
#ifdef ENABLE_CLI_PUBKEY_AUTH #ifdef ENABLE_CLI_PUBKEY_AUTH
cli_opts.privkeys = NULL; cli_opts.privkeys = NULL;
#endif #endif
...@@ -213,6 +215,9 @@ void cli_getopts(int argc, char ** argv) { ...@@ -213,6 +215,9 @@ void cli_getopts(int argc, char ** argv) {
case 'f': case 'f':
cli_opts.backgrounded = 1; cli_opts.backgrounded = 1;
break; break;
case 's':
cli_opts.is_subsystem = 1;
break;
#ifdef ENABLE_CLI_LOCALTCPFWD #ifdef ENABLE_CLI_LOCALTCPFWD
case 'L': case 'L':
nextislocal = 1; nextislocal = 1;
......
...@@ -109,6 +109,7 @@ typedef struct cli_runopts { ...@@ -109,6 +109,7 @@ typedef struct cli_runopts {
int always_accept_key; int always_accept_key;
int no_cmd; int no_cmd;
int backgrounded; int backgrounded;
int is_subsystem;
#ifdef ENABLE_CLI_PUBKEY_AUTH #ifdef ENABLE_CLI_PUBKEY_AUTH
struct SignKeyList *privkeys; /* Keys to use for public-key auth */ struct SignKeyList *privkeys; /* Keys to use for public-key auth */
#endif #endif
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment