Hello community,

here is the log from the commit of package libssh for openSUSE:Factory checked 
in at 2012-02-10 17:17:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libssh (Old)
 and      /work/SRC/openSUSE:Factory/.libssh.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libssh", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libssh/libssh.changes    2011-09-23 
02:10:53.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libssh.new/libssh.changes       2012-02-10 
17:17:27.000000000 +0100
@@ -1,0 +2,31 @@
+Tue Feb  7 13:34:00 UTC 2012 - [email protected]
+
+- Ensure pkgconfig symbols are provided
+
+-------------------------------------------------------------------
+Tue Jan 31 10:36:26 UTC 2012 - [email protected]
+
+- Remove redundant tags/sections per specfile guideline suggestions
+- Parallel building using %_smp_mflags
+- Make pkgconfig provides available
+- Add patch to work around compilation problems on SLES11SP1
+
+-------------------------------------------------------------------
+Sat Sep 17 07:00:53 UTC 2011 - [email protected]
+
+- Update to version 0.5.2
+  * Increased window size x10.
+  * Fixed SSHv1.
+  * Fixed bugged lists.
+  * Fixed use-after-free + inconsistent callbacks call in poll.
+  * Fixed scp documentation.
+  * Fixed possible infinite loop in channel_read().
+  * Fixed handling of short reads of sftp_async_read().
+  * Fixed handling request service timeout in blocking mode.
+  * Fixed ssh_auth_list() documentation.
+  * Fixed incorrect return values in ssh_channel_write().
+  * Fixed an infinite loop in the termination callback.
+  * Fixed handling of SSH_AGAIN in channel_open().
+  * Fixed "status -5 inflating zlib packet"
+
+-------------------------------------------------------------------

Old:
----
  libssh-0.5.1.tar.bz2

New:
----
  libssh-0.5.2.tar.bz2
  remove-pedantic-errors.diff

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libssh.spec ++++++
--- /var/tmp/diff_new_pack.gof0Hf/_old  2012-02-10 17:17:29.000000000 +0100
+++ /var/tmp/diff_new_pack.gof0Hf/_new  2012-02-10 17:17:29.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libssh
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,20 +15,23 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
 
 Url:            http://www.libssh.org
 
 Name:           libssh
-BuildRequires:  cmake doxygen gcc-c++ openssl-devel
-License:        LGPL v2.1 or later
-Group:          System/Libraries
-Version:        0.5.1
-Release:        1
+BuildRequires:  cmake
+BuildRequires:  doxygen
+BuildRequires:  gcc-c++
+BuildRequires:  openssl-devel
+BuildRequires:  pkgconfig
+Version:        0.5.2
+Release:        0
 Summary:        SSH library
+License:        LGPL-2.1+
+Group:          System/Libraries
 Source0:        %{name}-%{version}.tar.bz2
+Patch1:         remove-pedantic-errors.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%define debug_package_requires libssh4 = %{version}-%{release}
 
 %description
 The ssh library was designed to be used by programmers needing a
@@ -43,18 +46,9 @@
 be confused with libssh2 available from http://www.libssh2.org (libssh2
 package)
 
-
-
-Authors:
---------
-    Aris Adamantiadis <[email protected]>
-    Andreas Schneider <[email protected]>
-    Nick Zitzmann <[email protected]>
-
 %package -n libssh4
-License:        LGPL v2.1 or later
-Group:          System/Libraries
 Summary:        SSH library
+Group:          System/Libraries
 
 %description -n libssh4
 The ssh library was designed to be used by programmers needing a
@@ -69,49 +63,26 @@
 be confused with libssh2 available from http://www.libssh2.org (libssh2
 package)
 
-
-
-Authors:
---------
-    Aris Adamantiadis <[email protected]>
-    Andreas Schneider <[email protected]>
-    Nick Zitzmann <[email protected]>
-
 %package devel
-License:        LGPL v2.1 or later
-Group:          Development/Libraries/C and C++
 Summary:        SSH library development headers
+Group:          Development/Libraries/C and C++
 Requires:       libssh4 = %{version}
 
 %description devel
 Development headers for the SSH library.
 
-
-
-Authors:
---------
-    Aris Adamantiadis <[email protected]>
-    Andreas Schneider <[email protected]>
-    Nick Zitzmann <[email protected]>
-
 %package devel-doc
-License:        LGPL v2.1 or later
-Group:          Development/Languages/C and C++
 Summary:        SSH library api documentation
