diff options
author | meejah <meejah@meejah.ca> | 2012-04-05 15:17:30 -0600 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-28 15:15:51 -0400 |
commit | 12298901fd6a8ce0608129cf9e65dfc32d161a57 (patch) | |
tree | ebf613a322bd89c249e61563ab0c02e227f05634 /src/or/config.c | |
parent | 58eb3e405d5b7e2a74bd5813e3d3f54ab543bcda (diff) | |
download | tor-12298901fd6a8ce0608129cf9e65dfc32d161a57.tar.gz tor-12298901fd6a8ce0608129cf9e65dfc32d161a57.zip |
add new GETINFO config/defaults
returns the default values for every configuration item, similar
to GETINFO config/names; include a changes entry for it.
Fix for bug 4971
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c index 042fc1aa3c..ceb21b0cf0 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -7180,6 +7180,20 @@ getinfo_helper_config(control_connection_t *conn, *answer = smartlist_join_strings(sl, "", 0, NULL); SMARTLIST_FOREACH(sl, char *, c, tor_free(c)); smartlist_free(sl); + } else if (!strcmp(question, "config/defaults")) { + smartlist_t *sl = smartlist_new(); + int i; + for (i = 0; _option_vars[i].name; ++i) { + const config_var_t *var = &_option_vars[i]; + if (var->initvalue != NULL) { + char *val = esc_for_log(var->initvalue); + smartlist_add_asprintf(sl, "%s %s\n",var->name,val); + tor_free(val); + } + } + *answer = smartlist_join_strings(sl, "", 0, NULL); + SMARTLIST_FOREACH(sl, char *, c, tor_free(c)); + smartlist_free(sl); } return 0; } |