summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2020-01-15 17:18:30 +0000
committerteor <teor@torproject.org>2020-02-12 12:21:41 +1000
commitb9c7c61ea5233854ff83257a8bc530b7e0a50351 (patch)
tree08a2cbfc19ae22f6cad29b06f652405112d880e5 /src/feature
parent88723ad1694a96bdbb713ccb5bb47a9f5acdc8bd (diff)
downloadtor-b9c7c61ea5233854ff83257a8bc530b7e0a50351.tar.gz
tor-b9c7c61ea5233854ff83257a8bc530b7e0a50351.zip
Lowercase the BridgeDistribution value from torrc in descriptors.
This patch ensures that we always lowercase the BridgeDistribution from torrc in descriptors before submitting it. See: https://bugs.torproject.org/32753
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/relay/router.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 1dbaf2ed66..e91550a78c 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2635,15 +2635,20 @@ router_dump_router_to_string(routerinfo_t *router,
}
if (options->BridgeRelay) {
- const char *bd;
+ char *bd = NULL;
+
if (options->BridgeDistribution && strlen(options->BridgeDistribution)) {
- bd = options->BridgeDistribution;
+ bd = tor_strdup(options->BridgeDistribution);
} else {
- bd = "any";
+ bd = tor_strdup("any");
}
- if (strchr(bd, '\n') || strchr(bd, '\r'))
- bd = escaped(bd);
+
+ // Make sure our value is lowercased in the descriptor instead of just
+ // forwarding what the user wrote in their torrc directly.
+ tor_strlower(bd);
+
smartlist_add_asprintf(chunks, "bridge-distribution-request %s\n", bd);
+ tor_free(bd);
}
if (router->onion_curve25519_pkey) {