cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl with sftp support

From: James Housley <jim_at_thehousleys.net>
Date: Wed, 8 Nov 2006 11:25:08 -0500

On Nov 8, 2006, at 10:20 AM, Satish Mittal wrote:

>
>
> On 11/8/06, Daniel Stenberg <daniel_at_haxx.se> wrote: On Tue, 7 Nov
> 2006, Satish Mittal wrote:
>
> > Quite recently I have been noticing efforts to put sftp client
> support into
> > libcurl (using libssh2 library). Has it been incorporated into
> any recent
> > release of libcurl? Is there any libcurl release somewhere that I
> can grab
> > and try out the sftp functionality?
>
> James Housley has been working on this, and his great work on SCP
> support has
> already been committed and is available from CVS and recent daily
> snapshots.
> He also posted a few questions yesterday about his work on SFTP, so
> I guess
> you have a chance to tell your opinions and ideas and perhaps
> affect how this
> is done in libcurl.
>
> O.K. so is the libssh2 supported code still in private build mode
> with James? I can see SCP support in recent CVS activities at
> libcurl site.
>
> > I have been using libcurl quite happily in my product. Now I need
> to add
> > SSH2 based sftp client support to it, and I was trying out
> writing my own
> > wrapper over libssh2 for this purpose. But I am seeing some
> issues. May be
> > people out here have a workable code. I would be quite happy to
> see sftp
> > going into libcurl as soon as possible.
>
> We certainly will appreciate your help to bring this to libcurl.
>
> AFAICS, libssh2 may have a few issues we might need to sort out, but
> unfortunately the libssh2 project seems close to stalled.
>
> There are quite a few bugs in libssh2 that I have come across, and
> I am sure others too will see them sooner than later. The main ones
> are:
> 1. In the call to libssh2_session_startup() I get a crash randomly,
> because the call to libssh2_blocking_read() fails. This looks to be
> some bug at protocol level. Since many times the same client
> succeeds while connecting to the same sftp server. I have posted
> the stack trace and the relevant code at lissh2 mailing list.
> 2. In libssh2_session_startup() there is an indefinite hang.
>
> Besides there are some small issues:
> 1. At many places, a variable of type unsigned long gets assigned a
> function return value, which could be -1. This fails subsequent
> checks like val < 0. I had to replace unsigned long with long.

I have committed changes to libssh2 that fixes types on function
calls. I am in the progress of looking at all signed/unsigned mis-
matches.

> 2. I just noticed that at many places (mainly in debug prints) a
> char is typecased to int and printed as %d. This prints 4 chars
> instead of the desired 1 char. Perhaps author wanted something like
> atoi() there.
> 3. On windows, error code ENOTCONN is not present in VC7 any more.
> I had to replace it with EBADF to compile it.
>
> Thanks,
> Satish
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/
> curl.html
>
>
> --
> "The happiest of people donīt necessarily have the best of
> everything, they just make the most of everything that comes along
> their way."

--
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
Do not meddle in the affairs of dragons, for you are crunchy and taste
     good with ketchup.
Received on 2006-11-08