summaryrefslogtreecommitdiffhomepage
path: root/cli-runopts.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2008-11-07 14:11:06 +0000
committerMatt Johnston <matt@ucc.asn.au>2008-11-07 14:11:06 +0000
commitadc4d0194f4c9348cdd331e80deb2b3401a29877 (patch)
tree38e0293d99f7872849e1ec4b173d631173fbc786 /cli-runopts.c
parente80f8e8c09dab7cece30660a33e2a2bfd5d5f571 (diff)
Idle timeout patch from Farrell Aultman. Needs testing, unsure if server
code works --HG-- extra : convert_revision : ff66e05ae040561110af70114bf83f11ed528f05
Diffstat (limited to 'cli-runopts.c')
-rw-r--r--cli-runopts.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cli-runopts.c b/cli-runopts.c
index e7b1ed9..9c10fc3 100644
--- a/cli-runopts.c
+++ b/cli-runopts.c
@@ -75,6 +75,7 @@ static void printhelp() {
#endif
"-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
"-K <keepalive> (0 is never, default %d)\n"
+ "-I <idle_timeout> (0 is never, default %d)\n"
#ifdef ENABLE_CLI_NETCAT
"-B <endhost:endport> Netcat-alike forwarding\n"
#endif
@@ -85,7 +86,7 @@ static void printhelp() {
"-v verbose (compiled with DEBUG_TRACE)\n"
#endif
,DROPBEAR_VERSION, cli_opts.progname,
- DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE);
+ DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT);
}
@@ -110,6 +111,7 @@ void cli_getopts(int argc, char ** argv) {
char* recv_window_arg = NULL;
char* keepalive_arg = NULL;
+ char* idle_timeout_arg = NULL;
/* see printhelp() for options */
cli_opts.progname = argv[0];
@@ -261,6 +263,9 @@ void cli_getopts(int argc, char ** argv) {
case 'K':
next = &keepalive_arg;
break;
+ case 'I':
+ next = &idle_timeout_arg;
+ break;
#ifdef DEBUG_TRACE
case 'v':
debug_trace = 1;
@@ -369,6 +374,12 @@ void cli_getopts(int argc, char ** argv) {
}
}
+ if (idle_timeout_arg) {
+ if (m_str_to_uint(idle_timeout_arg, &opts.idle_timeout_secs) == DROPBEAR_FAILURE) {
+ dropbear_exit("Bad idle_timeout '%s'", idle_timeout_arg);
+ }
+ }
+
#ifdef ENABLE_CLI_NETCAT
if (cli_opts.cmd && cli_opts.netcat_host) {
dropbear_log(LOG_INFO, "Ignoring command '%s' in netcat mode", cli_opts.cmd);