From 28c42fe029a2a6029b17cc35821d82ba2b9bf318 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 27 Jun 2012 23:55:01 -0400 Subject: [PATCH] Fix GETINFO address-mappings/... with wildcarded addresses. --- changes/bug6244_part2 | 4 ++++ src/or/connection_edge.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 changes/bug6244_part2 diff --git a/changes/bug6244_part2 b/changes/bug6244_part2 new file mode 100644 index 0000000000..ffeb5cd5b8 --- /dev/null +++ b/changes/bug6244_part2 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - When formatting wildcarded address mappings for the controller, + be sure to include "*." as appropriate. Partial fix for bug 6244; + bugfix on 0.2.3.9-alpha. diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 98920781a2..3c8b4bcc92 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1702,17 +1702,22 @@ addressmap_get_mappings(smartlist_t *sl, time_t min_expires, addressmap_ent_remove(key, val); continue; } else if (val->new_address) { + const char *src_wc = val->src_wildcard ? "*." : ""; + const char *dst_wc = val->dst_wildcard ? "*." : ""; if (want_expiry) { if (val->expires < 3 || val->expires == TIME_MAX) - smartlist_add_asprintf(sl, "%s %s NEVER", key, val->new_address); + smartlist_add_asprintf(sl, "%s%s %s%s NEVER", + src_wc, key, dst_wc, val->new_address); else { char time[ISO_TIME_LEN+1]; format_iso_time(time, val->expires); - smartlist_add_asprintf(sl, "%s %s \"%s\"", key, val->new_address, - time); + smartlist_add_asprintf(sl, "%s%s %s%s \"%s\"", + src_wc, key, dst_wc, val->new_address, + time); } } else { - smartlist_add_asprintf(sl, "%s %s", key, val->new_address); + smartlist_add_asprintf(sl, "%s%s %s%s", + src_wc, key, dst_wc, val->new_address); } } }