diff --git a/.libssh2.metadata b/.libssh2.metadata new file mode 100644 index 0000000..2c41b87 --- /dev/null +++ b/.libssh2.metadata @@ -0,0 +1 @@ +c27ca83e1ffeeac03be98b6eef54448701e044b0 SOURCES/libssh2-1.4.3.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-sftp-seek-Don-t-flush-buffers-on-same-offset.patch b/SOURCES/0001-sftp-seek-Don-t-flush-buffers-on-same-offset.patch new file mode 100644 index 0000000..9acbd6d --- /dev/null +++ b/SOURCES/0001-sftp-seek-Don-t-flush-buffers-on-same-offset.patch @@ -0,0 +1,54 @@ +From 486bb376218a37fe15318d7724d6eada36b81e6c Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 26 Mar 2013 17:58:04 +0100 +Subject: [PATCH 1/3] sftp: seek: Don't flush buffers on same offset + +Signed-off-by: Richard W.M. Jones +--- + src/sftp.c | 27 +++++++++++++++------------ + 1 file changed, 15 insertions(+), 12 deletions(-) + +diff --git a/src/sftp.c b/src/sftp.c +index d0536dd..3760025 100644 +--- a/src/sftp.c ++++ b/src/sftp.c +@@ -2132,21 +2132,24 @@ libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *hnd, + LIBSSH2_API void + libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset) + { +- if(handle) { +- handle->u.file.offset = handle->u.file.offset_sent = offset; +- /* discard all pending requests and currently read data */ +- sftp_packetlist_flush(handle); ++ if(!handle) ++ return; ++ if(handle->u.file.offset == offset && handle->u.file.offset_sent == offset) ++ return; + +- /* free the left received buffered data */ +- if (handle->u.file.data_left) { +- LIBSSH2_FREE(handle->sftp->channel->session, handle->u.file.data); +- handle->u.file.data_left = handle->u.file.data_len = 0; +- handle->u.file.data = NULL; +- } ++ handle->u.file.offset = handle->u.file.offset_sent = offset; ++ /* discard all pending requests and currently read data */ ++ sftp_packetlist_flush(handle); + +- /* reset EOF to False */ +- handle->u.file.eof = FALSE; ++ /* free the left received buffered data */ ++ if (handle->u.file.data_left) { ++ LIBSSH2_FREE(handle->sftp->channel->session, handle->u.file.data); ++ handle->u.file.data_left = handle->u.file.data_len = 0; ++ handle->u.file.data = NULL; + } ++ ++ /* reset EOF to False */ ++ handle->u.file.eof = FALSE; + } + + /* libssh2_sftp_seek +-- +1.8.1.4 + diff --git a/SOURCES/0002-sftp-statvfs-Along-error-path-reset-the-correct-stat.patch b/SOURCES/0002-sftp-statvfs-Along-error-path-reset-the-correct-stat.patch new file mode 100644 index 0000000..83ca15e --- /dev/null +++ b/SOURCES/0002-sftp-statvfs-Along-error-path-reset-the-correct-stat.patch @@ -0,0 +1,26 @@ +From a12f3ffab579b514eeb7fdfaca0ade271961cdb4 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 8 Apr 2013 17:30:10 +0100 +Subject: [PATCH 2/3] sftp: statvfs: Along error path, reset the correct + 'state' variable. + +--- + src/sftp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sftp.c b/src/sftp.c +index 3760025..65fa77a 100644 +--- a/src/sftp.c ++++ b/src/sftp.c +@@ -2752,7 +2752,7 @@ static int sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path, + "Error waiting for FXP EXTENDED REPLY"); + } else if (data_len < 93) { + LIBSSH2_FREE(session, data); +- sftp->fstatvfs_state = libssh2_NB_state_idle; ++ sftp->statvfs_state = libssh2_NB_state_idle; + return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, + "SFTP Protocol Error: short response"); + } +-- +1.8.1.4 + diff --git a/SOURCES/0003-sftp-Add-support-for-fsync-OpenSSH-extension.patch b/SOURCES/0003-sftp-Add-support-for-fsync-OpenSSH-extension.patch new file mode 100644 index 0000000..cc1cbb4 --- /dev/null +++ b/SOURCES/0003-sftp-Add-support-for-fsync-OpenSSH-extension.patch @@ -0,0 +1,223 @@ +From 6e0d757f24a45252c4cae9ea09732eda2562c767 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 9 Apr 2013 11:42:09 +0200 +Subject: [PATCH 3/3] sftp: Add support for fsync (OpenSSH extension). + +The new libssh2_sftp_fsync API causes data and metadata in the +currently open file to be committed to disk at the server. + +This is an OpenSSH extension to the SFTP protocol. See: + +https://bugzilla.mindrot.org/show_bug.cgi?id=1798 +--- + docs/Makefile.am | 1 + + docs/libssh2_sftp_fsync.3 | 39 +++++++++++++++++++ + include/libssh2_sftp.h | 1 + + src/sftp.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++ + src/sftp.h | 5 +++ + 5 files changed, 143 insertions(+) + create mode 100644 docs/libssh2_sftp_fsync.3 + +diff --git a/docs/Makefile.am b/docs/Makefile.am +index e4cf487..e6ab394 100644 +--- a/docs/Makefile.am ++++ b/docs/Makefile.am +@@ -120,6 +120,7 @@ dist_man_MANS = \ + libssh2_sftp_fstat.3 \ + libssh2_sftp_fstat_ex.3 \ + libssh2_sftp_fstatvfs.3 \ ++ libssh2_sftp_fsync.3 \ + libssh2_sftp_get_channel.3 \ + libssh2_sftp_init.3 \ + libssh2_sftp_last_error.3 \ +diff --git a/docs/libssh2_sftp_fsync.3 b/docs/libssh2_sftp_fsync.3 +new file mode 100644 +index 0000000..646760a +--- /dev/null ++++ b/docs/libssh2_sftp_fsync.3 +@@ -0,0 +1,39 @@ ++.TH libssh2_sftp_fsync 3 "8 Apr 2013" "libssh2 1.4.4" "libssh2 manual" ++.SH NAME ++libssh2_sftp_fsync - synchronize file to disk ++.SH SYNOPSIS ++.nf ++#include ++#include ++ ++int ++libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *handle) ++.fi ++.SH DESCRIPTION ++This function causes the remote server to synchronize the file ++data and metadata to disk (like fsync(2)). ++ ++For this to work requires fsync@openssh.com support on the server. ++ ++\fIhandle\fP - SFTP File Handle as returned by ++.BR libssh2_sftp_open_ex(3) ++ ++.SH RETURN VALUE ++Returns 0 on success or negative on failure. If used in non-blocking mode, it ++returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While ++LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. ++.SH ERRORS ++\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. ++ ++\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. ++ ++\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response ++was received on the socket, or an SFTP operation caused an errorcode ++to be returned by the server. In particular, this can be returned if ++the SSH server does not support the fsync operation: the SFTP subcode ++\fILIBSSH2_FX_OP_UNSUPPORTED\fP will be returned in this case. ++ ++.SH AVAILABILITY ++Added in libssh2 1.4.4 and OpenSSH 6.3. ++.SH SEE ALSO ++.BR fsync(2) +diff --git a/include/libssh2_sftp.h b/include/libssh2_sftp.h +index 74884fb..677faf2 100644 +--- a/include/libssh2_sftp.h ++++ b/include/libssh2_sftp.h +@@ -247,6 +247,7 @@ LIBSSH2_API int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, \ + + LIBSSH2_API ssize_t libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle, + const char *buffer, size_t count); ++LIBSSH2_API int libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *handle); + + LIBSSH2_API int libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle); + #define libssh2_sftp_close(handle) libssh2_sftp_close_handle(handle) +diff --git a/src/sftp.c b/src/sftp.c +index 65fa77a..01017fd 100644 +--- a/src/sftp.c ++++ b/src/sftp.c +@@ -986,6 +986,10 @@ sftp_shutdown(LIBSSH2_SFTP *sftp) + LIBSSH2_FREE(session, sftp->symlink_packet); + sftp->symlink_packet = NULL; + } ++ if (sftp->fsync_packet) { ++ LIBSSH2_FREE(session, sftp->fsync_packet); ++ sftp->fsync_packet = NULL; ++ } + + sftp_packet_flush(sftp); + +@@ -2014,6 +2018,99 @@ libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *hnd, const char *buffer, + + } + ++static int sftp_fsync(LIBSSH2_SFTP_HANDLE *handle) ++{ ++ LIBSSH2_SFTP *sftp = handle->sftp; ++ LIBSSH2_CHANNEL *channel = sftp->channel; ++ LIBSSH2_SESSION *session = channel->session; ++ /* 34 = packet_len(4) + packet_type(1) + request_id(4) + ++ string_len(4) + strlen("fsync@openssh.com")(17) + handle_len(4) */ ++ uint32_t packet_len = handle->handle_len + 34; ++ size_t data_len; ++ unsigned char *packet, *s, *data; ++ ssize_t rc; ++ uint32_t retcode; ++ ++ if (sftp->fsync_state == libssh2_NB_state_idle) { ++ _libssh2_debug(session, LIBSSH2_TRACE_SFTP, ++ "Issuing fsync command"); ++ s = packet = LIBSSH2_ALLOC(session, packet_len); ++ if (!packet) { ++ return _libssh2_error(session, LIBSSH2_ERROR_ALLOC, ++ "Unable to allocate memory for FXP_EXTENDED " ++ "packet"); ++ } ++ ++ _libssh2_store_u32(&s, packet_len - 4); ++ *(s++) = SSH_FXP_EXTENDED; ++ sftp->fsync_request_id = sftp->request_id++; ++ _libssh2_store_u32(&s, sftp->fsync_request_id); ++ _libssh2_store_str(&s, "fsync@openssh.com", 17); ++ _libssh2_store_str(&s, handle->handle, handle->handle_len); ++ ++ sftp->fsync_state = libssh2_NB_state_created; ++ } else { ++ packet = sftp->fsync_packet; ++ } ++ ++ if (sftp->fsync_state == libssh2_NB_state_created) { ++ rc = _libssh2_channel_write(channel, 0, packet, packet_len); ++ if (rc == LIBSSH2_ERROR_EAGAIN || ++ (0 <= rc && rc < (ssize_t)packet_len)) { ++ sftp->fsync_packet = packet; ++ return LIBSSH2_ERROR_EAGAIN; ++ } ++ ++ LIBSSH2_FREE(session, packet); ++ sftp->fsync_packet = NULL; ++ ++ if (rc < 0) { ++ sftp->fsync_state = libssh2_NB_state_idle; ++ return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, ++ "_libssh2_channel_write() failed"); ++ } ++ sftp->fsync_state = libssh2_NB_state_sent; ++ } ++ ++ rc = sftp_packet_require(sftp, SSH_FXP_STATUS, ++ sftp->fsync_request_id, &data, &data_len); ++ if (rc == LIBSSH2_ERROR_EAGAIN) { ++ return rc; ++ } else if (rc) { ++ sftp->fsync_state = libssh2_NB_state_idle; ++ return _libssh2_error(session, rc, ++ "Error waiting for FXP EXTENDED REPLY"); ++ } ++ ++ sftp->fsync_state = libssh2_NB_state_idle; ++ ++ retcode = _libssh2_ntohu32(data + 5); ++ LIBSSH2_FREE(session, data); ++ ++ if (retcode != LIBSSH2_FX_OK) { ++ sftp->last_errno = retcode; ++ return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, ++ "fsync failed"); ++ } ++ ++ return 0; ++} ++ ++/* libssh2_sftp_fsync ++ * Commit data on the handle to disk. ++ */ ++LIBSSH2_API int ++libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *hnd) ++{ ++ int rc; ++ if(!hnd) ++ return LIBSSH2_ERROR_BAD_USE; ++ BLOCK_ADJUST(rc, hnd->sftp->channel->session, ++ sftp_fsync(hnd)); ++ return rc; ++} ++ ++ + /* + * sftp_fstat + * +diff --git a/src/sftp.h b/src/sftp.h +index 55bdb46..63e8139 100644 +--- a/src/sftp.h ++++ b/src/sftp.h +@@ -175,6 +175,11 @@ struct _LIBSSH2_SFTP + /* State variable used in sftp_write() */ + libssh2_nonblocking_states write_state; + ++ /* State variables used in sftp_fsync() */ ++ libssh2_nonblocking_states fsync_state; ++ unsigned char *fsync_packet; ++ uint32_t fsync_request_id; ++ + /* State variables used in libssh2_sftp_readdir() */ + libssh2_nonblocking_states readdir_state; + unsigned char *readdir_packet; +-- +1.8.1.4 + diff --git a/SOURCES/0004-partially-revert-window_size-explicit-adjustments-on.patch b/SOURCES/0004-partially-revert-window_size-explicit-adjustments-on.patch new file mode 100644 index 0000000..fe7751a --- /dev/null +++ b/SOURCES/0004-partially-revert-window_size-explicit-adjustments-on.patch @@ -0,0 +1,69 @@ +From 9e56b84c41efcaf3349f82a93c3dc854e172e5c4 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Fri, 9 Aug 2013 16:22:08 +0200 +Subject: [PATCH 4/5] partially revert "window_size: explicit adjustments only" + +This partially reverts commit 03ca9020756a4e16f0294e5b35e9826ee6af2364 +in order to fix extreme slowdown when uploading to localhost via SFTP. + +I was able to repeat the issue on RHEL-7 on localhost only. It did not +occur when uploading via network and it did not occur on a RHEL-6 box +with the same version of libssh2. + +The problem was that sftp_read() used a read-ahead logic to figure out +the window_size, but sftp_packet_read() called indirectly from +sftp_write() did not use any read-ahead logic. +--- + src/channel.c | 29 +++++++++++++++++++++++++++++ + 1 files changed, 29 insertions(+), 0 deletions(-) + +diff --git a/src/channel.c b/src/channel.c +index 4f41e1f..d4ffdce 100644 +--- a/src/channel.c ++++ b/src/channel.c +@@ -1759,6 +1759,15 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, + channel->read_state = libssh2_NB_state_created; + } + ++ /* ++ * =============================== NOTE =============================== ++ * I know this is very ugly and not a really good use of "goto", but ++ * this case statement would be even uglier to do it any other way ++ */ ++ if (channel->read_state == libssh2_NB_state_jump1) { ++ goto channel_read_window_adjust; ++ } ++ + rc = 1; /* set to >0 to let the while loop start */ + + /* Process all pending incoming packets in all states in order to "even +@@ -1867,6 +1876,26 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, + more off the network again */ + channel->read_state = libssh2_NB_state_created; + ++ if(channel->remote.window_size < (LIBSSH2_CHANNEL_WINDOW_DEFAULT*30)) { ++ /* the window is getting too narrow, expand it! */ ++ ++ channel_read_window_adjust: ++ channel->read_state = libssh2_NB_state_jump1; ++ /* the actual window adjusting may not finish so we need to deal with ++ this special state here */ ++ rc = _libssh2_channel_receive_window_adjust(channel, ++ (LIBSSH2_CHANNEL_WINDOW_DEFAULT*60), 0, NULL); ++ if (rc) ++ return rc; ++ ++ _libssh2_debug(session, LIBSSH2_TRACE_CONN, ++ "channel_read() filled %d adjusted %d", ++ bytes_read, buflen); ++ /* continue in 'created' state to drain the already read packages ++ first before starting to empty the socket further */ ++ channel->read_state = libssh2_NB_state_created; ++ } ++ + return bytes_read; + } + +-- +1.7.1 + diff --git a/SOURCES/0005-channel.c-fix-a-use-after-free.patch b/SOURCES/0005-channel.c-fix-a-use-after-free.patch new file mode 100644 index 0000000..8fa0a05 --- /dev/null +++ b/SOURCES/0005-channel.c-fix-a-use-after-free.patch @@ -0,0 +1,26 @@ +From 96e1078fced70e39e4163857ad8345ae9d24573f Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Wed, 14 Aug 2013 17:37:00 +0200 +Subject: [PATCH 5/5] channel.c: fix a use after free + +Bug: https://trac.libssh2.org/ticket/268 +--- + src/channel.c | 2 -- + 1 files changed, 0 insertions(+), 2 deletions(-) + +diff --git a/src/channel.c b/src/channel.c +index d4ffdce..9f2c241 100644 +--- a/src/channel.c ++++ b/src/channel.c +@@ -670,8 +670,6 @@ int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener) + + LIBSSH2_FREE(session, listener); + +- listener->chanFwdCncl_state = libssh2_NB_state_idle; +- + return 0; + } + +-- +1.7.1 + diff --git a/SOURCES/libssh2-1.4.2-utf8.patch b/SOURCES/libssh2-1.4.2-utf8.patch new file mode 100644 index 0000000..9177691 --- /dev/null +++ b/SOURCES/libssh2-1.4.2-utf8.patch @@ -0,0 +1,14 @@ + NEWS | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +--- libssh2/NEWS ++++ libssh2/NEWS +@@ -3552,7 +3552,7 @@ Simon Josefsson (16 Nov 2009) + - support arcfour128 cipher per RFC 4345 + + Daniel Stenberg (21 Oct 2009) +-- [Cristian Rodríguez brought this change] ++- [Cristian Rodríguez brought this change] + + add support for GCC visibility features + diff --git a/SPECS/libssh2.spec b/SPECS/libssh2.spec new file mode 100644 index 0000000..1a15f77 --- /dev/null +++ b/SPECS/libssh2.spec @@ -0,0 +1,367 @@ +# Fedora 10 onwards support noarch subpackages; by using one, we can +# put the arch-independent docs in a common subpackage and save lots +# of space on the mirrors +%if 0%{?fedora} > 9 || 0%{?rhel} > 5 +%global noarch_docs_package 1 +%else +%global noarch_docs_package 0 +%endif + +# Define %%{__isa_bits} for old releases +%{!?__isa_bits: %global __isa_bits %((echo '#include '; echo __WORDSIZE) | cpp - | grep -Ex '32|64')} + +Name: libssh2 +Version: 1.4.3 +Release: 6%{?dist} +Summary: A library implementing the SSH2 protocol +Group: System Environment/Libraries +License: BSD +URL: http://www.libssh2.org/ +Source0: http://libssh2.org/download/libssh2-%{version}.tar.gz +Patch0: libssh2-1.4.2-utf8.patch +Patch1: 0001-sftp-seek-Don-t-flush-buffers-on-same-offset.patch +Patch2: 0002-sftp-statvfs-Along-error-path-reset-the-correct-stat.patch +Patch3: 0003-sftp-Add-support-for-fsync-OpenSSH-extension.patch +Patch4: 0004-partially-revert-window_size-explicit-adjustments-on.patch +Patch5: 0005-channel.c-fix-a-use-after-free.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu) +BuildRequires: openssl-devel +BuildRequires: zlib-devel +BuildRequires: /usr/bin/man + +# Test suite requirements - we run the OpenSSH server and try to connect to it +BuildRequires: openssh-server +# We use matchpathcon to get the correct SELinux context for the ssh server +# initialization script so that it can transition correctly in an SELinux +# environment; matchpathcon is only available from FC-4 and moved from the +# libselinux to libselinux-utils package in F-10 +%if (0%{?fedora} >= 4 || 0%{?rhel} >= 5) && !(0%{?fedora} >=17 || 0%{?rhel} >=7) +BuildRequires: /usr/sbin/matchpathcon selinux-policy-targeted +%endif + +%description +libssh2 is a library implementing the SSH2 protocol as defined by +Internet Drafts: SECSH-TRANS(22), SECSH-USERAUTH(25), +SECSH-CONNECTION(23), SECSH-ARCH(20), SECSH-FILEXFER(06)*, +SECSH-DHGEX(04), and SECSH-NUMBERS(10). + +%package devel +Summary: Development files for libssh2 +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +The libssh2-devel package contains libraries and header files for +developing applications that use libssh2. + +%package docs +Summary: Documentation for libssh2 +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +%if %{noarch_docs_package} +BuildArch: noarch +%endif + +%description docs +The libssh2-docs package contains man pages and examples for +developing applications that use libssh2. + +%prep +%setup -q + +# Replace hard wired port number in the test suite to avoid collisions +# between 32-bit and 64-bit builds running on a single build-host +sed -i s/4711/47%{?__isa_bits}/ tests/ssh2.{c,sh} + +# Make sure things are UTF-8... +%patch0 -p1 + +# Three upstream patches required for qemu ssh block driver. +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + +# http://thread.gmane.org/gmane.network.ssh.libssh2.devel/6428 +%patch4 -p1 + +# https://trac.libssh2.org/ticket/268 +%patch5 -p1 + +# Make sshd transition appropriately if building in an SELinux environment +%if !(0%{?fedora} >= 17 || 0%{?rhel} >= 7) +chcon $(/usr/sbin/matchpathcon -n /etc/rc.d/init.d/sshd) tests/ssh2.sh || : +chcon -R $(/usr/sbin/matchpathcon -n /etc) tests/etc || : +chcon $(/usr/sbin/matchpathcon -n /etc/ssh/ssh_host_key) tests/etc/{host,user} || : +%endif + +%build +%configure --disable-static --enable-shared +make %{?_smp_mflags} + +# Avoid polluting libssh2.pc with linker options (#947813) +sed -i -e 's|[[:space:]]-Wl,[^[:space:]]*||' libssh2.pc + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} INSTALL="install -p" +find %{buildroot} -name '*.la' -exec rm -f {} \; + +# clean things up a bit for packaging +make -C example clean +rm -rf example/.deps +find example/ -type f '(' -name '*.am' -o -name '*.in' ')' -exec rm -v {} \; + +# avoid multilib conflict on libssh2-devel +mv -v example example.%{_arch} + +%check +# The SSH test will fail if we don't have /dev/tty, as is the case in some +# versions of mock (#672713) +if [ ! -c /dev/tty ]; then + echo Skipping SSH test due to missing /dev/tty + echo "exit 0" > tests/ssh2.sh +fi +# Apparently it fails in the sparc and arm buildsystems too +%ifarch %{sparc} %{arm} +echo Skipping SSH test on sparc/arm +echo "exit 0" > tests/ssh2.sh +%endif +make -C tests check + +%clean +rm -rf %{buildroot} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%doc AUTHORS ChangeLog COPYING README NEWS +%{_libdir}/libssh2.so.1 +%{_libdir}/libssh2.so.1.* + +%files docs +%doc HACKING +%{_mandir}/man3/libssh2_*.3* + +%files devel +%doc example.%{_arch}/ +%{_includedir}/libssh2.h +%{_includedir}/libssh2_publickey.h +%{_includedir}/libssh2_sftp.h +%{_libdir}/libssh2.so +%{_libdir}/pkgconfig/libssh2.pc + +%changelog +* Wed Aug 14 2013 Kamil Dudka 1.4.3-6 +- fix very slow sftp upload to localhost +- fix a use after free in channel.c + +* Tue Apr 9 2013 Richard W.M. Jones 1.4.3-5 +- Add three patches from upstream git required for qemu ssh block driver. + +* Wed Apr 3 2013 Paul Howarth 1.4.3-4 +- Avoid polluting libssh2.pc with linker options (#947813) + +* Tue Mar 26 2013 Kamil Dudka 1.4.3-3 +- Avoid collisions between 32-bit and 64-bit builds running on a single build + host + +* Thu Feb 14 2013 Fedora Release Engineering - 1.4.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Nov 28 2012 Paul Howarth 1.4.3-1 +- Update to 1.4.3 + - compression: add support for zlib@openssh.com + - sftp_read: return error if a too large package arrives + - libssh2_hostkey_hash.3: update the description of return value + - Fixed MSVC NMakefile + - examples: use stderr for messages, stdout for data + - openssl: do not leak memory when handling errors + - improved handling of disabled MD5 algorithm in OpenSSL + - known_hosts: Fail when parsing unknown keys in known_hosts file + - configure: gcrypt doesn't come with pkg-config support + - session_free: wrong variable used for keeping state + - libssh2_userauth_publickey_fromfile_ex.3: mention publickey == NULL + - comp_method_zlib_decomp: handle Z_BUF_ERROR when inflating +- Drop upstreamed patches + +* Wed Nov 07 2012 Kamil Dudka 1.4.2-4 +- examples: use stderr for messages, stdout for data (upstream commit b31e35ab) +- Update libssh2_hostkey_hash(3) man page (upstream commit fe8f3deb) + +* Wed Sep 26 2012 Kamil Dudka 1.4.2-3 +- Fix basic functionality of libssh2 in FIPS mode +- Skip SELinux-related quirks on recent distros to prevent a test-suite failure + +* Thu Jul 19 2012 Fedora Release Engineering - 1.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sun May 20 2012 Paul Howarth 1.4.2-1 +- Update to 1.4.2 + - Return LIBSSH2_ERROR_SOCKET_DISCONNECT on EOF when reading banner + - userauth.c: fread() from public key file to correctly detect any errors + - configure.ac: add option to disable build of the example applications + - added 'Requires.private:' line to libssh2.pc + - SFTP: filter off incoming "zombie" responses + - gettimeofday: no need for a replacement under cygwin + - SSH_MSG_CHANNEL_REQUEST: default to want_reply + - win32/libssh2_config.h: remove hardcoded #define LIBSSH2_HAVE_ZLIB + +* Fri Apr 27 2012 Paul Howarth 1.4.1-2 +- Fix multi-arch conflict again (#816969) + +* Thu Apr 5 2012 Paul Howarth 1.4.1-1 +- Update to 1.4.1 + - Build error with gcrypt backend + - Always do "forced" window updates to avoid corner case stalls + - aes: the init function fails when OpenSSL has AES support + - transport_send: finish in-progress key exchange before sending data + - channel_write: acknowledge transport errors + - examples/x11.c: make sure sizeof passed to read operation is correct + - examples/x11.c: fix suspicious sizeof usage + - sftp_packet_add: verify the packet before accepting it + - SFTP: preserve the original error code more + - sftp_packet_read: adjust window size as necessary + - Use safer snprintf rather then sprintf in several places + - Define and use LIBSSH2_INVALID_SOCKET instead of INVALID_SOCKET + - sftp_write: cannot return acked data *and* EAGAIN + - sftp_read: avoid data *and* EAGAIN + - libssh2.h: add missing prototype for libssh2_session_banner_set() +- Drop upstream patches now included in release tarball + +* Mon Mar 19 2012 Kamil Dudka 1.4.0-4 +- Don't ignore transport errors when writing to channel (#804150) + +* Sun Mar 18 2012 Paul Howarth 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) + +* Fri Mar 16 2012 Paul Howarth 1.4.0-2 +- fix libssh2 failing key re-exchange when write channel is saturated (#804156) +- drop %%defattr, redundant since rpm 4.4 + +* Wed Feb 1 2012 Paul Howarth 1.4.0-1 +- update to 1.4.0 + - added libssh2_session_supported_algs() + - added libssh2_session_banner_get() + - added libssh2_sftp_get_channel() + - libssh2.h: bump the default window size to 256K + - sftp-seek: clear EOF flag + - userauth: provide more informations if ssh pub key extraction fails + - ssh2_exec: skip error outputs for EAGAIN + - LIBSSH2_SFTP_PACKET_MAXLEN: increase to 80000 + - knownhost_check(): don't dereference ext if NULL is passed + - knownhost_add: avoid dereferencing uninitialized memory on error path + - OpenSSL EVP: fix threaded use of structs + - _libssh2_channel_read: react on errors from receive_window_adjust + - sftp_read: cap the read ahead maximum amount + - _libssh2_channel_read: fix non-blocking window adjusting +- add upstream patch fixing undefined function reference in libgcrypt backend +- BR: /usr/bin/man for test suite + +* Sun Jan 15 2012 Peter Robinson 1.3.0-4 +- skip the ssh test on ARM too + +* Fri Jan 13 2012 Paul Howarth 1.3.0-3 +- make docs package noarch where possible +- example includes arch-specific bits, so move to devel package +- use patch rather than scripted iconv to fix character encoding +- don't make assumptions about SELinux context types used for the ssh server + in the test suite +- skip the ssh test if /dev/tty isn't present, as in some versions of mock +- make the %%files list more explicit +- use tabs for indentation + +* Fri Jan 13 2012 Fedora Release Engineering 1.3.0-2 +- rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Sep 08 2011 Kamil Dudka 1.3.0-1 +- update to 1.3.0 + +* Sat Jun 25 2011 Dennis Gilmore 1.2.7-2 +- sshd/loopback test fails in the sparc buildsystem + +* Tue Oct 12 2010 Kamil Dudka 1.2.7-1 +- update to 1.2.7 (#632916) +- avoid multilib conflict on libssh2-docs +- avoid build failure in mock with SELinux in the enforcing mode (#558964) + +* Fri Mar 12 2010 Chris Weyl 1.2.4-1 +- update to 1.2.4 +- drop old patch0 +- be more aggressive about keeping .deps from intruding into -docs + +* Wed Jan 20 2010 Chris Weyl 1.2.2-5 +- pkgconfig dep should be with -devel, not -docs + +* Mon Jan 18 2010 Chris Weyl 1.2.2-4 +- enable tests; conditionalize sshd test, which fails with a funky SElinux + error when run locally + +* Mon Jan 18 2010 Chris Weyl 1.2.2-3 +- patch w/1aba38cd7d2658146675ce1737e5090f879f306; not yet in a GA release + +* Thu Jan 14 2010 Chris Weyl 1.2.2-2 +- correct bad file entry under -devel + +* Thu Jan 14 2010 Chris Weyl 1.2.2-1 +- update to 1.2.2 +- drop old patch now in upstream +- add new pkgconfig file to -devel + +* Mon Sep 21 2009 Chris Weyl 1.2-2 +- patch based on 683aa0f6b52fb1014873c961709102b5006372fc +- disable tests (*sigh*) + +* Tue Aug 25 2009 Chris Weyl 1.2-1 +- update to 1.2 + +* Fri Aug 21 2009 Tomas Mraz - 1.0-4 +- rebuilt with new openssl + +* Sat Jul 25 2009 Fedora Release Engineering - 1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 16 2009 Chris Weyl 1.0-1 +- update to 1.0 + +* Sat Jan 17 2009 Tomas Mraz - 0.18-8 +- rebuild with new openssl + +* Mon Feb 18 2008 Fedora Release Engineering - 0.18-7 +- Autorebuild for GCC 4.3 + +* Wed Dec 05 2007 Chris Weyl 0.18-6 +- rebuild for new openssl... + +* Tue Nov 27 2007 Chris Weyl 0.18-5 +- bump + +* Tue Nov 27 2007 Chris Weyl 0.18-4 +- add INSTALL arg to make install vs env. var + +* Mon Nov 26 2007 Chris Weyl 0.18-3 +- run tests; don't package test + +* Sun Nov 18 2007 Chris Weyl 0.18-2 +- split docs into -docs (they seemed... large.) + +* Tue Nov 13 2007 Chris Weyl 0.18-1 +- update to 0.18 + +* Sun Oct 14 2007 Chris Weyl 0.17-1 +- update to 0.17 +- many spec file changes + +* Wed May 23 2007 Sindre Pedersen Bjørdal - 0.15-0.2.20070506 +- Fix release tag +- Move manpages to -devel package +- Add Examples dir to -devel package + +* Sun May 06 2007 Sindre Pedersen Bjørdal - 0.15-0.20070506.1 +- Initial build