www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: libssh2_scp_recv is not populating struct stat

Re: libssh2_scp_recv is not populating struct stat

From: ţ <unix_at_vip.qq.com>
Date: Thu, 11 Oct 2012 16:00:47 +0800

hi peter:
 Thans for your replaying.
 Yeah,maybe it be not the issue.
 I using openssl-0.9.8p,I got the following text:
  
 ~/libssh2-1.4.2/example# ./scp 10.129.139.140 mqq mqq2005 /usr/local/app/everpan/hello
[libssh2] 0.735658 Socket: Sent 23/23 bytes at 0x2aaf4b32637d+0
[libssh2] 0.735760 Socket: Error recving 1 bytes: 11
[libssh2] 0.735792 Failure Event: -37 - Failed getting banner
[libssh2] 0.736589 Socket: Recved 1 bytes banner
[libssh2] 0.736630 Socket: Recved 1 bytes banner
[libssh2] 0.736659 Socket: Recved 1 bytes banner
[libssh2] 0.736686 Socket: Recved 1 bytes banner
[libssh2] 0.736711 Socket: Recved 1 bytes banner
[libssh2] 0.736736 Socket: Recved 1 bytes banner
[libssh2] 0.736760 Socket: Recved 1 bytes banner
[libssh2] 0.736784 Socket: Recved 1 bytes banner
[libssh2] 0.736967 Socket: Recved 1 bytes banner
[libssh2] 0.737001 Socket: Recved 1 bytes banner
[libssh2] 0.737026 Socket: Recved 1 bytes banner
[libssh2] 0.737085 Socket: Recved 1 bytes banner
[libssh2] 0.737116 Socket: Recved 1 bytes banner
[libssh2] 0.737141 Socket: Recved 1 bytes banner
[libssh2] 0.737314 Socket: Recved 1 bytes banner
[libssh2] 0.738757 Socket: Recved 1 bytes banner
[libssh2] 0.738783 Socket: Recved 1 bytes banner
[libssh2] 0.738807 Socket: Recved 1 bytes banner
[libssh2] 0.738832 Socket: Recved 1 bytes banner
[libssh2] 0.738856 Socket: Recved 1 bytes banner
[libssh2] 0.738880 Socket: Recved 1 bytes banner
[libssh2] 0.738904 Socket: Recved 1 bytes banner
[libssh2] 0.738927 Socket: Recved 1 bytes banner
[libssh2] 0.738951 Socket: Recved 1 bytes banner
[libssh2] 0.738975 Socket: Recved 1 bytes banner
[libssh2] 0.739006 Socket: Recved 1 bytes banner
[libssh2] 0.739031 Socket: Recved 1 bytes banner
[libssh2] 0.739055 Socket: Recved 1 bytes banner
[libssh2] 0.739079 Socket: Recved 1 bytes banner
[libssh2] 0.739115 Socket: Recved 1 bytes banner
[libssh2] 0.739139 Socket: Recved 1 bytes banner
[libssh2] 0.739164 Socket: Recved 1 bytes banner
[libssh2] 0.739188 Socket: Recved 1 bytes banner
[libssh2] 0.739212 Socket: Recved 1 bytes banner
[libssh2] 0.739236 Socket: Recved 1 bytes banner
[libssh2] 0.739260 Socket: Recved 1 bytes banner
[libssh2] 0.739298 Socket: Recved 1 bytes banner
[libssh2] 0.739325 Socket: Recved 1 bytes banner
[libssh2] 0.739350 Socket: Recved 1 bytes banner
[libssh2] 0.739374 Socket: Recved 1 bytes banner
[libssh2] 0.739401 Socket: Recved 1 bytes banner
[libssh2] 0.739425 Socket: Recved 1 bytes banner
[libssh2] 0.739451 Socket: Recved 1 bytes banner
[libssh2] 0.739475 Socket: Recved 1 bytes banner
[libssh2] 0.739499 Socket: Recved 1 bytes banner
[libssh2] 0.739523 Socket: Recved 1 bytes banner
[libssh2] 0.739547 Socket: Recved 1 bytes banner
[libssh2] 0.739571 Socket: Recved 1 bytes banner
[libssh2] 0.739596 Socket: Recved 1 bytes banner
[libssh2] 0.739620 Socket: Recved 1 bytes banner
[libssh2] 0.739644 Socket: Recved 1 bytes banner
[libssh2] 0.739833 Socket: Sent 648/648 bytes at 0x509958
[libssh2] 0.739874 Socket: Recved 488/16384 bytes to 0x505918+0
[libssh2] 0.740190 Socket: Sent 144/144 bytes at 0x509958
[libssh2] 0.740225 Failure Event: -37 - Unable to exchange encryption keys
[libssh2] 0.806597 Socket: Recved 1040/16384 bytes to 0x505918+0
[libssh2] 0.808541 Socket: Sent 16/16 bytes at 0x509958
[libssh2] 0.808580 Failure Event: -37 - Unable to exchange encryption keys
[libssh2] 0.808745 Socket: Recved 32/16384 bytes to 0x505918+0
[libssh2] 0.808854 Socket: Sent 52/52 bytes at 0x509958
[libssh2] 0.809098 Socket: Recved 88/16384 bytes to 0x505918+0
Fingerprint: 8E FF 9F AD 59 BB 28 0D CE BD 96 1C 80 56 7B 3A DF 65 FD D2
[libssh2] 0.809636 Socket: Sent 84/84 bytes at 0x509958
[libssh2] 0.809668 Failure Event: -37 - Would block waiting
[libssh2] 0.810919 Socket: Recved 1096/16384 bytes to 0x505918+0
[libssh2] 0.811015 SCP: Opening channel for SCP receive
[libssh2] 0.811044 Conn: Allocated new channel ID#0
[libssh2] 0.811068 Conn: Opening Channel - win 262144 pack 32768
[libssh2] 0.811116 Socket: Sent 68/68 bytes at 0x509958
[libssh2] 0.811147 Failure Event: -37 - Would block
[libssh2] 0.811177 Failure Event: -37 - Would block starting up channel
[libssh2] 0.811352 Socket: Recved 88/16384 bytes to 0x505918+0
[libssh2] 0.811408 Conn: Connection Established - ID: 0/0 win: 100000/262144 pack: 32768/32768
[libssh2] 0.811440 Conn: starting request(exec) on channel 0/0, message=scp -pf '/usr/local/app/everpan/hello'
[libssh2] 0.811489 Socket: Sent 148/148 bytes at 0x509958
[libssh2] 0.811521 Failure Event: -37 - Would block requesting SCP startup
[libssh2] 0.812461 Socket: Recved 72/16384 bytes to 0x505918+0
[libssh2] 0.812515 SCP: Sending initial wakeup
[libssh2] 0.812549 Conn: Writing 1 bytes on channel 0/0, stream #0
[libssh2] 0.812576 Conn: Sending 1 bytes on channel 0/0, stream_id=0
[libssh2] 0.812616 Socket: Sent 52/52 bytes at 0x509958
[libssh2] 0.812644 Conn: channel_read() wants 1 bytes from channel 0/0 stream #0
[libssh2] 0.812671 Failure Event: -37 - would block
[libssh2] 0.812695 Failure Event: -37 - Would block waiting for SCP response
[libssh2] 0.830842 Conn: channel_read() wants 1 bytes from channel 0/0 stream #0
[libssh2] 0.830891 Socket: Recved 120/16384 bytes to 0x505918+0
[libssh2] 0.830938 Conn: 31 bytes packet_add() for 0/0/46931107643393
[libssh2] 0.830968 Failure Event: -37 - would block
[libssh2] 0.830993 Failure Event: -37 - Would block waiting for SCP response
[libssh2] 0.867357 Conn: channel_read() wants 1 bytes from channel 0/0 stream #0
[libssh2] 0.867412 Socket: Recved 360/16384 bytes to 0x505918+0
[libssh2] 0.867458 Conn: 92 bytes packet_add() for 0/0/46931107643393
[libssh2] 0.867499 Conn: Channel 0 received request type exit-status (wr 0)
[libssh2] 0.867528 Conn: Exit status 255 received for channel 0/0
[libssh2] 0.867562 Conn: Close received for channel 0/0
[libssh2] 0.867593 Conn: Freeing channel 0/0 resources
[libssh2] 0.867619 Conn: Sending EOF on channel 0/0
[libssh2] 0.867657 Socket: Sent 36/36 bytes at 0x509958
[libssh2] 0.867686 Conn: Closing channel 0/0
[libssh2] 0.867719 Socket: Sent 36/36 bytes at 0x509958
[libssh2] 0.867761 Socket: Sent 84/84 bytes at 0x509958
all done
</:includetail>
 ----------</:includetail>
 I just add one code in example/scp.c </:includetail>
 </:includetail>
 libssh2_trace(session,LIBSSH2_TRACE_CONN | LIBSSH2_TRACE_SOCKET | LIBSSH2_TRACE_SCP | LIBSSH2_TRACE_ERROR );
   
 my gcc is:
 gcc -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix= --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=x86_64-suse-linux
