SSH2: more window size adjustments

This commit is contained in:
terrafrost 2013-07-22 23:48:28 -05:00
parent b0090e2ebc
commit 8c9e7a890e

View File

@ -2941,7 +2941,7 @@ class Net_SSH2 {
$max_size = min( $max_size = min(
$this->packet_size_client_to_server[$client_channel], $this->packet_size_client_to_server[$client_channel],
$this->window_size_client_to_server[$client_channel] $this->window_size_client_to_server[$client_channel]
); ) - 4;
while (strlen($data) > $max_size) { while (strlen($data) > $max_size) {
$packet = pack('CN2a*', $packet = pack('CN2a*',
NET_SSH2_MSG_CHANNEL_DATA, NET_SSH2_MSG_CHANNEL_DATA,
@ -2956,7 +2956,7 @@ class Net_SSH2 {
return false; return false;
} }
if ($max_size == $this->window_size_client_to_server[$client_channel]) { if ($max_size == $this->window_size_client_to_server[$client_channel] - 4) {
$this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST; $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST;
// using an invalid channel will let the buffers be built up for the valid channels // using an invalid channel will let the buffers be built up for the valid channels
$this->_get_channel_packet(-1); $this->_get_channel_packet(-1);
@ -2964,11 +2964,11 @@ class Net_SSH2 {
$max_size = min( $max_size = min(
$this->packet_size_client_to_server[$client_channel], $this->packet_size_client_to_server[$client_channel],
$this->window_size_client_to_server[$client_channel] $this->window_size_client_to_server[$client_channel]
); ) - 4;
} }
} }
if (strlen($data) >= $this->window_size_client_to_server[$client_channel]) { if (strlen($data) >= $this->window_size_client_to_server[$client_channel] - 4) {
$this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST; $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST;
$this->_get_channel_packet(-1); $this->_get_channel_packet(-1);
$this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST; $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST;