diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-10-15 01:58:11 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-10-15 01:58:11 +0000 |
commit | 7fa5d224d4469de9ff69f41a245ada9b329a2840 (patch) | |
tree | 65464005a80a12dd2e103bac4534ea23d212afdd /src/or/config.c | |
parent | e448879e3cd1a664c76f4c586cc4fe6f893b1187 (diff) | |
download | tor-7fa5d224d4469de9ff69f41a245ada9b329a2840.tar tor-7fa5d224d4469de9ff69f41a245ada9b329a2840.tar.gz |
Implement "families" of coadministered nodes; prevent them all from appearing on the same circuit.
svn:r2523
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/src/or/config.c b/src/or/config.c index db73a2fcc..8edce5121 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -244,6 +244,7 @@ config_assign(or_options_t *options, struct config_line_t *list) config_compare(list, "FascistFirewall",CONFIG_TYPE_BOOL, &options->FascistFirewall) || config_compare(list, "FirewallPorts",CONFIG_TYPE_CSV, &options->FirewallPorts) || + config_compare(list, "MyFamily", CONFIG_TYPE_STRING, &options->MyFamily) || config_compare(list, "Group", CONFIG_TYPE_STRING, &options->Group) || @@ -517,6 +518,7 @@ init_options(or_options_t *options) options->RendConfigLines = NULL; options->FirewallPorts = NULL; options->DirServers = NULL; + options->MyFamily = NULL; } static char * @@ -554,6 +556,30 @@ get_default_conf_file(void) #endif } +/** Verify whether lst is a string containing valid-looking space-separated + * nicknames, or NULL. Return 0 on success. Warn and return -1 on failure. + */ +static int check_nickname_list(const char *lst, const char *name) +{ + int r = 0; + smartlist_t *sl; + + if (!lst) + return 0; + sl = smartlist_create(); + smartlist_split_string(sl, lst, ",", SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); + SMARTLIST_FOREACH(sl, const char *, s, + { + if (!is_legal_nickname_or_hexdigest(s)) { + log_fn(LOG_WARN, "Invalid nickname '%s' in %s line", s, name); + r = -1; + } + }); + SMARTLIST_FOREACH(sl, char *, s, tor_free(s)); + smartlist_free(sl); + return r; +} + /** Read a configuration file into <b>options</b>, finding the configuration * file location based on the command line. After loading the options, * validate them for consistency. Return 0 if success, <0 if failure. */ @@ -838,6 +864,19 @@ getconfig(int argc, char **argv, or_options_t *options) } } + if (check_nickname_list(options->ExitNodes, "ExitNodes")) + return -1; + if (check_nickname_list(options->EntryNodes, "EntryNodes")) + return -1; + if (check_nickname_list(options->ExcludeNodes, "ExcludeNodes")) + return -1; + if (check_nickname_list(options->RendNodes, "RendNodes")) + return -1; + if (check_nickname_list(options->RendNodes, "RendExcludeNodes")) + return -1; + if (check_nickname_list(options->MyFamily, "MyFamily")) + return -1; + clear_trusted_dir_servers(); if (!options->DirServers) { add_default_trusted_dirservers(); @@ -848,10 +887,6 @@ getconfig(int argc, char **argv, or_options_t *options) } } - /* XXX look at the various nicknamelists and make sure they're - * valid and don't have hostnames that are too long. - */ - if (rend_config_services(options) < 0) { result = -1; } |