]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Test TLD validation
authorrl1987 <rl1987@sdf.lonestar.org>
Mon, 12 Feb 2018 21:20:45 +0000 (22:20 +0100)
committerNick Mathewson <nickm@torproject.org>
Wed, 28 Mar 2018 11:39:03 +0000 (07:39 -0400)
src/test/test_util.c

index 2fa03e5bc76be9b2e22506adf89cc0a6b5795e88..db2ea1a348b25616ef10f68fbd489f6256440328 100644 (file)
@@ -5589,6 +5589,12 @@ test_util_hostname_validation(void *arg)
   tt_assert(!string_is_valid_hostname("[2a00:1450:401b:800::200e]"));
   tt_assert(!string_is_valid_hostname("2a00:1450:401b:800::200e"));
 
+  // Last label of a hostname is required to be alphabetic according to
+  // RFC 1123 Section 2.1.
+  tt_assert(!string_is_valid_hostname("lucky.13"));
+  tt_assert(!string_is_valid_hostname("luck.y13"));
+  tt_assert(!string_is_valid_hostname("luck.y13."));
+
   done:
   return;
 }