cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl lib sftp crashing

From: madhusudana yn <madhusudanayn_at_gmail.com>
Date: Tue, 31 Jul 2012 21:31:40 +0530

Hi Joe,

that's exact line of code you have guessed.

I am not sure of if all of those libssh2_session_last_errno(sshc->ssh_session))
calls need to be fixed. In my case, I have faced the crash at the point you
have guessed. Right now we have put a NULL check in libssh2_session_last_errno
API and return error in case the pointer is null although that's not the
right way of doing it.

thanks,
madhu

On Tue, Jul 31, 2012 at 7:56 PM, Joe Mason <jmason_at_rim.com> wrote:

> > From: curl-library-bounces_at_cool.haxx.se [
> curl-library-bounces_at_cool.haxx.se] on behalf of madhusudana yn [
> madhusudanayn_at_gmail.com]
> >
> > #0 0xf7ed105f in libssh2_session_last_errno (session=0x0) at
> session.c:1252
> > #1 0xf7eae017 in ssh_statemach_act (conn=0xbaba25c, block=0xe921817b)
> at ssh.c:1456
>
> The line numbers in my copy of curl are different, but I think that's this
> block of code, right?
>
> sshc->sftp_handle =
> libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path,
> curlx_uztoui(strlen(sftp_scp->path)),
> flags, data->set.new_file_perms,
> LIBSSH2_SFTP_OPENFILE);
>
> if(!sshc->sftp_handle) {
> rc = libssh2_session_last_errno(sshc->ssh_session);
>
> So I suspect that should be
> "libssh2_session_last_errno(sshc->sftp_session)", since sftp_session is
> what's used in the libssh2_sftp_open_ex call. That's just a guess, though
> - I don't really know the difference between ssh_session and sftp_session.
>
> Most uses of libssh2_session_last_errno look like this:
>
> sshc->authlist = libssh2_userauth_list(sshc->ssh_session,
> conn->user,
>
> curlx_uztoui(strlen(conn->user)));
>
> if(!sshc->authlist) {
> if((err = libssh2_session_last_errno(sshc->ssh_session)) ==
>
> With the libssh2 call right before the libssh2_session_last_errno call
> both using ssh_session. But there are three or four which have a libssh2
> call using sftp_session followed by libssh2_session_last_errno taking
> ssh_session. Do all of those calls need to be fixed?
>
> Joe
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential
> information, privileged material (including material protected by the
> solicitor-client or other applicable privileges), or constitute non-public
> information. Any use of this information by anyone other than the intended
> recipient is prohibited. If you have received this transmission in error,
> please immediately reply to the sender and delete this information from
> your system. Use, dissemination, distribution, or reproduction of this
> transmission by unintended recipients is not authorized and may be unlawful.
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-- 
madhusudana yn

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-31