Idle timeout patch from Farrell Aultman. Needs testing, unsure if server

code works

--HG--
extra : convert_revision : ff66e05ae040561110af70114bf83f11ed528f05
This commit is contained in:
Matt Johnston
2008-11-07 14:11:06 +00:00
parent e80f8e8c09
commit adc4d0194f
10 changed files with 59 additions and 17 deletions

View File

@@ -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);