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

[or-cvs] r10143: complain when we try to upload to, say, bridge authorities, (tor/trunk/src/or)



Author: arma
Date: 2007-05-08 22:20:03 -0400 (Tue, 08 May 2007)
New Revision: 10143

Modified:
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/or.h
Log:
complain when we try to upload to, say, bridge authorities,
yet we didn't configure any first.


Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2007-05-08 14:20:26 UTC (rev 10142)
+++ tor/trunk/src/or/directory.c	2007-05-09 02:20:03 UTC (rev 10143)
@@ -83,6 +83,19 @@
   return 1;
 }
 
+/** Return a static string describing <b>auth</b>. */
+const char *
+authority_type_to_string(authority_type_t auth)
+{
+  switch(auth) {
+    case V1_AUTHORITY: return "V1";
+    case V2_AUTHORITY: return "V2";
+    case BRIDGE_AUTHORITY: return "Bridge";
+    case HIDSERV_AUTHORITY: return "Hidden service";
+    case NO_AUTHORITY: default: return "[Unexpected authority type]";
+  }
+}
+
 /** Start a connection to every suitable directory server, using
  * connection purpose 'purpose' and uploading the payload 'payload'
  * (length 'payload_len').  The purpose should be one of
@@ -100,6 +113,7 @@
 {
   int post_via_tor;
   smartlist_t *dirservers = router_get_trusted_dir_servers();
+  int found = 0;
   tor_assert(dirservers);
   /* This tries dirservers which we believe to be down, but ultimately, that's
    * harmless, and we may as well err on the side of getting things uploaded.
@@ -120,6 +134,7 @@
         continue;
       if (type == V2_AUTHORITY && !ds->is_v2_authority)
         continue;
+      found = 1; /* at least one authority of this type was listed */
       if (purpose == DIR_PURPOSE_UPLOAD_DIR)
         ds->has_accepted_serverdesc = 0;
 
@@ -136,6 +151,11 @@
       directory_initiate_command_routerstatus(rs, purpose, post_via_tor,
                                               NULL, payload, upload_len);
     });
+  if (!found) {
+    log_warn(LD_DIR, "Publishing server descriptor to directory authorities "
+             "of type '%s', but no authorities of that type listed!",
+             authority_type_to_string(type));
+  }
 }
 
 /** Start a connection to a random running directory server, using

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-05-08 14:20:26 UTC (rev 10142)
+++ tor/trunk/src/or/or.h	2007-05-09 02:20:03 UTC (rev 10143)
@@ -2519,6 +2519,7 @@
 
 /********************************* directory.c ***************************/
 
+const char *authority_type_to_string(authority_type_t auth);
 void directory_post_to_dirservers(uint8_t purpose, authority_type_t type,
                                   const char *payload,
                                   size_t payload_len, size_t extrainfo_len);