diff options
author | Jérémy Bobbio <lunar@debian.org> | 2012-07-06 15:31:47 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-16 23:29:59 -0500 |
commit | aa01d0a18337787209241d08a630a2d8c10f29f0 (patch) | |
tree | 33695dc93cc13b0067713040265d15364473c7af /src/test/test.c | |
parent | b998431a33db2be0246f176ea0077b98d5258866 (diff) | |
download | tor-aa01d0a18337787209241d08a630a2d8c10f29f0.tar.gz tor-aa01d0a18337787209241d08a630a2d8c10f29f0.zip |
Implement proposal 204: ignore subdomains in hidden service addresses
The implementation is pretty straightforward: parse_extended_hostname() is
modified to drop any leading components from an address like
'foo.aaaaaaaaaaaaaaaa.onion'.
Diffstat (limited to 'src/test/test.c')
-rw-r--r-- | src/test/test.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test.c b/src/test/test.c index c219d984a8..e3e989b0c1 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -1412,11 +1412,20 @@ test_rend_fns(void) char address2[] = "aaaaaaaaaaaaaaaa.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"; test_assert(BAD_HOSTNAME == parse_extended_hostname(address1)); test_assert(ONION_HOSTNAME == parse_extended_hostname(address2)); + test_streq(address2, "aaaaaaaaaaaaaaaa"); test_assert(EXIT_HOSTNAME == parse_extended_hostname(address3)); test_assert(NORMAL_HOSTNAME == parse_extended_hostname(address4)); + test_assert(ONION_HOSTNAME == parse_extended_hostname(address5)); + test_streq(address5, "abcdefghijklmnop"); + test_assert(ONION_HOSTNAME == parse_extended_hostname(address6)); + test_streq(address6, "abcdefghijklmnop"); + test_assert(BAD_HOSTNAME == parse_extended_hostname(address7)); pk1 = pk_generate(0); pk2 = pk_generate(1); |