+Group:          Development/Languages/C and C++
 
 %description devel-doc
 Documentation for libssh development.
 
-
-
-Authors:
---------
-    Aris Adamantiadis <[email protected]>
-    Andreas Schneider <[email protected]>
-    Nick Zitzmann <[email protected]>
-
 %prep
 %setup -q
+%if "%{?sles_version}" == "11"
+%patch -P 1 -p1
+%endif
 
 %build
 if test ! -e "build"; then
@@ -128,7 +99,7 @@
 %endif
   %{_builddir}/%{name}-%{version}
 
-%__make %{?jobs:-j%jobs} VERBOSE=1
+make %{?_smp_mflags} VERBOSE=1
 %__make doc
 popd build
 
@@ -141,14 +112,9 @@
 %endif
 popd build
 
-%post -n libssh4
-/sbin/ldconfig
-
-%postun -n libssh4
-/sbin/ldconfig
+%post -n libssh4 -p /sbin/ldconfig
 
-%clean
-%{__rm} -rf %{buildroot}
+%postun -n libssh4 -p /sbin/ldconfig
 
 %files -n libssh4
 %defattr(-,root,root)

++++++ libssh-0.5.1.tar.bz2 -> libssh-0.5.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/CMakeLists.txt 
new/libssh-0.5.2/CMakeLists.txt
--- old/libssh-0.5.1/CMakeLists.txt     2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/CMakeLists.txt     2011-09-16 21:57:36.000000000 +0200
@@ -8,7 +8,7 @@
 
 set(APPLICATION_VERSION_MAJOR "0")
 set(APPLICATION_VERSION_MINOR "5")
-set(APPLICATION_VERSION_PATCH "1")
+set(APPLICATION_VERSION_PATCH "2")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -19,7 +19,7 @@
 #     Increment AGE. Set REVISION to 0
 #   If the source code was changed, but there were no interface changes:
 #     Increment REVISION.
-set(LIBRARY_VERSION "4.2.1")
+set(LIBRARY_VERSION "4.2.2")
 set(LIBRARY_SOVERSION "4")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is 
checked
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/CPackConfig.cmake 
new/libssh-0.5.2/CPackConfig.cmake
--- old/libssh-0.5.1/CPackConfig.cmake  2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/CPackConfig.cmake  2011-09-16 21:57:36.000000000 +0200
@@ -13,7 +13,7 @@
 ### versions
 set(CPACK_PACKAGE_VERSION_MAJOR "0")
 set(CPACK_PACKAGE_VERSION_MINOR "5")
