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

populate router_get_my_routerinfo()->is_verified


svn:r2097
parent 38d8e369
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -207,8 +207,20 @@ connection_t *connection_or_connect(uint32_t addr, uint16_t port,
 * Return -1 if <b>conn</b> is broken, else return 0.
 */
int connection_tls_start_handshake(connection_t *conn, int receiving) {
  int use_no_cert=0;
  conn->state = OR_CONN_STATE_HANDSHAKING;
  conn->tls = tor_tls_new(conn->s, receiving);
  if(receiving) { /* check if he's 0.0.7 and I'm unverified */
    routerinfo_t *him, *me;
    him = router_get_by_digest(conn->identity_digest);
    me = router_get_my_routerinfo();

    if(him && !strncmp(him->platform, "Tor 0.0.7", 9) &&
       (!me || !me->is_verified)) {
      log_fn(LOG_INFO,"He's running 0.0.7, and I'm unverified. Acting like OP.");
      use_no_cert = 1;
    }
  }
  conn->tls = tor_tls_new(conn->s, receiving, use_no_cert);
  if(!conn->tls) {
    log_fn(LOG_WARN,"tor_tls_new failed. Closing.");
    return -1;
+6 −4
Original line number Diff line number Diff line
@@ -126,14 +126,12 @@ void rotate_onion_key(void)

/** The last calculated bandwidth usage for our node. */
static int advertised_bw = 0;

/** Tuck <b>bw</b> away so we can produce it when somebody
 * calls router_get_advertised_bandwidth() below.
 */
void router_set_advertised_bandwidth(int bw) {
  advertised_bw = bw;
}

/** Return the value we tucked away above, or zero by default. */
int router_get_advertised_bandwidth(void) {
  return advertised_bw;
@@ -142,7 +140,8 @@ int router_get_advertised_bandwidth(void) {
/* Read an RSA secret key key from a file that was once named fname_old,
 * but is now named fname_new.  Rename the file from old to new as needed.
 */
crypto_pk_env_t *init_key_from_file_name_changed(const char *fname_old,
static crypto_pk_env_t *
init_key_from_file_name_changed(const char *fname_old,
                                const char *fname_new)
{
  int fs;
@@ -532,6 +531,9 @@ int router_rebuild_descriptor(void) {
  ri->exit_policy = NULL; /* zero it out first */
  router_add_exit_policy_from_config(ri);
  ri->is_trusted_dir = authdir_mode();
  if(desc_routerinfo) /* inherit values */
    ri->is_verified = desc_routerinfo->is_verified;

  if (desc_routerinfo)
    routerinfo_free(desc_routerinfo);
  desc_routerinfo = ri;
+5 −1
Original line number Diff line number Diff line
@@ -794,7 +794,7 @@ void routerlist_update_from_runningrouters(routerlist_t *list,
                                           running_routers_t *rr)
{
  int n_routers, i;
  routerinfo_t *router;
  routerinfo_t *router, *me = router_get_my_routerinfo();
  if (!list)
    return;
  if (list->published_on >= rr->published_on)
@@ -802,6 +802,10 @@ void routerlist_update_from_runningrouters(routerlist_t *list,
  if (list->running_routers_updated_on >= rr->published_on)
    return;

  if(me) /* learn if the dirservers think I'm verified */
    router_update_status_from_smartlist(me,
                                        rr->published_on,
                                        rr->running_routers);
  n_routers = smartlist_len(list->routers);
  for (i=0; i<n_routers; ++i) {
    router = smartlist_get(list->routers, i);
+10 −3
Original line number Diff line number Diff line
@@ -389,6 +389,13 @@ router_parse_routerlist_from_directory(const char *str,
  }
  tok->n_args = 0; /* Don't free the strings in good_nickname_lst yet. */

  /* Determine if my routerinfo is considered verified. */
  {
    routerinfo_t *me = router_get_my_routerinfo();
    if(me)
      router_update_status_from_smartlist(me, time(NULL), good_nickname_list);
  }

  /* Read the router list from s, advancing s up past the end of the last
   * router. */
  str = end;