diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-09-01 10:58:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-09-22 09:24:35 -0400 |
commit | bca4211de5464cd159592b359b2f16eb64d3c07f (patch) | |
tree | 462b3d2249f6330cf977bd3c0282853e84b45065 /src/or/config.c | |
parent | d8f031aec2ee84c753ef282577c7f4fcf0123d2f (diff) | |
download | tor-bca4211de5464cd159592b359b2f16eb64d3c07f.tar.gz tor-bca4211de5464cd159592b359b2f16eb64d3c07f.zip |
Add a --master-key option
This lets the user override the default location for the master key
when used with --keygen
Part of 16769.
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c index b4a490c70f..d954316b3b 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -762,6 +762,7 @@ or_options_free(or_options_t *options) } tor_free(options->BridgePassword_AuthDigest_); tor_free(options->command_arg); + tor_free(options->master_key_fname); config_free(&options_format, options); } @@ -1919,6 +1920,7 @@ static const struct { { "--list-fingerprint", TAKES_NO_ARGUMENT }, { "--keygen", TAKES_NO_ARGUMENT }, { "--newpass", TAKES_NO_ARGUMENT }, + { "--master-key", ARGUMENT_NECESSARY }, { "--no-passphrase", TAKES_NO_ARGUMENT }, { "--passphrase-fd", ARGUMENT_NECESSARY }, { "--verify-config", TAKES_NO_ARGUMENT }, @@ -4547,6 +4549,19 @@ options_init_from_torrc(int argc, char **argv) } } + { + const config_line_t *key_line = config_line_find(cmdline_only_options, + "--master-key"); + if (key_line) { + if (command != CMD_KEYGEN) { + log_err(LD_CONFIG, "--master-key without --keygen!"); + exit(1); + } else { + get_options_mutable()->master_key_fname = tor_strdup(key_line->value); + } + } + } + err: tor_free(cf); |