Bo Granlund | 8 Mar 2007 01:12

Problems connecting to remote server in libssh2_session_startup()

Hi,

I'm new to this list so please bear with me. :)

I'm trying to use the most current libssh2 version from CVS. I have an
download from a month ago and then also a current (checked out a few hours
ago). I also have this tester program (attachment, scp.c), which fails to
work at all with the current version of the libssh2 distribution. I've
traced it down to libssh2_session_startup(session, sock);. This function
blocks the program for a minute or so (I didn't do any measurements, sorry),
and fails with the error message:

Failure establishing SSH session: -5

Now, I tried this too with libssh2 0.14, and it wen't as far as
libssh2_scp_send(), and actually started to send the file when I applied
this modest patch to libssh2/src/scp.c:

--- orig.libssh2-0.14/src/scp.c 2006-03-02 03:07:20.000000000 +0200
+++ libssh2-0.14/src/scp.c      2007-03-08 00:32:23.000000000 +0200
 <at>  <at>  -378,12 +378,14  <at>  <at> 
        }
       LIBSSH2_FREE(session, command);

+#if 0
        /* Wait for ACK */
        if ((libssh2_channel_read(channel, response, 1) <= 0) || +(response[0] != 0)) {
                libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, +"Invalid ACK response from remote", 0);
                libssh2_channel_free(channel);
                return NULL;
(Continue reading)


Gmane