Thread model: posix
gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)
  
 I puzzle over this many days.
 thanks for your help.
  
 ------------------ Original ------------------
  From: "Peter Stuge"<peter_at_stuge.se>;
 Date: Wed, Oct 10, 2012 10:01 PM
 To: "libssh2-devel"<libssh2-devel_at_cool.haxx.se>;
 
 Subject: Re: libssh2_scp_recv is not populating struct stat

 

ţ wrote:
> I found that the libgcrypt-1.5.0 is unsuited to libssh2

I think the issue requires further investigation.


> [libssh2] 0.386538 Socket: Recved 1040/16384 bytes to 0x502c38+0
> [libssh2] 0.390496 Socket: Sent 16/16 bytes at 0x506c78
> [libssh2] 0.390539 Failure Event: -37 - Unable to exchange encryption keys
> [libssh2] 0.390736 Socket: Recved 32/16384 bytes to 0x502c38+0

The above does not indicate an error. -37 means that some
communication has not yet completed, so the call to libssh2
should be attempted again.

~/src/libssh2 $ git grep -- -37|cat
include/libssh2.h:#define LIBSSH2_ERROR_EAGAIN -37


Please try to use some of the example programs included with libssh2.
They should work just fine. If they do not work then let's find the
problem.

libgcrypt has one known limitation. libssh2 can not use
passphrase-protected private SSH keys for authentication, if built
with libgcrypt. Using such keys is only possible when built with
OpenSSL. Everything else should work.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
 
</:includetail>

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-10-11

the libssh2 team