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

[or-cvs] populate router_get_my_routerinfo()->is_verified



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	connection_or.c router.c routerlist.c routerparse.c 
Log Message:
populate router_get_my_routerinfo()->is_verified


Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_or.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- connection_or.c	21 Jul 2004 18:20:09 -0000	1.121
+++ connection_or.c	22 Jul 2004 06:03:52 -0000	1.122
@@ -207,8 +207,20 @@
  * 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;

Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- router.c	22 Jul 2004 04:20:27 -0000	1.73
+++ router.c	22 Jul 2004 06:03:52 -0000	1.74
@@ -126,14 +126,12 @@
 
 /** 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,8 +140,9 @@
 /* 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,
-                                                 const char *fname_new)
+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 @@
   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;

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- routerlist.c	21 Jul 2004 18:53:56 -0000	1.105
+++ routerlist.c	22 Jul 2004 06:03:53 -0000	1.106
@@ -794,7 +794,7 @@
                                            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 @@
   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);

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- routerparse.c	21 Jul 2004 09:13:12 -0000	1.16
+++ routerparse.c	22 Jul 2004 06:03:53 -0000	1.17
@@ -313,8 +313,8 @@
  */
 int /* Should be static; exposed for unit tests */
 router_parse_routerlist_from_directory(const char *str,
-				       routerlist_t **dest,
-				       crypto_pk_env_t *pkey)
+                                       routerlist_t **dest,
+                                       crypto_pk_env_t *pkey)
 {
   directory_token_t *tok;
   char digest[DIGEST_LEN];
@@ -389,11 +389,18 @@
   }
   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;
   if (router_parse_list_from_string(&str, &new_dir,
-				    good_nickname_list)) {
+                                    good_nickname_list)) {
     log_fn(LOG_WARN, "Error reading routers from directory");
     goto err;
   }