mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 02:46:58 +00:00
Increase max window size to 10MB, fallback rather than
exiting if an invalid value is given.
This commit is contained in:
parent
110b55214b
commit
043b0fbd1b
@ -79,7 +79,7 @@ static void printhelp() {
|
||||
#if DROPBEAR_CLI_REMOTETCPFWD
|
||||
"-R <[listenaddress:]listenport:remotehost:remoteport> Remote port forwarding\n"
|
||||
#endif
|
||||
"-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
|
||||
"-W <receive_window_buffer> (default %d, larger may be faster, max 10MB)\n"
|
||||
"-K <keepalive> (0 is never, default %d)\n"
|
||||
"-I <idle_timeout> (0 is never, default %d)\n"
|
||||
#if DROPBEAR_CLI_NETCAT
|
||||
@ -451,12 +451,9 @@ void cli_getopts(int argc, char ** argv) {
|
||||
&& cli_opts.no_cmd == 0) {
|
||||
dropbear_exit("Command required for -f");
|
||||
}
|
||||
|
||||
|
||||
if (recv_window_arg) {
|
||||
opts.recv_window = atol(recv_window_arg);
|
||||
if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW) {
|
||||
dropbear_exit("Bad recv window '%s'", recv_window_arg);
|
||||
}
|
||||
parse_recv_window(recv_window_arg);
|
||||
}
|
||||
if (keepalive_arg) {
|
||||
unsigned int val;
|
||||
|
@ -101,4 +101,20 @@ void print_version() {
|
||||
fprintf(stderr, "Dropbear v%s\n", DROPBEAR_VERSION);
|
||||
}
|
||||
|
||||
void parse_recv_window(const char* recv_window_arg) {
|
||||
int ret;
|
||||
unsigned int rw;
|
||||
|
||||
ret = m_str_to_uint(recv_window_arg, &rw);
|
||||
if (ret == DROPBEAR_FAILURE || rw == 0 || rw > MAX_RECV_WINDOW) {
|
||||
if (rw > MAX_RECV_WINDOW) {
|
||||
opts.recv_window = MAX_RECV_WINDOW;
|
||||
}
|
||||
dropbear_log(LOG_WARNING, "Bad recv window '%s', using %d",
|
||||
recv_window_arg, opts.recv_window);
|
||||
} else {
|
||||
opts.recv_window = rw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -195,5 +195,6 @@ void parse_ciphers_macs(void);
|
||||
#endif
|
||||
|
||||
void print_version(void);
|
||||
void parse_recv_window(const char* recv_window_arg);
|
||||
|
||||
#endif /* DROPBEAR_RUNOPTS_H_ */
|
||||
|
@ -100,7 +100,7 @@ static void printhelp(const char * progname) {
|
||||
#if INETD_MODE
|
||||
"-i Start for inetd\n"
|
||||
#endif
|
||||
"-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
|
||||
"-W <receive_window_buffer> (default %d, larger may be faster, max 10MB)\n"
|
||||
"-K <keepalive> (0 is never, default %d, in seconds)\n"
|
||||
"-I <idle_timeout> (0 is never, default %d, in seconds)\n"
|
||||
#if DROPBEAR_PLUGIN
|
||||
@ -385,12 +385,9 @@ void svr_getopts(int argc, char ** argv) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (recv_window_arg) {
|
||||
opts.recv_window = atol(recv_window_arg);
|
||||
if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW) {
|
||||
dropbear_exit("Bad recv window '%s'", recv_window_arg);
|
||||
}
|
||||
parse_recv_window(recv_window_arg);
|
||||
}
|
||||
|
||||
if (maxauthtries_arg) {
|
||||
@ -402,7 +399,7 @@ void svr_getopts(int argc, char ** argv) {
|
||||
svr_opts.maxauthtries = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (keepalive_arg) {
|
||||
unsigned int val;
|
||||
if (m_str_to_uint(keepalive_arg, &val) == DROPBEAR_FAILURE) {
|
||||
|
@ -196,7 +196,7 @@ If you test it please contact the Dropbear author */
|
||||
|
||||
#define RECV_WINDOWEXTEND (opts.recv_window / 3) /* We send a "window extend" every
|
||||
RECV_WINDOWEXTEND bytes */
|
||||
#define MAX_RECV_WINDOW (1024*1024) /* 1 MB should be enough */
|
||||
#define MAX_RECV_WINDOW (10*1024*1024) /* 10 MB should be enough */
|
||||
|
||||
#define MAX_CHANNELS 1000 /* simple mem restriction, includes each tcp/x11
|
||||
connection, so can't be _too_ small */
|
||||
|
Loading…
Reference in New Issue
Block a user