-set(CPACK_PACKAGE_VERSION_PATCH "1")
+set(CPACK_PACKAGE_VERSION_PATCH "2")
 set(CPACK_PACKAGE_VERSION 
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/ChangeLog new/libssh-0.5.2/ChangeLog
--- old/libssh-0.5.1/ChangeLog  2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/ChangeLog  2011-09-16 21:57:36.000000000 +0200
@@ -1,6 +1,21 @@
 ChangeLog
 ==========
 
+version 0.5.2 (released 2011-09-17)
+  * Increased window size x10.
+  * Fixed SSHv1.
+  * Fixed bugged lists.
+  * Fixed use-after-free + inconsistent callbacks call in poll.
+  * Fixed scp documentation.
+  * Fixed possible infinite loop in channel_read().
+  * Fixed handling of short reads of sftp_async_read().
+  * Fixed handling request service timeout in blocking mode.
+  * Fixed ssh_auth_list() documentation.
+  * Fixed incorrect return values in ssh_channel_write().
+  * Fixed an infinite loop in the termination callback.
+  * Fixed handling of SSH_AGAIN in channel_open().
+  * Fixed "status -5 inflating zlib packet"
+
 version 0.5.1 (released 2011-08-09)
   * Added checks for NULL pointers in string.c.
   * Set the channel max packet size to 32768.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/include/libssh/channels.h 
new/libssh-0.5.2/include/libssh/channels.h
--- old/libssh-0.5.1/include/libssh/channels.h  2011-08-09 14:48:21.000000000 
+0200
+++ new/libssh-0.5.2/include/libssh/channels.h  2011-09-16 21:57:36.000000000 
+0200
@@ -48,8 +48,6 @@
 };
 
 struct ssh_channel_struct {
-    struct ssh_channel_struct *prev;
-    struct ssh_channel_struct *next;
     ssh_session session; /* SSH_SESSION pointer */
     uint32_t local_channel;
     uint32_t local_window;
@@ -95,6 +93,7 @@
 #ifdef WITH_SSH1
 SSH_PACKET_CALLBACK(ssh_packet_data1);
 SSH_PACKET_CALLBACK(ssh_packet_close1);
+SSH_PACKET_CALLBACK(ssh_packet_exist_status1);
 
 /* channels1.c */
 int channel_open_session1(ssh_channel channel);
@@ -104,7 +103,7 @@
 int channel_request_shell1(ssh_channel channel);
 int channel_request_exec1(ssh_channel channel, const char *cmd);
 int channel_write1(ssh_channel channel, const void *data, int len);
-
+ssh_channel ssh_get_channel1(ssh_session session);
 #endif
 
 #endif /* CHANNELS_H_ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/include/libssh/libssh.h 
new/libssh-0.5.2/include/libssh/libssh.h
--- old/libssh-0.5.1/include/libssh/libssh.h    2011-08-09 14:48:21.000000000 
+0200
+++ new/libssh-0.5.2/include/libssh/libssh.h    2011-09-16 21:57:36.000000000 
+0200
@@ -79,7 +79,7 @@
 /* libssh version */
 #define LIBSSH_VERSION_MAJOR  0
 #define LIBSSH_VERSION_MINOR  5
-#define LIBSSH_VERSION_MICRO  1
+#define LIBSSH_VERSION_MICRO  2
 
 #define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
                                            LIBSSH_VERSION_MINOR, \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/include/libssh/misc.h 
new/libssh-0.5.2/include/libssh/misc.h
--- old/libssh-0.5.1/include/libssh/misc.h      2011-08-09 14:48:21.000000000 
+0200
+++ new/libssh-0.5.2/include/libssh/misc.h      2011-09-16 21:57:36.000000000 
+0200
@@ -58,6 +58,7 @@
 struct ssh_list *ssh_list_new(void);
 void ssh_list_free(struct ssh_list *list);
 struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list);
+struct ssh_iterator *ssh_list_find(const struct ssh_list *list, void *value);
 int ssh_list_append(struct ssh_list *list, const void *data);
 int ssh_list_prepend(struct ssh_list *list, const void *data);
 void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/include/libssh/session.h 
new/libssh-0.5.2/include/libssh/session.h
--- old/libssh-0.5.1/include/libssh/session.h   2011-08-09 14:48:21.000000000 
+0200
+++ new/libssh-0.5.2/include/libssh/session.h   2011-09-16 21:57:36.000000000 
+0200
@@ -110,7 +110,7 @@
     struct ssh_crypto_struct *current_crypto;
     struct ssh_crypto_struct *next_crypto;  /* next_crypto is going to be used 
after a SSH2_MSG_NEWKEYS */
 
-    ssh_channel channels; /* linked list of channels */
+    struct ssh_list *channels; /* linked list of channels */
     int maxchannel;
     int exec_channel_opened; /* version 1 only. more
                                 info in channels1.c */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/auth.c new/libssh-0.5.2/src/auth.c
