mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 10:40:27 +09:00
Allow sending data payloads of remote_maxpacket length.
Signed-off-by: Tom Deseyn <tom.deseyn@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -1502,7 +1502,6 @@ static int channel_write_common(ssh_channel channel,
|
|||||||
ssh_session session;
|
ssh_session session;
|
||||||
uint32_t origlen = len;
|
uint32_t origlen = len;
|
||||||
size_t effectivelen;
|
size_t effectivelen;
|
||||||
size_t maxpacketlen;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if(channel == NULL) {
|
if(channel == NULL) {
|
||||||
@@ -1520,12 +1519,6 @@ static int channel_write_common(ssh_channel channel,
|
|||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Handle the max packet len from remote side, be nice
|
|
||||||
* 10 bytes for the headers
|
|
||||||
*/
|
|
||||||
maxpacketlen = channel->remote_maxpacket - 10;
|
|
||||||
|
|
||||||
if (channel->local_eof) {
|
if (channel->local_eof) {
|
||||||
ssh_set_error(session, SSH_REQUEST_DENIED,
|
ssh_set_error(session, SSH_REQUEST_DENIED,
|
||||||
"Can't write to channel %" PRIu32 ":%" PRIu32 " after EOF was sent",
|
"Can't write to channel %" PRIu32 ":%" PRIu32 " after EOF was sent",
|
||||||
@@ -1576,7 +1569,11 @@ static int channel_write_common(ssh_channel channel,
|
|||||||
effectivelen = len;
|
effectivelen = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
effectivelen = MIN(effectivelen, maxpacketlen);
|
/*
|
||||||
|
* Like OpenSSH, don't subtract bytes for the header fields
|
||||||
|
* and allow to send a payload of remote_maxpacket length.
|
||||||
|
*/
|
||||||
|
effectivelen = MIN(effectivelen, channel->remote_maxpacket);
|
||||||
|
|
||||||
rc = ssh_buffer_pack(session->out_buffer,
|
rc = ssh_buffer_pack(session->out_buffer,
|
||||||
"bd",
|
"bd",
|
||||||
|
|||||||
Reference in New Issue
Block a user