Commit a4a7939a authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Merge remote-tracking branch 'dgoulet/ticket26062_034_01'

parents bbee2b62 67a41b63
Loading
Loading
Loading
Loading

changes/ticket26062

0 → 100644
+4 −0
Original line number Diff line number Diff line
  o Minor bugfixes (client):
    - Don't consider Tor running as a client if the ControlPort is open. Fixes
      bug 26062; bugfix on 0.2.9.4-alpha.
+14 −0
Original line number Diff line number Diff line
@@ -8433,3 +8433,17 @@ init_cookie_authentication(const char *fname, const char *header,
  return retval;
}

/**
 * Return true if any option is set in <b>options</b> to make us behave
 * as a client.
 */
int
options_any_client_port_set(const or_options_t *options)
{
  return (options->SocksPort_set ||
          options->TransPort_set ||
          options->NATDPort_set ||
          options->DNSPort_set ||
          options->HTTPTunnelPort_set);
}
+3 −0
Original line number Diff line number Diff line
@@ -214,6 +214,9 @@ smartlist_t *get_options_from_transport_options_line(const char *line,
                                                     const char *transport);
smartlist_t *get_options_for_server_transport(const char *transport);

/* Port helper functions. */
int options_any_client_port_set(const or_options_t *options);

#ifdef CONFIG_PRIVATE

#define CL_PORT_NO_STREAM_OPTIONS (1u<<0)
+1 −1
Original line number Diff line number Diff line
@@ -1497,7 +1497,7 @@ get_my_roles(const or_options_t *options)

  int roles = 0;
  int is_bridge = options->BridgeRelay;
  int is_client = any_client_port_set(options);
  int is_client = options_any_client_port_set(options);
  int is_relay = server_mode(options);
  int is_dirauth = authdir_mode_v3(options);
  int is_bridgeauth = authdir_mode_bridge(options);
+1 −19
Original line number Diff line number Diff line
@@ -1690,24 +1690,6 @@ networkstatus_set_current_consensus_from_ns(networkstatus_t *c,
}
#endif /* defined(TOR_UNIT_TESTS) */

/**
 * Return true if any option is set in <b>options</b> to make us behave
 * as a client.
 *
 * XXXX If we need this elsewhere at any point, we should make it nonstatic
 * XXXX and move it into another file.
 */
int
any_client_port_set(const or_options_t *options)
{
  return (options->SocksPort_set ||
          options->TransPort_set ||
          options->NATDPort_set ||
          options->ControlPort_set ||
          options->DNSPort_set ||
          options->HTTPTunnelPort_set);
}

/**
 * Helper for handle_missing_protocol_warning: handles either the
 * client case (if <b>is_client</b> is set) or the server case otherwise.
@@ -1743,7 +1725,7 @@ handle_missing_protocol_warning(const networkstatus_t *c,
                                const or_options_t *options)
{
  const int is_server = server_mode(options);
  const int is_client = any_client_port_set(options) || !is_server;
  const int is_client = options_any_client_port_set(options) || !is_server;

  if (is_server)
    handle_missing_protocol_warning_impl(c, 0);
Loading