Commit c06e6dda authored by Roger Dingledine's avatar Roger Dingledine
Browse files

Finish the transition from the word 'verified' to the words

'named' and 'valid'.


svn:r6188
parent 7e2aa67f
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -1164,14 +1164,14 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
      n_supported[i] = -1;
      continue; /* skip routers that are not suitable */
    }
    if (!router->is_verified &&
        (!(options->_AllowUnverified & ALLOW_UNVERIFIED_EXIT) ||
    if (!router->is_valid &&
        (!(options->_AllowInvalid & ALLOW_INVALID_EXIT) ||
         router_is_unreliable(router, 1, 1, 0))) {
      /* if it's unverified, and either we don't want it or it's unsuitable */
      /* if it's invalid, and either we don't want it or it's unsuitable */
      n_supported[i] = -1;
//      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- unverified router.",
//      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- invalid router.",
//             router->nickname, i);
      continue; /* skip unverified routers */
      continue; /* skip invalid routers */
    }
    if (router_exit_policy_rejects_all(router)) {
      n_supported[i] = -1;
@@ -1309,14 +1309,14 @@ choose_good_exit_server(uint8_t purpose, routerlist_t *dir,
      if (is_internal) /* pick it like a middle hop */
        return router_choose_random_node(NULL, get_options()->ExcludeNodes,
               NULL, need_uptime, need_capacity, 0,
               get_options()->_AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0);
               get_options()->_AllowInvalid & ALLOW_INVALID_MIDDLE, 0);
      else
        return choose_good_exit_server_general(dir,need_uptime,need_capacity);
    case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
      return router_choose_random_node(
               options->RendNodes, options->RendExcludeNodes,
               NULL, need_uptime, need_capacity, 0,
               options->_AllowUnverified & ALLOW_UNVERIFIED_RENDEZVOUS, 0);
               options->_AllowInvalid & ALLOW_INVALID_RENDEZVOUS, 0);
  }
  log_warn(LD_BUG,"Bug: unhandled purpose %d", purpose);
  tor_fragile_assert();
@@ -1417,9 +1417,9 @@ count_acceptable_routers(smartlist_t *routers)
//      log_debug(LD_CIRC,"Nope, the directory says %d is not running.",i);
      goto next_i_loop;
    }
    if (r->is_verified == 0) {
//      log_debug(LD_CIRC,"Nope, the directory says %d is not verified.",i);
      /* XXXX009 But unverified routers *are* sometimes acceptable. */
    if (r->is_valid == 0) {
//      log_debug(LD_CIRC,"Nope, the directory says %d is not valid.",i);
      /* XXXX009 But invalid routers *are* sometimes acceptable. */
      goto next_i_loop;
    }
    num++;
@@ -1486,7 +1486,7 @@ choose_good_middle_server(uint8_t purpose,
  choice = router_choose_random_node(
           NULL, get_options()->ExcludeNodes, excluded,
           state->need_uptime, state->need_capacity, 0,
           get_options()->_AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0);
           get_options()->_AllowInvalid & ALLOW_INVALID_MIDDLE, 0);
  smartlist_free(excluded);
  return choice;
}
@@ -1538,7 +1538,7 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state)
           excluded, state ? state->need_uptime : 0,
           state ? state->need_capacity : 0,
           state ? 0 : 1,
           options->_AllowUnverified & ALLOW_UNVERIFIED_ENTRY, 0);
           options->_AllowInvalid & ALLOW_INVALID_ENTRY, 0);
  smartlist_free(excluded);
  return choice;
}
+1 −1
Original line number Diff line number Diff line
@@ -1081,7 +1081,7 @@ consider_recording_trackhost(connection_t *conn, circuit_t *circ)
    return;

  /* write down the fingerprint of the chosen exit, not the nickname,
   * because the chosen exit might not be verified. */
   * because the chosen exit might not be named. */
  base16_encode(fp, sizeof(fp),
                circ->build_state->chosen_exit->identity_digest, DIGEST_LEN);

