tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 1c8bafcdf9285e93bc2f41b85556b00183f2408a
parent 026f0c718410ec1f0f5f094943fbe5ceef1e632d
Author: Alexander Færøy <ahf@torproject.org>
Date:   Wed, 15 Jan 2020 17:22:47 +0000

Lowercase BridgeDistribution value before adding it to the descriptor.

This patch makes sure we lowercase the value of BridgeDistribution
before we add it to the descriptor as `bridge-distribution-request`.

See: https://bugs.torproject.org/32753

Diffstat:
Msrc/feature/relay/router.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c @@ -2908,14 +2908,21 @@ 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"); } + + // 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", escaped(bd)); + tor_free(bd); } if (router->onion_curve25519_pkey) {