diff options
author | Matt Johnston <matt@ucc.asn.au> | 2008-11-07 14:11:06 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2008-11-07 14:11:06 +0000 |
commit | adc4d0194f4c9348cdd331e80deb2b3401a29877 (patch) | |
tree | 38e0293d99f7872849e1ec4b173d631173fbc786 /svr-runopts.c | |
parent | e80f8e8c09dab7cece30660a33e2a2bfd5d5f571 (diff) |
Idle timeout patch from Farrell Aultman. Needs testing, unsure if server
code works
--HG--
extra : convert_revision : ff66e05ae040561110af70114bf83f11ed528f05
Diffstat (limited to 'svr-runopts.c')
-rw-r--r-- | svr-runopts.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/svr-runopts.c b/svr-runopts.c index d8cfecf..4f1355a 100644 --- a/svr-runopts.c +++ b/svr-runopts.c @@ -82,6 +82,7 @@ static void printhelp(const char * progname) { #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 DEBUG_TRACE "-v verbose (compiled with DEBUG_TRACE)\n" #endif @@ -93,7 +94,7 @@ static void printhelp(const char * progname) { RSA_PRIV_FILENAME, #endif DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE, - DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE); + DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); } void svr_getopts(int argc, char ** argv) { @@ -103,6 +104,7 @@ void svr_getopts(int argc, char ** argv) { int nextisport = 0; char* recv_window_arg = NULL; char* keepalive_arg = NULL; + char* idle_timeout_arg = NULL; /* see printhelp() for options */ svr_opts.rsakeyfile = NULL; @@ -134,7 +136,8 @@ void svr_getopts(int argc, char ** argv) { svr_opts.usingsyslog = 1; #endif opts.recv_window = DEFAULT_RECV_WINDOW; - opts.keepalive_secs = DEFAULT_KEEPALIVE; + opts.keepalive_secs = DEFAULT_KEEPALIVE; + opts.idle_timeout_secs = DEFAULT_IDLE_TIMEOUT; #ifdef ENABLE_SVR_REMOTETCPFWD opts.listen_fwd_all = 0; @@ -218,6 +221,9 @@ void svr_getopts(int argc, char ** argv) { case 'K': next = &keepalive_arg; break; + case 'I': + next = &idle_timeout_arg; + break; #if defined(ENABLE_SVR_PASSWORD_AUTH) || defined(ENABLE_SVR_PAM_AUTH) case 's': svr_opts.noauthpass = 1; @@ -253,7 +259,7 @@ void svr_getopts(int argc, char ** argv) { svr_opts.addresses[0] = m_strdup(DROPBEAR_DEFADDRESS); svr_opts.portcount = 1; } - + if (svr_opts.dsskeyfile == NULL) { svr_opts.dsskeyfile = DSS_PRIV_FILENAME; } @@ -294,6 +300,12 @@ void svr_getopts(int argc, char ** argv) { dropbear_exit("Bad keepalive '%s'", keepalive_arg); } } + + 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); + } + } } static void addportandaddress(char* spec) { |