+16 −15
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ static config_abbrev_t _option_abbrevs[] = {
  PLURAL(StrictEntryNode),
  PLURAL(StrictExitNode),
  { "l", "Log", 1, 0},
  { "AllowUnverifiedNodes", "AllowInvalidNodes", 0, 0},
  { "BandwidthRateBytes", "BandwidthRate", 0, 0},
  { "BandwidthBurstBytes", "BandwidthBurst", 0, 0},
  { "DirFetchPostPeriod", "StatusFetchPeriod", 0, 0},
@@ -126,7 +127,7 @@ static config_var_t _option_vars[] = {
  VAR("AccountingStart",     STRING,   AccountingStart,      NULL),
  VAR("Address",             STRING,   Address,              NULL),
  VAR("__AllDirActionsPrivate",BOOL,   AllDirActionsPrivate, "0"),
  VAR("AllowUnverifiedNodes",CSV,      AllowUnverifiedNodes,
  VAR("AllowInvalidNodes",   CSV,      AllowInvalidNodes,
                                                        "middle,rendezvous"),
  VAR("AssumeReachable",     BOOL,     AssumeReachable,      "0"),
  VAR("AuthDirInvalid",      LINELIST, AuthDirInvalid,       NULL),
@@ -1336,12 +1337,12 @@ get_assigned_option(config_format_t *fmt, or_options_t *options,
 * clearing, or make the value 0 or NULL.
 *
 * Here are the use cases:
 * 1. A non-empty AllowUnverified line in your torrc. Appends to current
 * 1. A non-empty AllowInvalid line in your torrc. Appends to current
 *    if linelist, replaces current if csv.
 * 2. An empty AllowUnverified line in your torrc. Should clear it.
 * 3. "RESETCONF AllowUnverified" sets it to default.
 * 4. "SETCONF AllowUnverified" makes it NULL.
 * 5. "SETCONF AllowUnverified=foo" clears it and sets it to "foo".
 * 2. An empty AllowInvalid line in your torrc. Should clear it.
 * 3. "RESETCONF AllowInvalid" sets it to default.
 * 4. "SETCONF AllowInvalid" makes it NULL.
 * 5. "SETCONF AllowInvalid=foo" clears it and sets it to "foo".
 *
 * Use_defaults   Clear_first
 *    0                0       "append"
@@ -2311,22 +2312,22 @@ options_validate(or_options_t *old_options, or_options_t *options,
           "of the Internet, so they must not set Reachable*Addresses "
           "or FascistFirewall.");

  options->_AllowUnverified = 0;
  if (options->AllowUnverifiedNodes) {
    SMARTLIST_FOREACH(options->AllowUnverifiedNodes, const char *, cp, {
  options->_AllowInvalid = 0;
  if (options->AllowInvalidNodes) {
    SMARTLIST_FOREACH(options->AllowInvalidNodes, const char *, cp, {
        if (!strcasecmp(cp, "entry"))
          options->_AllowUnverified |= ALLOW_UNVERIFIED_ENTRY;
          options->_AllowInvalid |= ALLOW_INVALID_ENTRY;
        else if (!strcasecmp(cp, "exit"))
          options->_AllowUnverified |= ALLOW_UNVERIFIED_EXIT;
          options->_AllowInvalid |= ALLOW_INVALID_EXIT;
        else if (!strcasecmp(cp, "middle"))
          options->_AllowUnverified |= ALLOW_UNVERIFIED_MIDDLE;
          options->_AllowInvalid |= ALLOW_INVALID_MIDDLE;
        else if (!strcasecmp(cp, "introduction"))
          options->_AllowUnverified |= ALLOW_UNVERIFIED_INTRODUCTION;
          options->_AllowInvalid |= ALLOW_INVALID_INTRODUCTION;
        else if (!strcasecmp(cp, "rendezvous"))
          options->_AllowUnverified |= ALLOW_UNVERIFIED_RENDEZVOUS;
          options->_AllowInvalid |= ALLOW_INVALID_RENDEZVOUS;
        else {
          log(LOG_WARN, LD_CONFIG,
              "Unrecognized value '%s' in AllowUnverifiedNodes", cp);
              "Unrecognized value '%s' in AllowInvalidNodes", cp);
          result = -1;
        }
      });
+21 −21
Original line number Diff line number Diff line
@@ -362,7 +362,7 @@ dirserv_get_status_impl(const char *fp, const char *nickname,
       tor_free(esc_contact);
    }
    if (msg)
      *msg = "Rejected: There is already a verified server with this nickname "
      *msg = "Rejected: There is already a named server with this nickname "
        "and a different fingerprint.";
    return FP_REJECT; /* Wrong fingerprint. */
  }
@@ -485,14 +485,14 @@ authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
  /* Okay, looks like we're willing to accept this one. */
  switch (status) {
    case FP_NAMED:
      ri->is_named = ri->is_verified = 1;
      ri->is_named = ri->is_valid = 1;
      break;
    case FP_VALID:
      ri->is_named = 0;
      ri->is_verified = 1;
      ri->is_valid = 1;
      break;
    case FP_INVALID:
      ri->is_named = ri->is_verified = 0;
      ri->is_named = ri->is_valid = 0;
      break;
    default:
      tor_assert(0);
@@ -556,8 +556,8 @@ dirserv_add_descriptor(const char *desc, const char **msg)
    control_event_descriptors_changed(changed);
    smartlist_free(changed);
    if (!*msg) {
      *msg =  ri->is_verified ? "Verified server descriptor accepted" :
        "Unverified server descriptor accepted";
      *msg =  ri->is_valid ? "Descriptor for valid server accepted" :
        "Descriptor for invalid server accepted";
    }
    return r == 0 ? 2 : 1;
  }
@@ -586,26 +586,26 @@ directory_remove_invalid(void)
        changed = 1;
        break;
      case FP_NAMED:
        if (!ent->is_verified || !ent->is_named) {
        if (!ent->is_valid || !ent->is_named) {
          log_info(LD_DIRSERV,
                   "Router '%s' is now verified and named.", ent->nickname);
          ent->is_verified = ent->is_named = 1;
                   "Router '%s' is now valid and named.", ent->nickname);
          ent->is_valid = ent->is_named = 1;
          changed = 1;
        }
        break;
      case FP_VALID:
        if (!ent->is_verified || ent->is_named) {
          log_info(LD_DIRSERV, "Router '%s' is now verified.", ent->nickname);
          ent->is_verified = 1;
        if (!ent->is_valid || ent->is_named) {
          log_info(LD_DIRSERV, "Router '%s' is now valid.", ent->nickname);
          ent->is_valid = 1;
          ent->is_named = 0;
          changed = 1;
        }
        break;
      case FP_INVALID:
        if (ent->is_verified || ent->is_named) {
        if (ent->is_valid || ent->is_named) {
          log_info(LD_DIRSERV,
                   "Router '%s' is no longer verified.", ent->nickname);
          ent->is_verified = ent->is_named = 0;
                   "Router '%s' is no longer valid.", ent->nickname);
          ent->is_valid = ent->is_named = 0;
          changed = 1;
        }
        break;
@@ -683,7 +683,7 @@ list_single_server_status(routerinfo_t *desc, int is_live)
  if (!is_live) {
    *cp++ = '!';
  }
  if (desc->is_verified) {
  if (desc->is_valid) {
    strlcpy(cp, desc->nickname, sizeof(buf)-(cp-buf));
    cp += strlen(cp);
    *cp++ = '=';
@@ -1267,7 +1267,7 @@ _compare_longs(const void **a, const void **b)
}

/** Look through the routerlist, and assign the median uptime
 * of running verified servers to stable_uptime. */
 * of running valid servers to stable_uptime. */
static void
dirserv_compute_stable_uptime(routerlist_t *rl)
{
@@ -1275,7 +1275,7 @@ dirserv_compute_stable_uptime(routerlist_t *rl)
  long *up;

  SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
    if (ri->is_running && ri->is_verified) {
    if (ri->is_running && ri->is_valid) {
      up = tor_malloc(sizeof(long));
      *up = ri->uptime;
      smartlist_add(uptimes, up);
@@ -1401,7 +1401,7 @@ generate_v2_networkstatus(void)
      int f_authority = router_digest_is_trusted_dir(
                                      ri->cache_info.identity_digest);
      int f_named = naming && ri->is_named;
      int f_valid = ri->is_verified;
      int f_valid = ri->is_valid;
      int f_guard = f_fast && f_stable;
      /* 0.1.1.9-alpha is the first version to support fetch by descriptor
       * hash. */
@@ -1628,7 +1628,7 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key,
 * a certificate with digest <b>digest_rcvd</b> and nickname
 * <b>nickname_rcvd</b>.  When this happens, it's clear that any other
 * descriptors for that address/port combination must be unusable:
 * delete them if they are not verified.
 * delete them if they are not valid.
 *
 * Also, if as_advertised is 1, then inform the reachability checker
 * that we could get to this guy.
@@ -1653,7 +1653,7 @@ dirserv_orconn_tls_done(const char *address,
    int drop = 0;
    if (strcasecmp(address, ri->address) || or_port != ri->or_port)
      continue;
    if (!ri->is_verified) {
    if (!ri->is_valid) {
      /* We have a router at the same address! */
      if (strcasecmp(ri->nickname, nickname_rcvd)) {
        log_notice(LD_DIRSERV,
+9 −9
Original line number Diff line number Diff line
@@ -808,7 +808,7 @@ typedef struct {
  /* local info */
  unsigned int is_running:1; /**< As far as we know, is this OR currently
                              * running? */
  unsigned int is_verified:1; /**< Has a trusted dirserver validated this OR?
  unsigned int is_valid:1; /**< Has a trusted dirserver validated this OR?
                               *  (For Authdir: Have we validated this OR?)
                               */
  unsigned int is_named:1; /**< Do we believe the nickname that this OR gives
@@ -1175,11 +1175,11 @@ struct circuit_t {

typedef struct circuit_t circuit_t;

#define ALLOW_UNVERIFIED_ENTRY        1
#define ALLOW_UNVERIFIED_EXIT         2
#define ALLOW_UNVERIFIED_MIDDLE       4
#define ALLOW_UNVERIFIED_RENDEZVOUS   8
#define ALLOW_UNVERIFIED_INTRODUCTION 16
#define ALLOW_INVALID_ENTRY        1
#define ALLOW_INVALID_EXIT         2
#define ALLOW_INVALID_MIDDLE       4
#define ALLOW_INVALID_RENDEZVOUS   8
#define ALLOW_INVALID_INTRODUCTION 16

/** An entry specifying a set of addresses and ports that should be remapped
 * to another address and port before exiting this exit node. */
@@ -1240,8 +1240,8 @@ typedef struct {
  char *RendExcludeNodes; /**< Comma-separated list of nicknames not to use
                           * as introduction points. */

  smartlist_t *AllowUnverifiedNodes; /**< List of "entry", "middle", "exit" */
  int _AllowUnverified; /**< Bitmask; derived from AllowUnverifiedNodes; */
  smartlist_t *AllowInvalidNodes; /**< List of "entry", "middle", "exit" */
  int _AllowInvalid; /**< Bitmask; derived from AllowInvalidNodes; */
  config_line_t *ExitPolicy; /**< Lists of exit policy components. */
  int ExitPolicyRejectPrivate; /**< Should we not exit to local addresses? */
  config_line_t *SocksPolicy; /**< Lists of socks policy components */
@@ -2303,7 +2303,7 @@ routerinfo_t *router_choose_random_node(const char *preferred,
                                        smartlist_t *excludedsmartlist,
                                        int need_uptime, int need_bandwidth,
                                        int need_guard,
                                        int allow_unverified, int strict);
                                        int allow_invalid, int strict);
routerinfo_t *router_get_by_nickname(const char *nickname,
                                     int warn_if_unnamed);
routerinfo_t *router_get_by_hexdigest(const char *hexdigest);
Loading