Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: rl1987/tor
base: master
head repository: rl1987/tor
compare: ticket15015
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 5 files changed
  • 0 comments
  • 1 contributor
Showing with 29 additions and 1 deletion.
  1. +4 −0 changes/ticket15015
  2. +11 −1 doc/tor.1.txt
  3. +12 −0 src/or/config.c
  4. +1 −0 src/or/main.c
  5. +1 −0 src/or/or.h
@@ -0,0 +1,4 @@
o Minor features (config options and command line):
- Add --parse-config command line option to perform quick
torrc validation without binding ports and requiring system
privileges. Closes ticket 15015.
@@ -68,7 +68,17 @@ COMMAND-LINE OPTIONS
Generate your keys and output your nickname and fingerprint.

[[opt-verify-config]] **--verify-config**::
Verify the configuration file is valid.
Verify that configuration file is valid and compatible with current
configuration of your system. Note that this will attempt to bind
ports and may need root access. For preliminary torrc validation,
use **--parse-config**. Is likely to fail if tor service is already
running.

[[opt-parse-config]] **--parse-config**::
Perform preliminary torrc validity checks. This will attempt to parse
the torrc file and see if it looks valid. Note that this does not check
if configuration is valid in the context of entire system setup; for
this, use **--verify-config**. Can be used while tor service is running.

[[opt-serviceinstall]] **--service install** [**--options** __command-line options__]::
Install an instance of Tor as a Windows service, with the provided
@@ -2393,6 +2393,7 @@ static const struct {
{ "--no-passphrase", TAKES_NO_ARGUMENT },
{ "--passphrase-fd", ARGUMENT_NECESSARY },
{ "--verify-config", TAKES_NO_ARGUMENT },
{ "--parse-config", TAKES_NO_ARGUMENT },
{ "--ignore-missing-torrc", TAKES_NO_ARGUMENT },
{ "--quiet", TAKES_NO_ARGUMENT },
{ "--hush", TAKES_NO_ARGUMENT },
@@ -5199,6 +5200,8 @@ options_init_from_torrc(int argc, char **argv)
command_arg = p_index->value;
} else if (!strcmp(p_index->key, "--verify-config")) {
command = CMD_VERIFY_CONFIG;
} else if (!strcmp(p_index->key, "--parse-config")) {
command = CMD_PARSE_CONFIG;
}
}

@@ -5232,6 +5235,15 @@ options_init_from_torrc(int argc, char **argv)
retval = options_init_from_string(cf_defaults, cf, command, command_arg,
&errmsg);

if (command == CMD_PARSE_CONFIG) {
if (retval == SETOPT_ERR_PARSE) {
log_err(LD_CONFIG, "--parse-config failed: %s",
errmsg ? errmsg : "unknown error");
retval = -1;
goto err;
}
}

if (retval < 0)
goto err;

@@ -4137,6 +4137,7 @@ tor_run_main(const tor_main_configuration_t *tor_cfg)
result = 0;
break;
case CMD_VERIFY_CONFIG:
case CMD_PARSE_CONFIG:
if (quiet_level == 0)
printf("Configuration was valid\n");
result = 0;
@@ -3632,6 +3632,7 @@ typedef struct {
CMD_VERIFY_CONFIG, CMD_RUN_UNITTESTS, CMD_DUMP_CONFIG,
CMD_KEYGEN,
CMD_KEY_EXPIRATION,
CMD_PARSE_CONFIG,
} command;
char *command_arg; /**< Argument for command-line option. */

No commit comments for this range