Subject: [libssh2] Hang on nonexistent scp file download

[libssh2] Hang on nonexistent scp file download

From: Dan Fandrich <>
Date: Thu, 22 Mar 2007 16:44:48 -0700

If I run the unmodified example/simple/scp program (CVS version), specifying
a valid username and password on the command line and an invalid file name,
the program hangs. The final output is:

=> libssh2_packet_read() plain (5 bytes)
0000: 60 00 00 00 00 `....
[libssh2] Transport: Packet type 96 received, length=5
[libssh2] Transport: Looking for packet of type: 94
=> libssh2_packet_read() plain (5 bytes)
0000: 61 00 00 00 00 a....
[libssh2] Transport: Packet type 97 received, length=5
[libssh2] Transport: Looking for packet of type: 94

The gdb backtrace is as follows:

#0 0x420e8312 in recv () from /lib/i686/
#1 0x4002c036 in libssh2_packet_read (session=0x804a028) at ../../libssh2/src/transport.c:305
#2 0x40020481 in libssh2_packet_ask_ex (session=0x804a028, packet_type=95 '_', data=0xbffff070, data_len=0xbffff074, match_ofs=1,
    match_buf=0xbffff078 "", match_len=4, poll_socket=1) at ../../libssh2/src/packet.c:616
#3 0x4001a752 in libssh2_channel_free (channel=0x804d0b8) at ../../libssh2/src/channel.c:1461
#4 0x40023a41 in libssh2_scp_recv (session=0x804a028, path=0x8048dba "/tmp/TEST", sb=0xbffff630) at ../../libssh2/src/scp.c:297
#5 0x08048c51 in main (argc=3, argv=0xbffff724) at ../../../libssh2/example/simple/scp.c:116
#6 0x42017589 in __libc_start_main () from /lib/i686/

It seems that libssh2_channel_free is waiting for SSH_MSG_CHANNEL_EXTENDED_DATA
that is never received. If I specify a valid file name, all is well.

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
libssh2-devel mailing list
Received on 2007-03-23