diff options
author | George Kadianakis <desnacked@riseup.net> | 2021-05-05 11:05:09 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2021-05-05 11:05:45 +0300 |
commit | f230beadf469e300c783791847a346c593033dd0 (patch) | |
tree | 61347ac86393d40795eed3b1b89878097c416399 /src/test | |
parent | cf6e72b7020c47ba20677dc19602663723bd8491 (diff) | |
download | tor-f230beadf469e300c783791847a346c593033dd0.tar.gz tor-f230beadf469e300c783791847a346c593033dd0.zip |
Prepare for #40373: Re-introduce parsing for v2 onion addresses.
Welcome back ONION_V2_HOSTNAME! :)
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_hs_common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c index 08e0b9b703..7cb6a36f8e 100644 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@ -789,6 +789,8 @@ test_parse_extended_hostname(void *arg) char address1[] = "fooaddress.onion"; char address3[] = "fooaddress.exit"; char address4[] = "www.torproject.org"; + char address5[] = "foo.abcdefghijklmnop.onion"; + char address6[] = "foo.bar.abcdefghijklmnop.onion"; char address7[] = ".abcdefghijklmnop.onion"; char address8[] = "www.25njqamcweflpvkl73j4szahhihoc4xt3ktcgjnpaingr5yhkenl5sid.onion"; @@ -806,6 +808,14 @@ test_parse_extended_hostname(void *arg) tt_assert(parse_extended_hostname(address4, &type)); tt_int_op(type, OP_EQ, NORMAL_HOSTNAME); + tt_assert(parse_extended_hostname(address5, &type)); + tt_int_op(type, OP_EQ, ONION_V2_HOSTNAME); + tt_str_op(address5, OP_EQ, "abcdefghijklmnop"); + + tt_assert(parse_extended_hostname(address6, &type)); + tt_int_op(type, OP_EQ, ONION_V2_HOSTNAME); + tt_str_op(address6, OP_EQ, "abcdefghijklmnop"); + tt_assert(!parse_extended_hostname(address7, &type)); tt_int_op(type, OP_EQ, BAD_HOSTNAME); |