[or-cvs] r9043: Change logging format of state file to only include non-defa (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Thu Dec 7 18:57:33 UTC 2006


Author: nickm
Date: 2006-12-07 13:57:29 -0500 (Thu, 07 Dec 2006)
New Revision: 9043

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/config.c
   tor/trunk/src/or/rephist.c
Log:
 r11461 at Kushana:  nickm | 2006-12-07 13:16:45 -0500
 Change logging format of state file to only include non-default values.  Adjust clients to never store bandwidth history in the state file. (Possible backport candidate.)



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11461] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-12-07 18:57:22 UTC (rev 9042)
+++ tor/trunk/ChangeLog	2006-12-07 18:57:29 UTC (rev 9043)
@@ -12,6 +12,9 @@
   o Security bugfixes:
     - Do not log introduction points for hidden services if SafeLogging
       is set.
+    - Clients do not store bandwidth history in their state files. (This
+      shouldn't be an exploitable security issue, but it's better to be
+      safe.)
 
   o Controller bugfixes:
     - Report the circuit number correctly in STREAM CLOSED events. (Bug

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2006-12-07 18:57:22 UTC (rev 9042)
+++ tor/trunk/src/or/config.c	2006-12-07 18:57:29 UTC (rev 9043)
@@ -274,11 +274,11 @@
   VAR("EntryGuards",             LINELIST_V,  EntryGuards,             NULL),
 
   VAR("BWHistoryReadEnds",       ISOTIME,     BWHistoryReadEnds,      NULL),
-  VAR("BWHistoryReadInterval",   UINT,        BWHistoryReadInterval,  NULL),
-  VAR("BWHistoryReadValues",     CSV,         BWHistoryReadValues,    NULL),
+  VAR("BWHistoryReadInterval",   UINT,        BWHistoryReadInterval,  "900"),
+  VAR("BWHistoryReadValues",     CSV,         BWHistoryReadValues,    ""),
   VAR("BWHistoryWriteEnds",      ISOTIME,     BWHistoryWriteEnds,     NULL),
-  VAR("BWHistoryWriteInterval",  UINT,        BWHistoryWriteInterval, NULL),
-  VAR("BWHistoryWriteValues",    CSV,         BWHistoryWriteValues,   NULL),
+  VAR("BWHistoryWriteInterval",  UINT,        BWHistoryWriteInterval, "900"),
+  VAR("BWHistoryWriteValues",    CSV,         BWHistoryWriteValues,   ""),
 
   VAR("TorVersion",              STRING,      TorVersion,             NULL),
 
@@ -3968,7 +3968,7 @@
   global_state->LastWritten = time(NULL);
   tor_free(global_state->TorVersion);
   global_state->TorVersion = tor_strdup("Tor " VERSION);
-  state = config_dump(&state_format, global_state, 0);
+  state = config_dump(&state_format, global_state, 1);
   len = strlen(state)+128;
   contents = tor_malloc(len);
   format_local_iso_time(tbuf, time(NULL));

Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c	2006-12-07 18:57:22 UTC (rev 9042)
+++ tor/trunk/src/or/rephist.c	2006-12-07 18:57:29 UTC (rev 9043)
@@ -659,12 +659,20 @@
     s_interval= r?&state->BWHistoryReadInterval:&state->BWHistoryWriteInterval;
     s_values  = r?&state->BWHistoryReadValues  :&state->BWHistoryWriteValues;
 
-    *s_begins = b->next_period;
-    *s_interval = NUM_SECS_BW_SUM_INTERVAL;
     if (*s_values) {
       SMARTLIST_FOREACH(*s_values, char *, cp, tor_free(cp));
       smartlist_free(*s_values);
     }
+    if (! server_mode(get_options())) {
+      /* Clients don't need to store bandwidth history persistently;
+       * force these values to the defaults. */
+      *s_begins = 0;
+      *s_interval = 900;
+      *s_values = smartlist_create();
+      continue;
+    }
+    *s_begins = b->next_period;
+    *s_interval = NUM_SECS_BW_SUM_INTERVAL;
     cp = buf;
     cp += rep_hist_fill_bandwidth_history(cp, len, b);
     tor_snprintf(cp, len-(cp-buf), cp == buf ? U64_FORMAT : ","U64_FORMAT,



More information about the tor-commits mailing list