#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-develReceived on 2010-06-07