summaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-02-25 20:46:13 +0000
committerNick Mathewson <nickm@torproject.org>2005-02-25 20:46:13 +0000
commitbbaa3c7792792d9899ed36d9b0db4703c617a7a3 (patch)
treef0d37ff02bafecbad300710532f6e847cb3d8756 /src/or/config.c
parentd21f007a8465b7c04d4ea8084501a588af4874a6 (diff)
downloadtor-bbaa3c7792792d9899ed36d9b0db4703c617a7a3.tar.gz
tor-bbaa3c7792792d9899ed36d9b0db4703c617a7a3.zip
Implement more control spec functionality
- Mapaddress - Postdescriptor - GetInfo on descriptors Required changes elsewhere: - Keep the most recent running_routers_t in the routerlist_t. That way we can learn about new routers and remember whether we were last told that they were up or down. Also enables more simplifications. - Keep the signed descriptor inside routerinfo_t. This makes descriptor_entry_t in dirservers.c unneeded. - Rename AddressMap (the verb) to MapAddress. Keep AddressMap as a noun. - Check addresses for plausibility before mapping them. svn:r3696
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/or/config.c b/src/or/config.c
index d55af562d6..4ae2476b86 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -123,7 +123,7 @@ static config_var_t config_vars[] = {
VAR("ExcludeNodes", STRING, ExcludeNodes, NULL),
VAR("TrackHostExits", CSV, TrackHostExits, NULL),
VAR("TrackHostExitsExpire",INTERVAL, TrackHostExitsExpire, "30 minutes"),
- VAR("AddressMap", LINELIST, AddressMap, NULL),
+ VAR("MapAddress", LINELIST, AddressMap, NULL),
VAR("FascistFirewall", BOOL, FascistFirewall, "0"),
VAR("FirewallPorts", CSV, FirewallPorts, "80,443"),
VAR("MyFamily", STRING, MyFamily, NULL),
@@ -1824,9 +1824,18 @@ config_register_addressmaps(or_options_t *options) {
if (smartlist_len(elts) >= 2) {
from = smartlist_get(elts,0);
to = smartlist_get(elts,1);
- addressmap_register(from, tor_strdup(to), 0);
+ if (!is_plausible_address(from)) {
+ log_fn(LOG_WARN,"Skipping invalid argument '%s' to MapAddress",from);
+ } else if (!is_plausible_address(to)) {
+ log_fn(LOG_WARN,"Skipping invalid argument '%s' to MapAddress",to);
+ } else {
+ addressmap_register(from, tor_strdup(to), 0);
+ if (smartlist_len(elts)>2) {
+ log_fn(LOG_WARN,"Ignoring extra arguments to MapAddress.");
+ }
+ }
} else {
- log_fn(LOG_WARN,"AddressMap '%s' has too few arguments. Ignoring.", opt->value);
+ log_fn(LOG_WARN,"MapAddress '%s' has too few arguments. Ignoring.", opt->value);
}
SMARTLIST_FOREACH(elts, char*, cp, tor_free(cp));
smartlist_clear(elts);