aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-05-02 20:51:57 +0000
committerAndreas Schneider <mail@cynapses.org>2009-05-02 20:51:57 +0000
commit06eceb32044b9dabdfdfb43d9c05e706f17f080d (patch)
tree5a7d75535659285c0fd2f66d99122c7c119b25c3 /libssh
parenta7732ebbe5716042e9736fb2f96b756e50374a49 (diff)
downloadlibssh-06eceb32044b9dabdfdfb43d9c05e706f17f080d.tar.gz
libssh-06eceb32044b9dabdfdfb43d9c05e706f17f080d.tar.xz
libssh-06eceb32044b9dabdfdfb43d9c05e706f17f080d.zip
Improve channel_rcv_change_window().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@677 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
-rw-r--r--libssh/channels.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/libssh/channels.c b/libssh/channels.c
index 5ab650f..0a5173d 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -303,30 +303,37 @@ static CHANNEL *channel_from_msg(SSH_SESSION *session) {
return channel;
}
-static void channel_rcv_change_window(SSH_SESSION *session){
- u32 bytes;
- CHANNEL *channel;
- int err;
- enter_function();
- channel=channel_from_msg(session);
- if(!channel)
- ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
- err = buffer_get_u32(session->in_buffer,&bytes);
- if(!channel || err!= sizeof(u32)){
- ssh_log(session, SSH_LOG_PACKET,
- "Error getting a window adjust message : invalid packet");
- 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;
+static void channel_rcv_change_window(SSH_SESSION *session) {
+ CHANNEL *channel;
+ u32 bytes;
+ int rc;
+
+ enter_function();
+
+ channel = channel_from_msg(session);
+ if (channel == NULL) {
+ ssh_log(session, SSH_LOG_FUNCTIONS, ssh_get_error(session));
+ }
+
+ rc = buffer_get_u32(session->in_buffer, &bytes);
+ if (channel == NULL || rc != sizeof(u32)) {
+ ssh_log(session, SSH_LOG_PACKET,
+ "Error getting a window adjust message: invalid packet");
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 */