Improve channel_rcv_change_window().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@677 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-05-02 20:51:57 +00:00
parent a7732ebbe5
commit 06eceb3204

View File

@@ -303,30 +303,37 @@ static CHANNEL *channel_from_msg(SSH_SESSION *session) {
return channel; return channel;
} }
static void channel_rcv_change_window(SSH_SESSION *session){ static void channel_rcv_change_window(SSH_SESSION *session) {
u32 bytes; CHANNEL *channel;
CHANNEL *channel; u32 bytes;
int err; int rc;
enter_function();
channel=channel_from_msg(session); enter_function();
if(!channel)
ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session)); channel = channel_from_msg(session);
err = buffer_get_u32(session->in_buffer,&bytes); if (channel == NULL) {
if(!channel || err!= sizeof(u32)){ ssh_log(session, SSH_LOG_FUNCTIONS, ssh_get_error(session));
ssh_log(session, SSH_LOG_PACKET, }
"Error getting a window adjust message : invalid packet");
leave_function(); rc = buffer_get_u32(session->in_buffer, &bytes);
return; if (channel == NULL || rc != sizeof(u32)) {
} ssh_log(session, SSH_LOG_PACKET,
bytes=ntohl(bytes); "Error getting a window adjust message: invalid packet");
ssh_log(session, SSH_LOG_PROTOCOL,
"Adding %d bytes to channel (%d:%d) (from %d bytes)",
bytes,
channel->local_channel,
channel->remote_channel,
channel->remote_window);
channel->remote_window+=bytes;
leave_function(); leave_function();
return;
}
bytes = ntohl(bytes);
ssh_log(session, SSH_LOG_PROTOCOL,
"Adding %d bytes to channel (%d:%d) (from %d bytes)",
bytes,
channel->local_channel,
channel->remote_channel,
channel->remote_window);
channel->remote_window += bytes;
leave_function();
} }
/* is_stderr is set to 1 if the data are extended, ie stderr */ /* is_stderr is set to 1 if the data are extended, ie stderr */