]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make RecommendedVersions a CONFIG_TYPE_LINELIST option, and have it tolerate whitespa...
authorNick Mathewson <nickm@torproject.org>
Fri, 15 Oct 2004 05:09:48 +0000 (05:09 +0000)
committerNick Mathewson <nickm@torproject.org>
Fri, 15 Oct 2004 05:09:48 +0000 (05:09 +0000)
svn:r2528

doc/TODO
src/or/config.c
src/or/dirserv.c
src/or/or.h

index fcd60e4533cc3d44b18f43bb62e8319a9fe2ed12..9d76cd06182659fe9df00b9b484824e216ec49de 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -11,9 +11,9 @@ ARMA    - arma claims
         X Abandoned
 
       0.0.9pre4:
-o       - Don't use FascistFirewall if you're going via Tor, or if
+        o Don't use FascistFirewall if you're going via Tor, or if
           you're going via HttpProxy.
-N       - make RecommendedVersions a CONFIG_TYPE_LINELIST option
+        o make RecommendedVersions a CONFIG_TYPE_LINELIST option
 R       . bandwidth buckets for write as well as read.
 N       - Handle rendezvousing with unverified nodes.
           - Specify: Stick rendezvous point's key in INTRODUCE cell.
index 8edce5121b1a2d57e6277ab5616782326094eb52..c071b413d3c953460580a06994ddd5738f38fb1e 100644 (file)
@@ -279,7 +279,7 @@ config_assign(or_options_t *options, struct config_line_t *list)
       config_compare(list, "RouterFile",     CONFIG_TYPE_STRING, &options->RouterFile) ||
       config_compare(list, "RunAsDaemon",    CONFIG_TYPE_BOOL, &options->RunAsDaemon) ||
       config_compare(list, "RunTesting",     CONFIG_TYPE_BOOL, &options->RunTesting) ||
-      config_compare(list, "RecommendedVersions",CONFIG_TYPE_STRING, &options->RecommendedVersions) ||
+      config_compare(list, "RecommendedVersions",CONFIG_TYPE_LINELIST, &options->RecommendedVersions) ||
       config_compare(list, "RendNodes",      CONFIG_TYPE_STRING, &options->RendNodes) ||
       config_compare(list, "RendExcludeNodes",CONFIG_TYPE_STRING, &options->RendExcludeNodes) ||
 
@@ -466,7 +466,6 @@ free_options(or_options_t *options)
   tor_free(options->RendNodes);
   tor_free(options->RendExcludeNodes);
   tor_free(options->OutboundBindAddress);
-  tor_free(options->RecommendedVersions);
   tor_free(options->User);
   tor_free(options->Group);
   tor_free(options->HttpProxy);
@@ -477,6 +476,7 @@ free_options(or_options_t *options)
   config_free_lines(options->ExitPolicy);
   config_free_lines(options->SocksPolicy);
   config_free_lines(options->DirServers);
+  config_free_lines(options->RecommendedVersions);
   if (options->FirewallPorts) {
     SMARTLIST_FOREACH(options->FirewallPorts, char *, cp, tor_free(cp));
     smartlist_free(options->FirewallPorts);
index dcfa207d09f3f745fc5bbc6112a90c3a19d58941..f414350bde349ad1e4d834b2a4c0f7d8ac5846c0 100644 (file)
@@ -559,6 +559,7 @@ dirserv_dump_directory_to_string(char *s, size_t maxlen,
 {
   char *cp, *eos;
   char *identity_pkey; /* Identity key, DER64-encoded. */
+  char *recommended_versions;
   char digest[20];
   char signature[128];
   char published[33];
@@ -589,6 +590,20 @@ dirserv_dump_directory_to_string(char *s, size_t maxlen,
     }
   }
 #endif
+
+  {
+    smartlist_t *versions;
+    struct config_line_t *ln;
+    versions = smartlist_create();
+    for (ln = options.RecommendedVersions; ln; ln = ln->next) {
+      smartlist_split_string(versions, ln->value, ",", 
+                             SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
+    }
+    recommended_versions = smartlist_join_strings(versions,",",0);
+    SMARTLIST_FOREACH(versions,char *,s,tor_free(s));
+    smartlist_free(versions);
+  }
+  
   dirserv_remove_old_servers(ROUTER_MAX_AGE);
   published_on = time(NULL);
   format_iso_time(published, published_on);
@@ -598,7 +613,7 @@ dirserv_dump_directory_to_string(char *s, size_t maxlen,
            "recommended-software %s\n"
            "running-routers %s\n"
            "opt dir-signing-key %s\n\n",
-           published, options.RecommendedVersions, cp, identity_pkey);
+           published, recommended_versions, cp, identity_pkey);
 
   tor_free(cp);
   tor_free(identity_pkey);
index 1fe05447da78605db8ccfabe67eee23744cad2a2..ff2a2957d198c56ac9827110ba231fb83add9235 100644 (file)
@@ -858,8 +858,9 @@ typedef struct {
   struct config_line_t *DirBindAddress;
   /** Local address to bind outbound sockets */
   char *OutboundBindAddress;
-  char *RecommendedVersions; /**< Directory server only: which versions of
-                              * Tor should we tell users to run? */
+  struct config_line_t *RecommendedVersions;
+  /**< Directory server only: which versions of 
+     * Tor should we tell users to run? */
   char *User; /**< Name of user to run Tor as. */
   char *Group; /**< Name of group to run Tor as. */
   double PathlenCoinWeight; /**< Parameter used to configure average path