Subject: Re: [libssh2] #172: Calling libssh2_sftp_init before authenticating hangs.

Re: [libssh2] #172: Calling libssh2_sftp_init before authenticating hangs.

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Mon, 07 Jun 2010 11:01:25 -0000

#172: Calling libssh2_sftp_init before authenticating hangs.
------------------------+---------------------------------------------------
  Reporter: alamaison | Owner:
      Type: defect | Status: new
  Priority: low | Milestone: 1.2.6
 Component: SFTP | Version: 1.2.5
Resolution: | Keywords:
    Blocks: | Blocked By:
------------------------+---------------------------------------------------

Comment (by bagder):

 Ah, how about a fix similar to this?

 --- a/src/sftp.c
 +++ b/src/sftp.c
 @@ -716,6 +716,13 @@ static LIBSSH2_SFTP *sftp_init(LIBSSH2_SESSION
 *session)
  LIBSSH2_API LIBSSH2_SFTP *libssh2_sftp_init(LIBSSH2_SESSION *session)
  {
      LIBSSH2_SFTP *ptr;
 +
 + if(!(session->state & LIBSSH2_STATE_AUTHENTICATED)) {
 + _libssh2_error(session, LIBSSH2_ERROR_INVAL,
 + "session not authenticated yet");
 + return NULL;
 + }
 +
      BLOCK_ADJUST_ERRNO(ptr, session, sftp_init(session));
      return ptr;
  }

-- 
Ticket URL: <http://libssh2.stuge.se/ticket/172#comment:1>
libssh2 <http://libssh2.stuge.se/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-06-07