summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-08-15 17:59:30 -0400
committerNick Mathewson <nickm@torproject.org>2012-08-15 17:59:30 -0400
commit2ba52f409546961a0a950978a875b22bcb6bfaff (patch)
tree97ab77475c0792166e4ebd586fd081dade0d26bc
parent959f850056f5f6a7ebbe7ec0e56da239e4f7de3e (diff)
downloadtor-2ba52f409546961a0a950978a875b22bcb6bfaff.tar.gz
tor-2ba52f409546961a0a950978a875b22bcb6bfaff.zip
Fix wildcarded address mappings from the control port
Apparently, we weren't actually detecting wildcardedness when parsing them: whoops! bug 6244. Bugfix on 0.2.3.9-alpha
-rw-r--r--changes/bug6244_part_c6
-rw-r--r--src/or/control.c15
2 files changed, 18 insertions, 3 deletions
diff --git a/changes/bug6244_part_c b/changes/bug6244_part_c
new file mode 100644
index 0000000000..dea6e7b69e
--- /dev/null
+++ b/changes/bug6244_part_c
@@ -0,0 +1,6 @@
+ o Major bugfixes (controller):
+ - Make wildcarded addresses (that is, ones beginning with *.) work when
+ provided via the controller's MapAddress command. Previously, they
+ were accepted, but we never actually noticed that they were wildcards.
+ Fix for bug 6244; bugfix on 0.2.3.9-alpha.
+
diff --git a/src/or/control.c b/src/or/control.c
index ce571f99f3..913d18a7fc 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1366,9 +1366,18 @@ handle_control_mapaddress(control_connection_t *conn, uint32_t len,
smartlist_add_asprintf(reply, "250-%s=%s", address, to);
}
} else {
- addressmap_register(from, tor_strdup(to), 1,
- ADDRMAPSRC_CONTROLLER, 0, 0);
- smartlist_add_asprintf(reply, "250-%s", line);
+ const char *msg;
+ if (addressmap_register_auto(from, to, 1,
+ ADDRMAPSRC_CONTROLLER, &msg) < 0) {
+ smartlist_add_asprintf(reply,
+ "512-syntax error: invalid address mapping "
+ " '%s': %s", line, msg);
+ log_warn(LD_CONTROL,
+ "Skipping invalid argument '%s' in MapAddress msg: %s",
+ line, msg);
+ } else {
+ smartlist_add_asprintf(reply, "250-%s", line);
+ }
}
} else {
smartlist_add_asprintf(reply, "512-syntax error: mapping '%s' is "