Commit ab39cfdc authored by Niels Möller's avatar Niels Möller
Browse files

* src/channel.c (do_channel_open): Use SSH_CHANNEL_MAX_PACKET_FUZZ

* src/server_session.c (make_server_session): Likewise.
* src/client.c (make_client_session): Likewise.
* src/tcpforward.c (make_tcpip_channel): Likewise

Rev: src/channel.c:1.77
Rev: src/channel.h:1.55
Rev: src/client.c:1.91
Rev: src/server_session.c:1.34
Rev: src/tcpforward.c:1.43
parent bf48f69f
......@@ -1053,7 +1053,7 @@ static void do_channel_open(struct packet_handler *c UNUSED,
"Waiting for channels to close.", ""));
}
else if (!type || !(open = ALIST_GET(connection->table->channel_types,
type)))
type)))
{
C_WRITE(connection,
format_open_failure(remote_channel_number,
......@@ -1070,14 +1070,23 @@ static void do_channel_open(struct packet_handler *c UNUSED,
SSH_OPEN_RESOURCE_SHORTAGE,
"Unknown channel type", ""));
/* We don't support larger packets than the default,
* SSH_MAX_PACKET. The fuzz factor is because the
* channel's max sizes refer to the data string inside the
* packet, while the SSH_PACKET limit refers to the complete
* packet including some overhead (9 octets for
* SSH_MSG_CHANNEL_DATA and 13 octets for
* SSH_MSG_CHANNEL_EXTENDED_DATA). */
if (max_packet > (SSH_MAX_PACKET - SSH_CHANNEL_MAX_PACKET_FUZZ))
{
werror("do_channel_open: The remote end asked for really large packets.\n");
max_packet = SSH_MAX_PACKET - SSH_CHANNEL_MAX_PACKET_FUZZ;
}
CHANNEL_OPEN(open, connection,
type,
window_size,
/* We don't support larger packets than the
* default, SSH_MAX_PACKET */
MIN(max_packet, SSH_MAX_PACKET),
max_packet,
&buffer,
make_channel_open_continuation(connection,
local_number,
......@@ -1921,7 +1930,7 @@ make_channel_read_data(struct ssh_channel *channel)
*
* gives 9 bytes of overhead, including the length field. */
return make_read_data(channel, 9, make_channel_write(channel)); }
return make_read_data(channel, make_channel_write(channel)); }
struct io_callback *
make_channel_read_stderr(struct ssh_channel *channel)
......@@ -1933,7 +1942,7 @@ make_channel_read_stderr(struct ssh_channel *channel)
*
* gives 13 bytes of overhead, including the length field for the string. */
return make_read_data(channel, 13,
return make_read_data(channel,
make_channel_write_extended(channel,
SSH_EXTENDED_DATA_STDERR));
}
......
......@@ -81,12 +81,9 @@
; put onto the connections resource list.
(resources object resource_list)
; We try to keep the rec_window_size between max_window / 2
; and max_window.
;; (max_window simple UINT32)
; FIXME: Does the maximum packet sizes apply to complete ssh
; packets, or the data payload?
; NOTE: The channels maximum packet sizes refer to the packet
; payload, i.e. the DATA string in SSH_CHANNEL_DATA and
; SSH_MSG_CHANNEL_EXTENDED_DATA.
(rec_window_size simple UINT32)
(rec_max_packet simple UINT32)
......@@ -212,12 +209,8 @@
(pending_global_requests struct object_queue)
; If non-zero, close connection after all active channels have
; died.
(pending_close simple int)
; FIXME: Perhaps we should use an flag to indicate whether or
; not new channels can be opened?
))
; died, and don't allow any new channels to be opened.
(pending_close simple int)))
*/
/* SSH_MSG_GLOBAL_REQUEST */
......
......@@ -21,9 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* FIXME: Why include stdio? */
/* #include <stdio.h> */
#include "client.h"
#include "abstract_io.h"
......@@ -448,7 +445,7 @@ make_client_session(struct lsh_fd *in,
self->super.rec_window_size = initial_window;
/* FIXME: Make maximum packet size configurable */
self->super.rec_max_packet = SSH_MAX_PACKET;
self->super.rec_max_packet = SSH_MAX_PACKET - SSH_CHANNEL_MAX_PACKET_FUZZ;
self->super.request_types = make_alist(0, -1);
......
......@@ -276,7 +276,7 @@ make_server_session(struct lsh_user *user,
self->super.rec_window_size = 0;
/* FIXME: Make maximum packet size configurable. */
self->super.rec_max_packet = SSH_MAX_PACKET;
self->super.rec_max_packet = SSH_MAX_PACKET - SSH_CHANNEL_MAX_PACKET_FUZZ;
self->super.request_types = request_types;
......
......@@ -173,7 +173,7 @@ make_tcpip_channel(struct lsh_fd *socket, UINT32 initial_window)
self->super.rec_window_size = initial_window;
/* FIXME: Make maximum packet size configurable. */
self->super.rec_max_packet = SSH_MAX_PACKET;
self->super.rec_max_packet = SSH_MAX_PACKET - SSH_CHANNEL_MAX_PACKET_FUZZ;
self->socket = socket;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment