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

[or-cvs] r12923: If BridgeRelay is set to 1, then the default for PublishServ (in tor/trunk: . src/or)



Author: arma
Date: 2007-12-22 04:04:46 -0500 (Sat, 22 Dec 2007)
New Revision: 12923

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/config.c
Log:
If BridgeRelay is set to 1, then the default for
PublishServerDescriptor is now "bridge" rather than "v2,v3".


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-12-22 08:27:42 UTC (rev 12922)
+++ tor/trunk/ChangeLog	2007-12-22 09:04:46 UTC (rev 12923)
@@ -18,7 +18,11 @@
     - Make PublishServerDescriptor default to 1, so the default doesn't
       have to change as we invent new directory protocol versions.
 
+  o Minor features:
+    - If BridgeRelay is set to 1, then the default for
+      PublishServerDescriptor is now "bridge" rather than "v2,v3".
 
+
 Changes in version 0.2.0.13-alpha - 2007-12-21
   o New directory authorities:
     - Set up lefkada (run by Geoff Goodell) as the fourth v3 directory

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-12-22 08:27:42 UTC (rev 12922)
+++ tor/trunk/src/or/config.c	2007-12-22 09:04:46 UTC (rev 12923)
@@ -2303,7 +2303,7 @@
   return 1;
 }
 
-/** Return true iff the option <b>var</b> has the same value in <b>o1</b>
+/** Return true iff the option <b>name</b> has the same value in <b>o1</b>
  * and <b>o2</b>.  Must not be called for LINELIST_S or OBSOLETE options.
  */
 static int
@@ -2529,23 +2529,28 @@
   return 0;
 }
 
-/** Parse an authority type from <b>list</b> and write it to *<b>auth</b>.  If
- * <b>compatible</b> is non-zero, treat "1" as "v2,v3" and treat "0" as "".
+/** Parse an authority type from <b>options</b>-\>PublishServerDescriptor
+ * and write it to <b>options</b>-\>_PublishServerDescriptor. Treat "1"
+ * as "v2,v3" unless BridgeRelay is 1, in which case treat it as "bridge".
+ * Treat "0" as "".
  * Return 0 on success or -1 if not a recognized authority type (in which
- * case the value of *<b>auth</b> is undefined). */
+ * case the value of _PublishServerDescriptor is undefined). */
 static int
-parse_authority_type_from_list(smartlist_t *list, authority_type_t *auth,
-                               int compatible)
+compute_publishserverdescriptor(or_options_t *options)
 {
-  tor_assert(auth);
+  smartlist_t *list = options->PublishServerDescriptor;
+  authority_type_t *auth = &options->_PublishServerDescriptor;
   *auth = NO_AUTHORITY;
   if (!list) /* empty list, answer is none */
     return 0;
   SMARTLIST_FOREACH(list, const char *, string, {
     if (!strcasecmp(string, "v1"))
       *auth |= V1_AUTHORITY;
-    else if (compatible && !strcmp(string, "1"))
-      *auth |= V2_AUTHORITY | V3_AUTHORITY;
+    else if (!strcmp(string, "1"))
+      if (options->BridgeRelay)
+        *auth |= BRIDGE_AUTHORITY;
+      else
+        *auth |= V2_AUTHORITY | V3_AUTHORITY;
     else if (!strcasecmp(string, "v2"))
       *auth |= V2_AUTHORITY;
     else if (!strcasecmp(string, "v3"))
@@ -2554,7 +2559,7 @@
       *auth |= BRIDGE_AUTHORITY;
     else if (!strcasecmp(string, "hidserv"))
       *auth |= HIDSERV_AUTHORITY;
-    else if (!strcasecmp(string, "") || (compatible && !strcmp(string, "0")))
+    else if (!strcasecmp(string, "") || !strcmp(string, "0"))
       /* no authority */;
     else
       return -1;
@@ -2936,8 +2941,7 @@
       });
   }
 
-  if ((parse_authority_type_from_list(options->PublishServerDescriptor,
-                               &options->_PublishServerDescriptor, 1) < 0)) {
+  if (compute_publishserverdescriptor(options) < 0) {
     r = tor_snprintf(buf, sizeof(buf),
                      "Unrecognized value in PublishServerDescriptor");
     *msg = tor_strdup(r >= 0 ? buf : "internal error");