mirror of
https://github.com/clearml/dropbear
synced 2025-05-24 13:14:14 +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
|
#if DROPBEAR_CLI_REMOTETCPFWD
|
||||||
"-R <[listenaddress:]listenport:remotehost:remoteport> Remote port forwarding\n"
|
"-R <[listenaddress:]listenport:remotehost:remoteport> Remote port forwarding\n"
|
||||||
#endif
|
#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"
|
"-K <keepalive> (0 is never, default %d)\n"
|
||||||
"-I <idle_timeout> (0 is never, default %d)\n"
|
"-I <idle_timeout> (0 is never, default %d)\n"
|
||||||
#if DROPBEAR_CLI_NETCAT
|
#if DROPBEAR_CLI_NETCAT
|
||||||
@ -451,12 +451,9 @@ void cli_getopts(int argc, char ** argv) {
|
|||||||
&& cli_opts.no_cmd == 0) {
|
&& cli_opts.no_cmd == 0) {
|
||||||
dropbear_exit("Command required for -f");
|
dropbear_exit("Command required for -f");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recv_window_arg) {
|
if (recv_window_arg) {
|
||||||
opts.recv_window = atol(recv_window_arg);
|
parse_recv_window(recv_window_arg);
|
||||||
if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW) {
|
|
||||||
dropbear_exit("Bad recv window '%s'", recv_window_arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (keepalive_arg) {
|
if (keepalive_arg) {
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
@ -101,4 +101,20 @@ void print_version() {
|
|||||||
fprintf(stderr, "Dropbear v%s\n", DROPBEAR_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
|
#endif
|
||||||
|
|
||||||
void print_version(void);
|
void print_version(void);
|
||||||
|
void parse_recv_window(const char* recv_window_arg);
|
||||||
|
|
||||||
#endif /* DROPBEAR_RUNOPTS_H_ */
|
#endif /* DROPBEAR_RUNOPTS_H_ */
|
||||||
|
@ -100,7 +100,7 @@ static void printhelp(const char * progname) {
|
|||||||
#if INETD_MODE
|
#if INETD_MODE
|
||||||
"-i Start for inetd\n"
|
"-i Start for inetd\n"
|
||||||
#endif
|
#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"
|
"-K <keepalive> (0 is never, default %d, in seconds)\n"
|
||||||
"-I <idle_timeout> (0 is never, default %d, in seconds)\n"
|
"-I <idle_timeout> (0 is never, default %d, in seconds)\n"
|
||||||
#if DROPBEAR_PLUGIN
|
#if DROPBEAR_PLUGIN
|
||||||
@ -385,12 +385,9 @@ void svr_getopts(int argc, char ** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (recv_window_arg) {
|
if (recv_window_arg) {
|
||||||
opts.recv_window = atol(recv_window_arg);
|
parse_recv_window(recv_window_arg);
|
||||||
if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW) {
|
|
||||||
dropbear_exit("Bad recv window '%s'", recv_window_arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxauthtries_arg) {
|
if (maxauthtries_arg) {
|
||||||
@ -402,7 +399,7 @@ void svr_getopts(int argc, char ** argv) {
|
|||||||
svr_opts.maxauthtries = val;
|
svr_opts.maxauthtries = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (keepalive_arg) {
|
if (keepalive_arg) {
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
if (m_str_to_uint(keepalive_arg, &val) == DROPBEAR_FAILURE) {
|
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
|
#define RECV_WINDOWEXTEND (opts.recv_window / 3) /* We send a "window extend" every
|
||||||
RECV_WINDOWEXTEND bytes */
|
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
|
#define MAX_CHANNELS 1000 /* simple mem restriction, includes each tcp/x11
|
||||||
connection, so can't be _too_ small */
|
connection, so can't be _too_ small */
|
||||||
|
Loading…
Reference in New Issue
Block a user