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

[or-cvs] Make directories get generated properly again; debug key lo...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv11456/or

Modified Files:
	config.c routerlist.c routerparse.c 
Log Message:
Make directories get generated properly again; debug key lookup.  Also, it is hard to find entries in a table when you never put them there.

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- config.c	12 Oct 2004 20:22:09 -0000	1.163
+++ config.c	13 Oct 2004 18:28:38 -0000	1.164
@@ -1096,6 +1096,8 @@
     log_fn(LOG_WARN, "Unable to decode DirServer key digest."); goto err;
   }
 
+  log_fn(LOG_DEBUG, "Trusted dirserver at %s:%d (%s)", address,(int)port,
+         (char*)smartlist_get(items,1));
   add_trusted_dir_server(address, port, digest);
 
   r = 0;

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- routerlist.c	12 Oct 2004 15:55:20 -0000	1.149
+++ routerlist.c	13 Oct 2004 18:28:39 -0000	1.150
@@ -1159,6 +1159,7 @@
   ent->dir_port = port;
   ent->is_running = 1;
   memcpy(ent->digest, digest, DIGEST_LEN);
+  smartlist_add(trusted_dir_servers, ent);
 }
 
 static void clear_trusted_dir_servers(void)

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- routerparse.c	12 Oct 2004 20:17:45 -0000	1.51
+++ routerparse.c	13 Oct 2004 18:28:39 -0000	1.52
@@ -610,6 +610,8 @@
 {
   char signed_digest[PK_BYTES];
   routerinfo_t *r;
+  crypto_pk_env_t *_pkey = NULL;
+  
 
   if (tok->n_args != 1) {
     log_fn(LOG_WARN, "Too many or too few arguments to directory-signature");
@@ -618,14 +620,16 @@
 
   if (declared_key) {
     if (dir_signing_key_is_trusted(declared_key))
-      pkey = declared_key;
-  } else {
+      _pkey = declared_key;
+  } 
+  if (!_pkey) {
     r = router_get_by_nickname(tok->args[0]);
     log_fn(LOG_DEBUG, "Got directory signed by %s", tok->args[0]);
     if (r && r->is_trusted_dir) {
-      pkey = r->identity_pkey;
+      _pkey = r->identity_pkey;
     } else if (!r && pkey) {
       /* pkey provided for debugging purposes. */
+      _pkey = pkey;
     } else if (!r) {
       log_fn(LOG_WARN, "Directory was signed by unrecognized server %s",
              tok->args[0]);
@@ -642,9 +646,9 @@
     return -1;
   }
 
-  tor_assert(pkey);
+  tor_assert(_pkey);
 
-  if (crypto_pk_public_checksig(pkey, tok->object_body, 128, signed_digest)
+  if (crypto_pk_public_checksig(_pkey, tok->object_body, 128, signed_digest)
       != 20) {
     log_fn(LOG_WARN, "Error reading directory: invalid signature.");
     return -1;