summaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-05-03 10:04:08 +0000
committerRoger Dingledine <arma@torproject.org>2005-05-03 10:04:08 +0000
commit5265bbd2b8f4a28f26eabb48a4d167b765780b26 (patch)
tree9e3ee23068a617dc137f0fa203adb8b21c8a8c30 /src/or/config.c
parentb35f7dacef6b5e4215dfba9a4088a73421fb103c (diff)
downloadtor-5265bbd2b8f4a28f26eabb48a4d167b765780b26.tar.gz
tor-5265bbd2b8f4a28f26eabb48a4d167b765780b26.zip
first iteration of scrubbing sensitive strings from logs.
also generally clean up log messages. svn:r4174
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c
index d663c2c1d5..f374d8ab46 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -168,6 +168,7 @@ static config_var_t config_vars[] = {
VAR("RecommendedVersions", LINELIST, RecommendedVersions, NULL),
VAR("RendNodes", STRING, RendNodes, NULL),
VAR("RendExcludeNodes", STRING, RendExcludeNodes, NULL),
+ VAR("SafeLogging", BOOL, SafeLogging, "1"),
VAR("ShutdownWaitLength", INTERVAL, ShutdownWaitLength, "30 seconds"),
VAR("SocksPort", UINT, SocksPort, "9050"),
VAR("SocksBindAddress", LINELIST, SocksBindAddress, NULL),
@@ -249,6 +250,17 @@ config_free_all(void)
tor_free(config_fname);
}
+/** If options->SafeLogging is on, return a not very useful string,
+ * else return address.
+ */
+const char *
+safe_str(const char *address) {
+ if (get_options()->SafeLogging)
+ return "[scrubbed]";
+ else
+ return address;
+}
+
/** Fetch the active option list, and take actions based on it. All
* of the things we do should survive being done repeatedly.
* Return 0 if all goes well, return -1 if it's time to die.
@@ -930,7 +942,7 @@ static void
print_usage(void)
{
printf(
-"Copyright 2001-2004 Roger Dingledine, Nick Mathewson, Matej Pfajfar.\n\n"
+"Copyright 2001-2005 Roger Dingledine, Nick Mathewson.\n\n"
"tor -f <torrc> [args]\n"
"See man page for options, or http://tor.eff.org/ for documentation.\n");
}
@@ -1617,8 +1629,8 @@ options_transition_allowed(or_options_t *old, or_options_t *new_val) {
return -1;
}
- if (old->RunAsDaemon && !new_val->RunAsDaemon) {
- log_fn(LOG_WARN,"During reload, change from RunAsDaemon=1 to =0 not allowed. Failing.");
+ if (old->RunAsDaemon != new_val->RunAsDaemon) {
+ log_fn(LOG_WARN,"During reload, changing RunAsDaemon is not allowed. Failing.");
return -1;
}
@@ -1638,7 +1650,7 @@ options_transition_allowed(or_options_t *old, or_options_t *new_val) {
}
if (!opt_streq(old->Group, new_val->Group)) {
- log_fn(LOG_WARN,"During reload, changing User is not allowed. Failing.");
+ log_fn(LOG_WARN,"During reload, changing Group is not allowed. Failing.");
return -1;
}
@@ -2173,7 +2185,7 @@ config_parse_addr_policy(struct config_line_t *cfg,
if (*nextp) {
nextp = &((*nextp)->next);
} else {
- log_fn(LOG_WARN,"Malformed policy %s.", ent);
+ log_fn(LOG_WARN,"Malformed policy '%s'.", ent);
r = -1;
}
});