[libssh2] Don't ignore transport errors when writing to channel (#804150)

Kamil Dudka kdudka at fedoraproject.org
Mon Mar 19 14:08:04 UTC 2012


commit 8e8214ab7732e85ccac59dec29a9fb6530b28570
Author: Kamil Dudka <kdudka at redhat.com>
Date:   Mon Mar 19 14:58:27 2012 +0100

    Don't ignore transport errors when writing to channel (#804150)

 libssh2-1.2.9-utf8.patch   |    2 +-
 libssh2-1.4.0-f4f229.patch |    2 +-
 libssh2-1.4.0-fed075.patch |   34 ++++++++++++++++++++++++++++++++++
 libssh2.spec               |    9 ++++++++-
 4 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/libssh2-1.2.9-utf8.patch b/libssh2-1.2.9-utf8.patch
index b41f6a2..1535fa5 100644
--- a/libssh2-1.2.9-utf8.patch
+++ b/libssh2-1.2.9-utf8.patch
@@ -1,6 +1,6 @@
 --- libssh2/NEWS
 +++ libssh2/NEWS
-@@ -2507,7 +2507,7 @@
+@@ -2886,7 +2886,7 @@
  - support arcfour128 cipher per RFC 4345
  
  Daniel Stenberg (21 Oct 2009)
diff --git a/libssh2-1.4.0-f4f229.patch b/libssh2-1.4.0-f4f229.patch
index d413f3f..2dee81a 100644
--- a/libssh2-1.4.0-f4f229.patch
+++ b/libssh2-1.4.0-f4f229.patch
@@ -26,7 +26,7 @@ index 40818c0..481982c 100644
  
  #include <openssl/aes.h>
  #include <openssl/evp.h>
-@@ -362,6 +362,8 @@ void _libssh2_init_aes_ctr(void)
+@@ -358,6 +358,8 @@ void _libssh2_init_aes_ctr(void)
      _libssh2_EVP_aes_256_ctr();
  }
  
diff --git a/libssh2-1.4.0-fed075.patch b/libssh2-1.4.0-fed075.patch
new file mode 100644
index 0000000..510a9cc
--- /dev/null
+++ b/libssh2-1.4.0-fed075.patch
@@ -0,0 +1,34 @@
+From fed075972080ed705bd79b731c40cf5e73085aeb Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel at haxx.se>
+Date: Thu, 15 Mar 2012 13:03:08 +0100
+Subject: [PATCH] channel_write: acknowledge transport errors
+
+When draining data off the socket with _libssh2_transport_read() (which
+in turn has to be done so that we can be sure to have read any possible
+window-increasing packets), this code previously ignored errors which
+could lead to nasty loops. Now all error codes except EAGAIN will cause
+the error to be returned at once.
+
+Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0068.shtml
+Reported by: Matthew Booth
+---
+ src/channel.c |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/src/channel.c b/src/channel.c
+index 8d6fb0a..9e29492 100644
+--- a/src/channel.c
++++ b/src/channel.c
+@@ -2008,6 +2008,9 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
+             rc = _libssh2_transport_read(session);
+         while (rc > 0);
+ 
++        if((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN))
++            return rc;
++
+         if(channel->local.window_size <= 0)
+             /* there's no room for data so we stop */
+             return (rc==LIBSSH2_ERROR_EAGAIN?rc:0);
+-- 
+1.7.1
+
diff --git a/libssh2.spec b/libssh2.spec
index 85700bf..57c53c9 100644
--- a/libssh2.spec
+++ b/libssh2.spec
@@ -9,7 +9,7 @@
 
 Name:		libssh2
 Version:	1.4.0
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	A library implementing the SSH2 protocol
 Group:		System Environment/Libraries
 License:	BSD
@@ -19,6 +19,7 @@ Patch0:		libssh2-1.2.9-utf8.patch
 Patch1:		libssh2-1.4.0-c4a0e0.patch
 Patch2:		libssh2-1.4.0-cc4f9d.patch
 Patch3:		libssh2-1.4.0-f4f229.patch
+Patch4:		libssh2-1.4.0-fed075.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
 BuildRequires:	openssl-devel
 BuildRequires:	zlib-devel
@@ -78,6 +79,9 @@ developing applications that use libssh2.
 # Don't try to use openssl's AES-CTR functions (upstream patch)
 %patch3 -p1
 
+# Don't ignore transport errors in channel_write (upstream patch, #804150)
+%patch4 -p1
+
 # Make sshd transition appropriately if building in an SELinux environment
 chcon $(/usr/sbin/matchpathcon -n /etc/rc.d/init.d/sshd) tests/ssh2.sh || :
 chcon -R $(/usr/sbin/matchpathcon -n /etc) tests/etc || :
@@ -139,6 +143,9 @@ rm -rf %{buildroot}
 %{_libdir}/pkgconfig/libssh2.pc
 
 %changelog
+* Mon Mar 19 2012 Kamil Dudka <kdudka at redhat.com> 1.4.0-4
+- Don't ignore transport errors when writing to channel (#804150)
+
 * Sun Mar 18 2012 Paul Howarth <paul at city-fan.org> 1.4.0-3
 - Don't try to use openssl's AES-CTR functions
   (http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0111.shtml)


More information about the scm-commits mailing list