[tor-bugs] #11307 [Tor]: connection_handle_event_cb() should handle orconns correctly even when not in OR_CONN_STATE_CONNECTING

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Mar 24 23:31:08 UTC 2014


#11307: connection_handle_event_cb() should handle orconns correctly even when not
in OR_CONN_STATE_CONNECTING
--------------------+------------------------------------
 Reporter:  andrea  |          Owner:  andrea
     Type:  defect  |         Status:  new
 Priority:  normal  |      Milestone:  Tor: 0.2.???
Component:  Tor     |        Version:  Tor: 0.2.5.3-alpha
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
--------------------+------------------------------------
 This code is in connection_handle_event_cb():

 {{{
 if (conn->type == CONN_TYPE_OR &&
     conn->state == OR_CONN_STATE_CONNECTING) {
   connection_or_connect_failed(TO_OR_CONN(conn),
                                errno_to_orconn_end_reason(socket_error),
                                tor_socket_strerror(socket_error));
 }
 }}}

 It should be something like this:

 {{{
 if (conn->type == CONN_TYPE_OR) {
   if (conn->state == OR_CONN_STATE_CONNECTING) {
     connection_or_connect_failed(TO_OR_CONN(conn),
                                 errno_to_orconn_end_reason(socket_error),
                                 tor_socket_strerror(socket_error));
   } else {
     connection_or_close_for_error(TO_OR_CONN(conn));
   }
 }
 }}}

 As it stands, if conn->state != OR_CONN_STATE_CONNECTING this code will
 incorrectly treat orconns as generic conns and call
 connection_mark_for_close() on them without properly notifying the channel
 layer.

 Note that since this code is specific to bufferevents which do not
 currently work, this bug cannot be demonstrated in any working build of
 Tor, so I'm assigning it to the 0.2.?? milestone.

 Created pursuant to connection_mark_for_close() audit task #7472.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11307>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list