--- old/libssh-0.5.1/src/auth.c 2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/auth.c 2011-09-16 21:57:36.000000000 +0200
@@ -68,8 +68,13 @@
     do {
         rc = ssh_service_request(session,"ssh-userauth");
         if (ssh_is_blocking(session)) {
-            if(rc == SSH_AGAIN)
-                ssh_handle_packets(session, -2);
+            if (rc == SSH_AGAIN) {
+                int err = ssh_handle_packets(session, -2);
+                if (err != SSH_OK) {
+                    /* error or timeout */
+                    return SSH_ERROR;
+                }
+            }
         } else {
             /* nonblocking */
             ssh_handle_packets(session, 0);
@@ -309,7 +314,7 @@
  * @brief retrieves available authentication methods for this session
  * @param[in] session the SSH session
  * @param[in] username Deprecated, set to NULL.
- * @returns A bitfield of values SSH_AUTH_METHOD_NONE, 
SSH_AUTH_METHOD_PASSWORD,
+ * @returns A bitfield of values SSH_AUTH_METHOD_PASSWORD,
             SSH_AUTH_METHOD_PUBLICKEY, SSH_AUTH_METHOD_HOSTBASED,
             SSH_AUTH_METHOD_INTERACTIVE.
    @warning Other reserved flags may appear in future versions.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/channels.c 
new/libssh-0.5.2/src/channels.c
--- old/libssh-0.5.1/src/channels.c     2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/channels.c     2011-09-16 21:57:36.000000000 +0200
@@ -22,6 +22,7 @@
  * MA 02111-1307, USA.
  */
 
+#include <limits.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -45,7 +46,7 @@
 #include "libssh/server.h"
 #endif
 
-#define WINDOWBASE 128000
+#define WINDOWBASE 1280000
 #define WINDOWLIMIT (WINDOWBASE/2)
 
 /*
@@ -104,15 +105,9 @@
   channel->exit_status = -1;
 
   if(session->channels == NULL) {
-    session->channels = channel;
-    channel->next = channel->prev = channel;
-    return channel;
-  }
-  channel->next = session->channels;
-  channel->prev = session->channels->prev;
-  channel->next->prev = channel;
-  channel->prev->next = channel;
-
+    session->channels = ssh_list_new();
+  }
+  ssh_list_prepend(session->channels, channel);
   return channel;
 }
 
@@ -292,11 +287,14 @@
   /* Todo: fix this into a correct loop */
   /* wait until channel is opened by server */
   while(channel->state == SSH_CHANNEL_STATE_NOT_OPEN){
-    ssh_handle_packets(session, -2);
-    if (session->session_state == SSH_SESSION_STATE_ERROR) {
-        err = SSH_ERROR;
-        break;
-    }
+      err = ssh_handle_packets(session, -2);
+      if (err != SSH_OK) {
+          break;
+      }
+      if (session->session_state == SSH_SESSION_STATE_ERROR) {
+          err = SSH_ERROR;
+          break;
+      }
   }
   if(channel->state == SSH_CHANNEL_STATE_OPEN)
     err=SSH_OK;
@@ -306,23 +304,20 @@
 
 /* return channel with corresponding local id, or NULL if not found */
 ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id) {
-    ssh_channel initchan = session->channels;
-    ssh_channel channel = initchan;
+  struct ssh_iterator *it;
+  ssh_channel channel;
 
-    for (;;) {
-        if (channel == NULL) {
-            return NULL;
-        }
-        if (channel->local_channel == id) {
-            return channel;
-        }
-        if (channel->next == initchan) {
-            return NULL;
-        }
-        channel = channel->next;
+  for (it = ssh_list_get_iterator(session->channels); it != NULL ; 
it=it->next) {
+    channel = ssh_iterator_value(ssh_channel, it);
+    if (channel == NULL) {
+      continue;
+    }
+    if (channel->local_channel == id) {
+      return channel;
     }
+  }
 
-    return NULL;
+  return NULL;
 }
 
 /**
@@ -336,6 +331,13 @@
   uint32_t new_window = minimumsize > WINDOWBASE ? minimumsize : WINDOWBASE;
 
   enter_function();
+#ifdef WITH_SSH1
+  if (session->version == 1){
+      channel->remote_window = new_window;
+      leave_function();
+      return SSH_OK;
+  }
+#endif
   if(new_window <= channel->local_window){
     ssh_log(session,SSH_LOG_PROTOCOL,
         "growing window (channel %d:%d) to %d bytes : not needed (%d bytes)",
@@ -396,7 +398,7 @@
 #ifdef WITH_SSH1
   /* With SSH1, the channel is always the first one */
   if(session->version==1)
-    return session->channels;
+    return ssh_get_channel1(session);
 #endif
   if (buffer_get_u32(packet, &chan) != sizeof(uint32_t)) {
     ssh_set_error(session, SSH_FATAL,
@@ -992,31 +994,24 @@
  * @warning Any data unread on this channel will be lost.
  */
 void ssh_channel_free(ssh_channel channel) {
-  ssh_session session = channel->session;
-  enter_function();
+  ssh_session session;
+  struct ssh_iterator *it;
 
   if (channel == NULL) {
-    leave_function();
     return;
   }
 
+  session = channel->session;
+  enter_function();
+
   if (session->alive && channel->state == SSH_CHANNEL_STATE_OPEN) {
     ssh_channel_close(channel);
   }
 
-  /* handle the "my channel is first on session list" case */
-  if (session->channels == channel) {
-    session->channels = channel->next;
-  }
-
-  /* handle the "my channel is the only on session list" case */
-  if (channel->next == channel) {
-    session->channels = NULL;
-  } else {
-    channel->prev->next = channel->next;
-    channel->next->prev = channel->prev;
+  it = ssh_list_find(session->channels, channel);
+  if(it != NULL){
+    ssh_list_remove(session->channels, it);
   }
-
   ssh_buffer_free(channel->stdout_buffer);
   ssh_buffer_free(channel->stderr_buffer);
 
@@ -1126,9 +1121,11 @@
 int channel_write_common(ssh_channel channel, const void *data,
     uint32_t len, int is_stderr) {
   ssh_session session;
-  int origlen = len;
+  uint32_t origlen = len;
   size_t effectivelen;
   size_t maxpacketlen;
+  int timeout;
+  int rc;
 
   if(channel == NULL || data == NULL) {
       return -1;
@@ -1139,8 +1136,17 @@
       return -1;
   }
 
-  enter_function();
+  if (len > INT_MAX) {
+      ssh_log(session, SSH_LOG_PROTOCOL,
+              "Length (%u) is bigger than INT_MAX", len);
+      return SSH_ERROR;
+  }
 
+  enter_function();
+  if(ssh_is_blocking(session))
+    timeout = -2;
+  else
+    timeout = 0;
   /*
    * Handle the max packet len from remote side, be nice
    * 10 bytes for the headers
@@ -1164,7 +1170,7 @@
 
 #ifdef WITH_SSH1
   if (channel->version == 1) {
-    int rc = channel_write1(channel, data, len);
+    rc = channel_write1(channel, data, len);
     leave_function();
     return rc;
   }
@@ -1181,7 +1187,10 @@
           /* nothing can be written */
           ssh_log(session, SSH_LOG_PROTOCOL,
                 "Wait for a growing window message...");
-          return 0;
+          rc = ssh_handle_packets(session, timeout);
+          if (rc == SSH_ERROR || (channel->remote_window == 0 && timeout==0))
+            goto out;
+          continue;
       }
       effectivelen = len > channel->remote_window ? channel->remote_window : 
len;
     } else {
@@ -1220,9 +1229,14 @@
     len -= effectivelen;
     data = ((uint8_t*)data + effectivelen);
   }
-
+  /* it's a good idea to flush the socket now */
+  do {
+    rc = ssh_handle_packets(session, timeout);
+  } while(ssh_socket_buffered_write_bytes(session->socket) > 0 && timeout != 
0);
+out:
   leave_function();
-  return origlen;
+  return (int)(origlen - len);
+
 error:
   buffer_reinit(session->out_buffer);
 
@@ -2338,6 +2352,7 @@
   ssh_session session = channel->session;
   ssh_buffer stdbuf = channel->stdout_buffer;
   uint32_t len;
+  int rc;
 
   enter_function();
 
@@ -2386,7 +2401,10 @@
       break;
     }
 
-    ssh_handle_packets(session, -2);
+    rc = ssh_handle_packets(session, -2);
+    if (rc != SSH_OK) {
+        return rc;
+    }
   }
 
   len = buffer_get_rest_len(stdbuf);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/channels1.c 
new/libssh-0.5.2/src/channels1.c
--- old/libssh-0.5.1/src/channels1.c    2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/channels1.c    2011-09-16 21:57:36.000000000 +0200
@@ -36,6 +36,7 @@
 #include "libssh/packet.h"
 #include "libssh/channels.h"
 #include "libssh/session.h"
+#include "libssh/misc.h"
 
 #ifdef WITH_SSH1
 
@@ -221,7 +222,7 @@
 }
 
 SSH_PACKET_CALLBACK(ssh_packet_data1){
-    ssh_channel channel = session->channels;
+    ssh_channel channel = ssh_get_channel1(session);
     ssh_string str = NULL;
     int is_stderr=(type==SSH_SMSG_STDOUT_DATA ? 0 : 1);
     (void)user;
@@ -246,10 +247,12 @@
 }
 
 SSH_PACKET_CALLBACK(ssh_packet_close1){
-  ssh_channel channel = session->channels;
+  ssh_channel channel = ssh_get_channel1(session);
   uint32_t status;
+
   (void)type;
   (void)user;
+
   buffer_get_u32(packet, &status);
   /*
    * It's much more than a channel closing. spec says it's the last
@@ -266,6 +269,19 @@
   return SSH_PACKET_USED;
 }
 
+SSH_PACKET_CALLBACK(ssh_packet_exist_status1){
+  ssh_channel channel = ssh_get_channel1(session);
+  uint32_t status;
+  (void)type;
+  (void)user;
+  buffer_get_u32(packet, &status);
+  channel->state = SSH_CHANNEL_STATE_CLOSED;
+  channel->remote_eof = 1;
+  channel->exit_status = ntohl(status);
+
+  return SSH_PACKET_USED;
+}
+
 
 int channel_write1(ssh_channel channel, const void *data, int len) {
   ssh_session session = channel->session;
@@ -295,5 +311,15 @@
   return origlen;
 }
 
+ssh_channel ssh_get_channel1(ssh_session session){
+  struct ssh_iterator *it;
+  /* With SSH1, the channel is always the first one */
+  if(session->channels != NULL){
+    it = ssh_list_get_iterator(session->channels);
+    if(it)
+      return ssh_iterator_value(ssh_channel, it);
+  }
+  return NULL;
+}
 #endif /* WITH_SSH1 */
 /* vim: set ts=2 sw=2 et cindent: */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/client.c 
new/libssh-0.5.2/src/client.c
--- old/libssh-0.5.1/src/client.c       2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/client.c       2011-09-16 21:57:36.000000000 +0200
@@ -755,6 +755,7 @@
  */
 void ssh_disconnect(ssh_session session) {
   ssh_string str = NULL;
+  struct ssh_iterator *it;
   int i;
 
   if (session == NULL) {
@@ -793,8 +794,10 @@
   }
   session->fd = SSH_INVALID_SOCKET;
   session->session_state=SSH_SESSION_STATE_DISCONNECTED;
-  while (session->channels) {
-    ssh_channel_free(session->channels);
+
+  while ((it=ssh_list_get_iterator(session->channels)) != NULL) {
+    ssh_channel_free(ssh_iterator_value(ssh_channel,it));
+    ssh_list_remove(session->channels, it);
   }
   if(session->current_crypto){
     crypto_free(session->current_crypto);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/gzip.c new/libssh-0.5.2/src/gzip.c
--- old/libssh-0.5.1/src/gzip.c 2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/gzip.c 2011-09-16 21:57:36.000000000 +0200
@@ -173,7 +173,7 @@
   do {
     zin->avail_out = BLOCKSIZE;
     status = inflate(zin, Z_PARTIAL_FLUSH);
-    if (status != Z_OK) {
+    if (status != Z_OK && status != Z_BUF_ERROR) {
       ssh_set_error(session, SSH_FATAL,
           "status %d inflating zlib packet", status);
       ssh_buffer_free(dest);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/misc.c new/libssh-0.5.2/src/misc.c
--- old/libssh-0.5.1/src/misc.c 2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/misc.c 2011-09-16 21:57:36.000000000 +0200
@@ -377,6 +377,8 @@
 
 void ssh_list_free(struct ssh_list *list){
   struct ssh_iterator *ptr,*next;
+  if(!list)
+    return;
   ptr=list->root;
   while(ptr){
     next=ptr->next;
@@ -387,9 +389,19 @@
 }
 
 struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list){
+  if(!list)
+    return NULL;
   return list->root;
 }
 
+struct ssh_iterator *ssh_list_find(const struct ssh_list *list, void *value){
+  struct ssh_iterator *it;
+  for(it = ssh_list_get_iterator(list); it != NULL ;it=it->next)
+    if(it->data==value)
+      return it;
+  return NULL;
+}
+
 static struct ssh_iterator *ssh_iterator_new(const void *data){
   struct ssh_iterator *iterator=malloc(sizeof(struct ssh_iterator));
   if(!iterator)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/packet1.c 
new/libssh-0.5.2/src/packet1.c
--- old/libssh-0.5.1/src/packet1.c      2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/packet1.c      2011-09-16 21:57:36.000000000 +0200
@@ -55,7 +55,7 @@
   ssh_packet_data1,               //SSH_SMSG_STDOUT_DATA                17
   ssh_packet_data1,               //SSH_SMSG_STDERR_DATA                18
   NULL,                           //SSH_CMSG_EOF                        19
-  NULL,                           //SSH_SMSG_EXITSTATUS                 20
+  ssh_packet_exist_status1,       //SSH_SMSG_EXITSTATUS                 20
   NULL,                           //SSH_MSG_CHANNEL_OPEN_CONFIRMATION   21
   NULL,                           //SSH_MSG_CHANNEL_OPEN_FAILURE        22
   NULL,                           //SSH_MSG_CHANNEL_DATA                23
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/poll.c new/libssh-0.5.2/src/poll.c
--- old/libssh-0.5.1/src/poll.c 2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/poll.c 2011-09-16 21:57:36.000000000 +0200
@@ -440,24 +440,9 @@
  */
 void ssh_poll_ctx_free(ssh_poll_ctx ctx) {
   if (ctx->polls_allocated > 0) {
-    register size_t i, used;
-
-    used = ctx->polls_used;
-    for (i = 0; i < used; ) {
-      ssh_poll_handle p = ctx->pollptrs[i];
-      socket_t fd = ctx->pollfds[i].fd;
-
-      /* force poll object removal */
-      if (p->cb && p->cb(p, fd, POLLERR, p->cb_data) < 0) {
-        if(ctx->polls_used < used) {
-            used = ctx->polls_used;
-        } else {
-            /* nothing to do */
-            i++;
-        }
-      } else {
-        i++;
-      }
+    while (ctx->polls_used > 0){
+      ssh_poll_handle p = ctx->pollptrs[0];
+      ssh_poll_ctx_remove(ctx, p);
     }
 
     SAFE_FREE(ctx->pollptrs);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/scp.c new/libssh-0.5.2/src/scp.c
--- old/libssh-0.5.1/src/scp.c  2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/scp.c  2011-09-16 21:57:36.000000000 +0200
@@ -469,16 +469,20 @@
  *
  * @returns             SSH_SCP_REQUEST_NEWFILE:       The other side is 
sending
  *                                                     a file
- *                      SSH_SCP_REQUEST_NEWDIRECTORY:  The other side is 
sending
+ *                      SSH_SCP_REQUEST_NEWDIR:  The other side is sending
  *                                                     a directory
- *                      SSH_SCP_REQUEST_END_DIRECTORY: The other side has
+ *                      SSH_SCP_REQUEST_ENDDIR: The other side has
  *                                                     finished with the 
current
  *                                                     directory
+ *                      SSH_SCP_REQUEST_WARNING: The other side sent us a 
warning
+ *                      SSH_SCP_REQUEST_EOF: The other side finished sending us
+ *                                           files and data.
  *                      SSH_ERROR:                     Some error happened
  *
  * @see ssh_scp_read()
  * @see ssh_scp_deny_request()
  * @see ssh_scp_accept_request()
+ * @see ssh_scp_request_get_warning()
  */
 int ssh_scp_pull_request(ssh_scp scp){
   char buffer[4096];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/session.c 
new/libssh-0.5.2/src/session.c
--- old/libssh-0.5.1/src/session.c      2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/session.c      2011-09-16 21:57:36.000000000 +0200
@@ -157,7 +157,7 @@
  */
 void ssh_free(ssh_session session) {
   int i;
-  enter_function();
+  struct ssh_iterator *it;
 
   if (session == NULL) {
     return;
@@ -187,9 +187,12 @@
        ssh_poll_ctx_free(session->default_poll_ctx);
   }
   /* delete all channels */
-  while (session->channels) {
-    ssh_channel_free(session->channels);
+  while ((it=ssh_list_get_iterator(session->channels)) != NULL) {
+    ssh_channel_free(ssh_iterator_value(ssh_channel,it));
+    ssh_list_remove(session->channels, it);
   }
+  ssh_list_free(session->channels);
+  session->channels=NULL;
 #ifndef _WIN32
   agent_free(session->agent);
 #endif /* _WIN32 */
@@ -464,18 +467,12 @@
         tm = ssh_make_milliseconds(session->timeout, session->timeout_usec);
     }
     rc = ssh_poll_ctx_dopoll(ctx, tm);
-
     if (rc == SSH_ERROR) {
         session->session_state = SSH_SESSION_STATE_ERROR;
     }
 
     leave_function();
-
-    if (session->session_state == SSH_SESSION_STATE_ERROR) {
-        return SSH_ERROR;
-    }
-
-    return SSH_OK;
+    return rc;
 }
 
 /**
@@ -498,23 +495,17 @@
  * @return              SSH_OK on success, SSH_ERROR otherwise.
  */
 int ssh_handle_packets_termination(ssh_session session, int timeout,
-    ssh_termination_function fct, void *user){
-  int ret = SSH_ERROR;
-  struct ssh_timestamp ts;
-  ssh_timestamp_init(&ts);
-
-  while(!fct(user)){
-    ret = ssh_handle_packets(session, timeout);
-    if(ret == SSH_ERROR)
-      return SSH_ERROR;
-    if(fct(user)) {
-      return SSH_OK;
-    } else if (ssh_timeout_elapsed(&ts, timeout)) {
-      return SSH_AGAIN;
-    }
-    timeout = ssh_timeout_update(&ts,timeout);
-  }
-  return ret;
+       ssh_termination_function fct, void *user){
+       int ret = SSH_OK;
+
+       while(!fct(user)){
+               ret = ssh_handle_packets(session, timeout);
+               if(ret == SSH_ERROR || ret == SSH_AGAIN)
+                       return ret;
+               if(fct(user)) 
+                       return SSH_OK;
+       }
+       return ret;
 }
 
 /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/src/sftp.c new/libssh-0.5.2/src/sftp.c
--- old/libssh-0.5.1/src/sftp.c 2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/src/sftp.c 2011-09-16 21:57:36.000000000 +0200
@@ -1945,9 +1945,8 @@
         return SSH_ERROR;
       }
       len = ssh_string_len(datastring);
-      //handle->offset+=len;
-      /* We already have set the offset previously. All we can do is warn that 
the expected len
-       * and effective lengths are different */
+      /* Update the offset with the correct value */
+      file->offset = file->offset - (size - len);
       memcpy(data, ssh_string_data(datastring), len);
       ssh_string_free(datastring);
       sftp_leave_function();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/tests/client/torture_sftp_dir.c 
new/libssh-0.5.2/tests/client/torture_sftp_dir.c
--- old/libssh-0.5.1/tests/client/torture_sftp_dir.c    2011-08-09 
14:48:21.000000000 +0200
+++ new/libssh-0.5.2/tests/client/torture_sftp_dir.c    2011-09-16 
21:57:36.000000000 +0200
@@ -41,6 +41,8 @@
     snprintf(tmpdir, sizeof(tmpdir), "%s/mkdir_test", t->testdir);
 
     rc = sftp_mkdir(t->sftp, tmpdir, 0755);
+    if(rc != SSH_OK)
+        fprintf(stderr,"error:%s\n",ssh_get_error(t->sftp->session));
     assert_true(rc == 0);
 
     /* check if it really has been created */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libssh-0.5.1/tests/torture.c 
new/libssh-0.5.2/tests/torture.c
--- old/libssh-0.5.1/tests/torture.c    2011-08-09 14:48:21.000000000 +0200
+++ new/libssh-0.5.2/tests/torture.c    2011-09-16 21:57:36.000000000 +0200
@@ -248,6 +248,8 @@
     if (p == NULL) {
         goto failed;
     }
+    /* useful if TESTUSER is not the local user */
+    chmod(template,0777);
     t->testdir = strdup(p);
     if (t->testdir == NULL) {
         goto failed;

++++++ remove-pedantic-errors.diff ++++++
From: Jan Engelhardt <[email protected]>
Date: 2012-02-06 00:00:21.707276910 +0100

The header file /usr/include/asm/sigcontext.h uses an unnamed
aggregate (inside struct _fpstate), which is not permitted by ISO
C99. gcc's -pedantic-errors flag causes this to be flagged.

gcc has an exception that system header files are exempt from
pedantic-error reporting, but somehow this fails to work in SLES 11
SP 1 and only SP1, even though

 - both SP0 and SP1 have gcc-4.3.4
 - the unnamed aggregate is in both SP0 and SP1

Just like -Werror is a common nuisance, rip out -pedantic-errors
occurences as well.

---
 cmake/Modules/DefineCompilerFlags.cmake |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: libssh-0.5.1/cmake/Modules/DefineCompilerFlags.cmake
===================================================================
--- libssh-0.5.1.orig/cmake/Modules/DefineCompilerFlags.cmake
+++ libssh-0.5.1/cmake/Modules/DefineCompilerFlags.cmake
@@ -9,7 +9,7 @@ if (UNIX AND NOT WIN32)
     #
     if (${CMAKE_C_COMPILER_ID} MATCHES GNU)
         # add -Wconversion ?
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic 
-pedantic-errors")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic")
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow 
-Wmissing-prototypes -Wdeclaration-after-statement")
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal 
-Wpointer-arith -Wwrite-strings -Wformat-security")
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute")
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to