diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-07-23 12:42:33 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-07-23 12:42:33 -0400 |
commit | df12ff3deaa7ad4a5eb2098f4ed9d12ee4084d6d (patch) | |
tree | 17662565947ebd8706e1c41fd775f396f418d6c1 /src/test/test_hs_intropoint.c | |
parent | f14ce4bce6cb1772ce4dbba79acbed27b3a40b31 (diff) | |
download | tor-df12ff3deaa7ad4a5eb2098f4ed9d12ee4084d6d.tar.gz tor-df12ff3deaa7ad4a5eb2098f4ed9d12ee4084d6d.zip |
Add a test for disallowing single-hop introductions.
Code from dgoulet.
Diffstat (limited to 'src/test/test_hs_intropoint.c')
-rw-r--r-- | src/test/test_hs_intropoint.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/test/test_hs_intropoint.c b/src/test/test_hs_intropoint.c index 732836fb5b..0cdb1fef27 100644 --- a/src/test/test_hs_intropoint.c +++ b/src/test/test_hs_intropoint.c @@ -16,6 +16,7 @@ #include "lib/crypt_ops/crypto_rand.h" #include "core/or/or.h" +#include "core/or/channel.h" #include "core/or/circuitlist.h" #include "core/or/circuituse.h" #include "ht.h" @@ -693,6 +694,17 @@ test_introduce1_suitable_circuit(void *arg) tt_int_op(ret, OP_EQ, 0); } + /* Single hop circuit should not be allowed. */ + { + circ = or_circuit_new(0, NULL); + circ->p_chan = tor_malloc_zero(sizeof(channel_t)); + circ->p_chan->is_client = 1; + ret = circuit_is_suitable_for_introduce1(circ); + tor_free(circ->p_chan); + circuit_free_(TO_CIRCUIT(circ)); + tt_int_op(ret, OP_EQ, 0); + } + done: ; } @@ -927,4 +939,3 @@ struct testcase_t hs_intropoint_tests[] = { END_OF_TESTCASES }; - |