mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
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
This commit is contained in:
parent
58eb3e405d
commit
12298901fd
2
changes/bug4971
Normal file
2
changes/bug4971
Normal file
@ -0,0 +1,2 @@
|
||||
o Minor Feature:
|
||||
- Provide default values for all options via "GETINFO config/defaults"
|
@ -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;
|
||||
}
|
||||
|
@ -2123,6 +2123,9 @@ static const getinfo_item_t getinfo_items[] = {
|
||||
PREFIX("config/", config, "Current configuration values."),
|
||||
DOC("config/names",
|
||||
"List of configuration options, types, and documentation."),
|
||||
DOC("config/defaults",
|
||||
"List of default values for configuration options. "
|
||||
"See also config/names"),
|
||||
ITEM("info/names", misc,
|
||||
"List of GETINFO options, types, and documentation."),
|
||||
ITEM("events/names", misc,
|
||||
|
Loading…
Reference in New Issue
Block a user