hs-v3: Set extended error if .onion is invalid
commit80f241907c1b3d69784de98e9ff3f96d5c37f51b
authorDavid Goulet <dgoulet@torproject.org>
Thu, 17 Oct 2019 19:15:14 +0000 (17 15:15 -0400)
committerGeorge Kadianakis <desnacked@riseup.net>
Mon, 18 Nov 2019 17:06:43 +0000 (18 19:06 +0200)
treee165da05d409107a983beabc188395417092897b
parent542402cd60bc6b26f43c399b238602a1f3c18d85
hs-v3: Set extended error if .onion is invalid

In order to achieve this, the parse_extended_hostname() had to be refactored
to return either success or failure and setting the hostname type in the given
parameter.

The reason for that is so it can detect invalid onion addresses that is having
a ".onion", the right length but just not passing validation.

That way, we can send back the prop304 ExtendedError "X'F1' Onion Service
Descriptor Is Invalid" to notify the SOCKS connection of the invalid onion
address.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/core/or/connection_edge.c
src/core/or/connection_edge.h
src/test/test_hs_common.c