From: Nick Mathewson Date: Tue, 17 Aug 2004 05:13:58 +0000 (+0000) Subject: Implement AllowUnverifiedNodes X-Git-Tag: tor-0.0.8rc1~51 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74621132a9dbf6ec4132633520f166342edb8c53;p=thirdparty%2Ftor.git Implement AllowUnverifiedNodes svn:r2246 --- diff --git a/doc/TODO b/doc/TODO index 3b3b779d2f..0b0d2dd582 100644 --- a/doc/TODO +++ b/doc/TODO @@ -24,8 +24,8 @@ NICK . put ip:port:keyhash in intro points, rendezvous points, NICK - unify similar config entries that need to be split. put them into a smartlist, and have things take a smartlist. - - "AllowUnverifiedRouters" config option -NICK - Parse it into 3 bits + . "AllowUnverifiedRouters" config option + o Parse it into 3 bits ARMA - Consider it when picking nodes for your path ARMA - if there's only one entrynode preference and multiple exit node choices, don't pick the desired entrynode as exit. diff --git a/src/or/config.c b/src/or/config.c index 0bf510acc9..a4d0490df2 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -231,6 +231,7 @@ static int config_assign(or_options_t *options, struct config_line_t *list) { /* string options */ config_compare(list, "Address", CONFIG_TYPE_STRING, &options->Address) || + config_compare(list, "AllowUnverifiedNodes", CONFIG_TYPE_CSV, &options->AllowUnverifiedNodes) || config_compare(list, "AuthoritativeDirectory",CONFIG_TYPE_BOOL, &options->AuthoritativeDir) || config_compare(list, "BandwidthRate", CONFIG_TYPE_INT, &options->BandwidthRate) || @@ -808,9 +809,25 @@ int getconfig(int argc, char **argv, or_options_t *options) { } if(options->FirewallPorts) { SMARTLIST_FOREACH(options->FirewallPorts, const char *, cp, - { i = atoi(cp); + { i = atoi(cp); if (i < 1 || i > 65535) { - log(LOG_WARN, "Port %s out of range in FirewallPorts", cp); + log(LOG_WARN, "Port '%s' out of range in FirewallPorts", cp); + result=-1; + } + }); + } + options->_AllowUnverified = 0; + if(options->AllowUnverifiedNodes) { + SMARTLIST_FOREACH(options->AllowUnverifiedNodes, const char *, cp, + { if (!strcasecmp(cp, "entry")) + options->_AllowUnverified |= ALLOW_UNVERIFIED_ENTRY; + else if (!strcasecmp(cp, "exit")) + options->_AllowUnverified |= ALLOW_UNVERIFIED_EXIT; + else if (!strcasecmp(cp, "middle")) + options->_AllowUnverified |= ALLOW_UNVERIFIED_MIDDLE; + else { + log(LOG_WARN, "Unrecognized value '%s' in AllowUnverifiedNodes", + cp); result=-1; } }); diff --git a/src/or/or.h b/src/or/or.h index 3edf23a48a..19cb7ea149 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -808,6 +808,11 @@ struct circuit_t { typedef struct circuit_t circuit_t; +#define ALLOW_UNVERIFIED_ENTRY 1 +#define ALLOW_UNVERIFIED_EXIT 2 +#define ALLOW_UNVERIFIED_MIDDLE 4 + + /** Configuration options for a Tor process */ typedef struct { struct config_line_t *LogOptions; /**< List of configuration lines @@ -836,6 +841,8 @@ typedef struct { char *RendExcludeNodes; /**< Comma-separated list of nicknames not to use * as introduction points. */ + smartlist_t *AllowUnverifiedNodes; /**< List of "entry", "middle", "exit" */ + int _AllowUnverified; /**< Bitmask; derived from AllowUnverifiedNodes; */ struct config_line_t *ExitPolicy; /**< Lists of exit policy components. */ struct config_line_t *SocksPolicy; /**< Lists of socks policy components */ /** Addresses to bind for listening for SOCKS connections. */