comparison cli-runopts.c @ 513:a3748e54273c

Idle timeout patch from Farrell Aultman. Needs testing, unsure if server code works
author Matt Johnston <matt@ucc.asn.au>
date Fri, 07 Nov 2008 14:11:06 +0000
parents 4e251543b941
children 6c906f903f1d 69e98c45db7c
comparison
equal deleted inserted replaced
510:b85507ade010 513:a3748e54273c
73 #ifdef ENABLE_CLI_REMOTETCPFWD 73 #ifdef ENABLE_CLI_REMOTETCPFWD
74 "-R <listenport:remotehost:remoteport> Remote port forwarding\n" 74 "-R <listenport:remotehost:remoteport> Remote port forwarding\n"
75 #endif 75 #endif
76 "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n" 76 "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
77 "-K <keepalive> (0 is never, default %d)\n" 77 "-K <keepalive> (0 is never, default %d)\n"
78 "-I <idle_timeout> (0 is never, default %d)\n"
78 #ifdef ENABLE_CLI_NETCAT 79 #ifdef ENABLE_CLI_NETCAT
79 "-B <endhost:endport> Netcat-alike forwarding\n" 80 "-B <endhost:endport> Netcat-alike forwarding\n"
80 #endif 81 #endif
81 #ifdef ENABLE_CLI_PROXYCMD 82 #ifdef ENABLE_CLI_PROXYCMD
82 "-J <proxy_program> Use program pipe rather than TCP connection\n" 83 "-J <proxy_program> Use program pipe rather than TCP connection\n"
83 #endif 84 #endif
84 #ifdef DEBUG_TRACE 85 #ifdef DEBUG_TRACE
85 "-v verbose (compiled with DEBUG_TRACE)\n" 86 "-v verbose (compiled with DEBUG_TRACE)\n"
86 #endif 87 #endif
87 ,DROPBEAR_VERSION, cli_opts.progname, 88 ,DROPBEAR_VERSION, cli_opts.progname,
88 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE); 89 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT);
89 90
90 } 91 }
91 92
92 void cli_getopts(int argc, char ** argv) { 93 void cli_getopts(int argc, char ** argv) {
93 94
108 #endif 109 #endif
109 char* dummy = NULL; /* Not used for anything real */ 110 char* dummy = NULL; /* Not used for anything real */
110 111
111 char* recv_window_arg = NULL; 112 char* recv_window_arg = NULL;
112 char* keepalive_arg = NULL; 113 char* keepalive_arg = NULL;
114 char* idle_timeout_arg = NULL;
113 115
114 /* see printhelp() for options */ 116 /* see printhelp() for options */
115 cli_opts.progname = argv[0]; 117 cli_opts.progname = argv[0];
116 cli_opts.remotehost = NULL; 118 cli_opts.remotehost = NULL;
117 cli_opts.remoteport = NULL; 119 cli_opts.remoteport = NULL;
259 next = &recv_window_arg; 261 next = &recv_window_arg;
260 break; 262 break;
261 case 'K': 263 case 'K':
262 next = &keepalive_arg; 264 next = &keepalive_arg;
263 break; 265 break;
266 case 'I':
267 next = &idle_timeout_arg;
268 break;
264 #ifdef DEBUG_TRACE 269 #ifdef DEBUG_TRACE
265 case 'v': 270 case 'v':
266 debug_trace = 1; 271 debug_trace = 1;
267 break; 272 break;
268 #endif 273 #endif
364 } 369 }
365 } 370 }
366 if (keepalive_arg) { 371 if (keepalive_arg) {
367 if (m_str_to_uint(keepalive_arg, &opts.keepalive_secs) == DROPBEAR_FAILURE) { 372 if (m_str_to_uint(keepalive_arg, &opts.keepalive_secs) == DROPBEAR_FAILURE) {
368 dropbear_exit("Bad keepalive '%s'", keepalive_arg); 373 dropbear_exit("Bad keepalive '%s'", keepalive_arg);
374 }
375 }
376
377 if (idle_timeout_arg) {
378 if (m_str_to_uint(idle_timeout_arg, &opts.idle_timeout_secs) == DROPBEAR_FAILURE) {
379 dropbear_exit("Bad idle_timeout '%s'", idle_timeout_arg);
369 } 380 }
370 } 381 }
371 382
372 #ifdef ENABLE_CLI_NETCAT 383 #ifdef ENABLE_CLI_NETCAT
373 if (cli_opts.cmd && cli_opts.netcat_host) { 384 if (cli_opts.cmd && cli_opts.netcat_host) {