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

Archive Index This month's Index

Subject: Re: [libssh2] #257: [PATCH] libssh2_session_free: infinite loop (was: libssh2_session_free: infinite loop)

Re: [libssh2] #257: [PATCH] libssh2_session_free: infinite loop (was: libssh2_session_free: infinite loop)

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Thu, 21 Feb 2013 03:02:28 -0000

#257: [PATCH] libssh2_session_free: infinite loop
-----------------------+-------------------
  Reporter: greg2001 | Owner:
      Type: defect | Status: new
  Priority: normal | Milestone: 1.4.3
 Component: API | Version: 1.4.2
Resolution: | Keywords:
Blocked By: | Blocks:
-----------------------+-------------------

Comment (by ncm):

 It wasn't immediately clear to me that the infinite loop you point
 to occurs *inside* libssh2.

 I think the solution is not to change _libssh2_channel_forward_cancel,
 but to change the loop so that if a listener reports an unrecoverable
 error, the whole connection should be dropped, unceremoniously.
 Actually closing the physical socket connection should be a valid
 response to all errors. Since the library cannot close the socket,
 the client needs to know when that is the right choice.

 Thus,
 {{{
     while ((l = _libssh2_list_first(&session->listeners))) {
         rc = _libssh2_channel_forward_cancel(l);
 - if (rc == LIBSSH2_ERROR_EAGAIN)
 + if (rc)
             return rc;
     }
 }}}

-- 
Ticket URL: <https://trac.libssh2.org/ticket/257#comment:1>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-02-21

the libssh2 team