summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-02-12 12:21:57 +1000
committerteor <teor@torproject.org>2020-02-12 12:21:57 +1000
commit5298113da98f13cfaad4a9ab7b5ac8baa6c37279 (patch)
treea85d0e8f6be3c4195f538592718d7c7ef5e2b612
parent0ff3e8f4a0fd5b661e999c0a81ceb1c55e7456c6 (diff)
parentb9c7c61ea5233854ff83257a8bc530b7e0a50351 (diff)
downloadtor-5298113da98f13cfaad4a9ab7b5ac8baa6c37279.tar.gz
tor-5298113da98f13cfaad4a9ab7b5ac8baa6c37279.zip
Merge branch 'maint-0.3.5' into maint-0.4.1
-rw-r--r--.travis.yml2
-rw-r--r--changes/bug327533
-rw-r--r--changes/ticket330754
-rw-r--r--src/app/config/config.c2
-rw-r--r--src/feature/relay/router.c15
-rw-r--r--src/test/test_config.c22
6 files changed, 37 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml
index 375796799b..6cfc4e51fd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -93,8 +93,6 @@ matrix:
os: osx
- env: CHUTNEY="yes" CHUTNEY_ALLOW_FAILURES="2" SKIP_MAKE_CHECK="yes"
os: osx
- ## test-stem sometimes hangs on Travis
- - env: TEST_STEM="yes" SKIP_MAKE_CHECK="yes"
## (Linux only) Use a recent Linux image (Ubuntu Bionic)
dist: bionic
diff --git a/changes/bug32753 b/changes/bug32753
new file mode 100644
index 0000000000..6f59c7729d
--- /dev/null
+++ b/changes/bug32753
@@ -0,0 +1,3 @@
+ o Minor bugfixes (bridges):
+ - Lowercase the value of BridgeDistribution from torrc before adding it to
+ the descriptor. Fixes bug 32753; bugfix on 0.3.2.3-alpha.
diff --git a/changes/ticket33075 b/changes/ticket33075
new file mode 100644
index 0000000000..69698d90b3
--- /dev/null
+++ b/changes/ticket33075
@@ -0,0 +1,4 @@
+ o Testing:
+ - Stop allowing failures on the Travis CI stem tests job. It looks like all
+ the stem hangs we were seeing are now fixed, but let's make sure we see
+ them if they happen again. Closes ticket 33075.
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 8ccbac159a..3ab0f3b129 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -6840,7 +6840,7 @@ check_bridge_distribution_setting(const char *bd)
};
unsigned i;
for (i = 0; i < ARRAY_LENGTH(RECOGNIZED); ++i) {
- if (!strcmp(bd, RECOGNIZED[i]))
+ if (!strcasecmp(bd, RECOGNIZED[i]))
return 0;
}
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 29a8ffaa39..2b28bd229c 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2911,15 +2911,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) {
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 85216f4a40..3d49086713 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -5621,11 +5621,27 @@ test_config_check_bridge_distribution_setting_not_a_bridge(void *arg)
static void
test_config_check_bridge_distribution_setting_valid(void *arg)
{
- int ret = check_bridge_distribution_setting("https");
-
(void)arg;
- tt_int_op(ret, OP_EQ, 0);
+ // Check all the possible values we support right now.
+ tt_int_op(check_bridge_distribution_setting("none"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("any"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("https"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("email"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("moat"), OP_EQ, 0);
+
+ // Check all the possible values we support right now with weird casing.
+ tt_int_op(check_bridge_distribution_setting("NoNe"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("anY"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("hTTps"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("emAIl"), OP_EQ, 0);
+ tt_int_op(check_bridge_distribution_setting("moAt"), OP_EQ, 0);
+
+ // Invalid values.
+ tt_int_op(check_bridge_distribution_setting("x\rx"), OP_EQ, -1);
+ tt_int_op(check_bridge_distribution_setting("x\nx"), OP_EQ, -1);
+ tt_int_op(check_bridge_distribution_setting("\t\t\t"), OP_EQ, -1);
+
done:
return;
}