diff options
author | David Goulet <dgoulet@torproject.org> | 2019-05-15 15:35:22 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2019-05-15 15:35:22 -0400 |
commit | 39a14421b1f50b4bea8c42e4f76a67b648bfa8e0 (patch) | |
tree | 35f098e731fa7d65f89748026484797cd5832ceb | |
parent | d71fa707dd01bdaa2ed301e82ace6fd23f63e638 (diff) | |
parent | b9f50a2d77caa119d02ce42356cd0b417ef22c65 (diff) | |
download | tor-39a14421b1f50b4bea8c42e4f76a67b648bfa8e0.tar.gz tor-39a14421b1f50b4bea8c42e4f76a67b648bfa8e0.zip |
Merge branch 'tor-github/pr/1021'
Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r-- | changes/bug30452 | 3 | ||||
-rw-r--r-- | doc/tor.1.txt | 4 | ||||
-rw-r--r-- | scripts/maint/practracker/exceptions.txt | 6 | ||||
-rw-r--r-- | src/app/config/config.c | 13 | ||||
-rw-r--r-- | src/app/main/main.c | 1 | ||||
-rw-r--r-- | src/feature/dirauth/authmode.h | 4 |
6 files changed, 28 insertions, 3 deletions
diff --git a/changes/bug30452 b/changes/bug30452 new file mode 100644 index 0000000000..2bb401d87d --- /dev/null +++ b/changes/bug30452 @@ -0,0 +1,3 @@ + o Minor features (compile-time modules): + - Add a --list-modules command to print a list of which compile-time + modules are enabled. Closes ticket 30452. diff --git a/doc/tor.1.txt b/doc/tor.1.txt index 8cb85fc351..4bd365c774 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -88,6 +88,10 @@ COMMAND-LINE OPTIONS List all valid options that are scheduled to become obsolete in a future version. (This is a warning, not a promise.) +[[opt-list-modules]] **--list-modules**:: + For each optional module, list whether or not it has been compiled + into Tor. (Any module not listed is not optional in this version of Tor.) + [[opt-version]] **--version**:: Display Tor version and exit. The output is a single line of the format "Tor version [version number]." (The version number format diff --git a/scripts/maint/practracker/exceptions.txt b/scripts/maint/practracker/exceptions.txt index cba3ddc1b3..4cee5453f0 100644 --- a/scripts/maint/practracker/exceptions.txt +++ b/scripts/maint/practracker/exceptions.txt @@ -29,13 +29,13 @@ # # Remember: It is better to fix the problem than to add a new exception! -problem file-size /src/app/config/config.c 8510 +problem file-size /src/app/config/config.c 8520 problem include-count /src/app/config/config.c 88 problem function-size /src/app/config/config.c:options_act_reversible() 296 problem function-size /src/app/config/config.c:options_act() 588 problem function-size /src/app/config/config.c:resolve_my_address() 192 problem function-size /src/app/config/config.c:options_validate() 1220 -problem function-size /src/app/config/config.c:options_init_from_torrc() 202 +problem function-size /src/app/config/config.c:options_init_from_torrc() 210 problem function-size /src/app/config/config.c:options_init_from_string() 173 problem function-size /src/app/config/config.c:options_init_logs() 146 problem function-size /src/app/config/config.c:parse_bridge_line() 104 @@ -49,7 +49,7 @@ problem function-size /src/app/config/confparse.c:config_assign_value() 205 problem function-size /src/app/config/confparse.c:config_get_assigned_option() 129 problem include-count /src/app/main/main.c 67 problem function-size /src/app/main/main.c:dumpstats() 102 -problem function-size /src/app/main/main.c:tor_init() 136 +problem function-size /src/app/main/main.c:tor_init() 137 problem function-size /src/app/main/main.c:sandbox_init_filter() 291 problem function-size /src/app/main/main.c:run_tor_main_loop() 105 problem function-size /src/app/main/ntmain.c:nt_service_install() 125 diff --git a/src/app/config/config.c b/src/app/config/config.c index e601bb2ecd..d03305627b 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -2449,6 +2449,7 @@ static const struct { { "--quiet", TAKES_NO_ARGUMENT }, { "--hush", TAKES_NO_ARGUMENT }, { "--version", TAKES_NO_ARGUMENT }, + { "--list-modules", TAKES_NO_ARGUMENT }, { "--library-versions", TAKES_NO_ARGUMENT }, { "-h", TAKES_NO_ARGUMENT }, { "--help", TAKES_NO_ARGUMENT }, @@ -2670,6 +2671,13 @@ list_deprecated_options(void) } } +/** Print all compile-time modules and their enabled/disabled status. */ +static void +list_enabled_modules(void) +{ + printf("%s: %s\n", "dirauth", have_module_dirauth() ? "yes" : "no"); +} + /** Last value actually set by resolve_my_address. */ static uint32_t last_resolved_addr = 0; @@ -5195,6 +5203,11 @@ options_init_from_torrc(int argc, char **argv) return 1; } + if (config_line_find(cmdline_only_options, "--list-modules")) { + list_enabled_modules(); + return 1; + } + if (config_line_find(cmdline_only_options, "--library-versions")) { printf("Tor version %s. \n", get_version()); printf("Library versions\tCompiled\t\tRuntime\n"); diff --git a/src/app/main/main.c b/src/app/main/main.c index 184b9e91da..6e325f0b10 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -561,6 +561,7 @@ tor_init(int argc, char *argv[]) if (!strcmp(cl->key, "--version") || !strcmp(cl->key, "--digests") || !strcmp(cl->key, "--list-torrc-options") || !strcmp(cl->key, "--library-versions") || + !strcmp(cl->key, "--list-modules") || !strcmp(cl->key, "--hash-password") || !strcmp(cl->key, "-h") || !strcmp(cl->key, "--help")) { if (quiet < 1) diff --git a/src/feature/dirauth/authmode.h b/src/feature/dirauth/authmode.h index 40a89c7397..876a1f947b 100644 --- a/src/feature/dirauth/authmode.h +++ b/src/feature/dirauth/authmode.h @@ -27,6 +27,8 @@ authdir_mode_v3(const or_options_t *options) return authdir_mode(options) && options->V3AuthoritativeDir != 0; } +#define have_module_dirauth() (1) + #else /* HAVE_MODULE_DIRAUTH */ #define authdir_mode(options) (((void)(options)),0) @@ -37,6 +39,8 @@ authdir_mode_v3(const or_options_t *options) #define authdir_mode_bridge(options) (((void)(options)),0) #define authdir_mode_v3(options) (((void)(options)),0) +#define have_module_dirauth() (0) + #endif /* HAVE_MODULE_DIRAUTH */ #endif /* TOR_MODE_H */ |