[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Merge remote-tracking branch 'origin/maint-0.2.2'



commit 212c3acd42285b77ae8197a185cbb00fea2c8926
Merge: a2517fa cf8bffa
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Oct 28 18:02:57 2011 -0400

    Merge remote-tracking branch 'origin/maint-0.2.2'
    
    Conflicts:
    	src/or/command.c

 changes/bug4299  |    5 +++++
 src/or/command.c |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --cc src/or/command.c
index d35e2a9,5271a7a..43d304e
--- a/src/or/command.c
+++ b/src/or/command.c
@@@ -148,19 -132,13 +148,22 @@@ command_process_cell(cell_t *cell, or_c
  #define PROCESS_CELL(tp, cl, cn) command_process_ ## tp ## _cell(cl, cn)
  #endif
  
+   if (conn->_base.marked_for_close)
+     return;
+ 
    /* Reject all but VERSIONS and NETINFO when handshaking. */
 +  /* (VERSIONS should actually be impossible; it's variable-length.) */
    if (handshaking && cell->command != CELL_VERSIONS &&
 -      cell->command != CELL_NETINFO)
 +      cell->command != CELL_NETINFO) {
 +    log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
 +           "Received unexpected cell command %d in state %s; ignoring it.",
 +           (int)cell->command,
 +           conn_state_to_string(CONN_TYPE_OR,conn->_base.state));
      return;
 +  }
 +
 +  if (conn->_base.state == OR_CONN_STATE_OR_HANDSHAKING_V3)
 +    or_handshake_state_record_cell(conn->handshake_state, cell, 1);
  
    switch (cell->command) {
      case CELL_PADDING:
@@@ -230,53 -208,12 +233,56 @@@ command_process_var_cell(var_cell_t *ce
    }
  #endif
  
+   if (conn->_base.marked_for_close)
+     return;
+ 
 -  /* reject all when not handshaking. */
 -  if (conn->_base.state != OR_CONN_STATE_OR_HANDSHAKING)
 -    return;
 +  switch (conn->_base.state)
 +  {
 +    case OR_CONN_STATE_OR_HANDSHAKING_V2:
 +      if (cell->command != CELL_VERSIONS)
 +        return;
 +      break;
 +    case OR_CONN_STATE_TLS_HANDSHAKING:
 +      /* If we're using bufferevents, it's entirely possible for us to
 +       * notice "hey, data arrived!" before we notice "hey, the handshake
 +       * finished!" And we need to be accepting both at once to handle both
 +       * the v2 and v3 handshakes. */
 +
 +      /* fall through */
 +    case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
 +      if (cell->command != CELL_VERSIONS) {
 +        log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
 +               "Received a non-VERSIONS cell with command %d in state %s; "
 +               "ignoring it.",
 +               (int)cell->command,
 +               conn_state_to_string(CONN_TYPE_OR,conn->_base.state));
 +        return;
 +      }
 +      break;
 +    case OR_CONN_STATE_OR_HANDSHAKING_V3:
 +      if (cell->command != CELL_AUTHENTICATE)
 +        or_handshake_state_record_var_cell(conn->handshake_state, cell, 1);
 +      break; /* Everything is allowed */
 +    case OR_CONN_STATE_OPEN:
 +      if (conn->link_proto < 3) {
 +        log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
 +               "Received a variable-length cell with command %d in state %s "
 +               "with link protocol %d; ignoring it.",
 +               (int)cell->command,
 +               conn_state_to_string(CONN_TYPE_OR,conn->_base.state),
 +               (int)conn->link_proto);
 +        return;
 +      }
 +      break;
 +    default:
 +      log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
 +             "Received var-length cell with command %d in unexpected state "
 +             "%s [%d]; ignoring it.",
 +             (int)cell->command,
 +             conn_state_to_string(CONN_TYPE_OR,conn->_base.state),
 +             (int)conn->_base.state);
 +      return;
 +  }
  
    switch (cell->command) {
      case CELL_VERSIONS:



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits