From 4524a2a3714f263d56bb7db349c169b456994fd9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 26 Oct 2015 16:32:03 +0100 Subject: dirmngr: Support Tor hidden services. * dirmngr/dns-stuff.c (is_onion_address): New. * dirmngr/ks-engine-hkp.c (hostinfo_s): Add field "onion". (map_host): Special case onion addresses. (ks_hkp_print_hosttable): Print an 'O' for an onion address. * dirmngr/http.c (connect_server): Special case onion addresses. -- Note that this requires the latest libassuan from git. Onion addresses are always support regardless of the --use-tor flag. Signed-off-by: Werner Koch --- dirmngr/dns-stuff.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'dirmngr/dns-stuff.c') diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c index c80ee1dfa..21e5610a3 100644 --- a/dirmngr/dns-stuff.c +++ b/dirmngr/dns-stuff.c @@ -403,6 +403,20 @@ is_ip_address (const char *name) } +/* Return true if NAME is an onion address. */ +int +is_onion_address (const char *name) +{ + size_t len; + + len = name? strlen (name) : 0; + if (len < 8 || strcmp (name + len - 6, ".onion")) + return 0; + /* Note that we require at least 2 characters before the suffix. */ + return 1; /* Yes. */ +} + + #ifdef USE_ADNS /* Init ADNS and store the new state at R_STATE. Returns 0 on success; prints an error message and returns an error code on -- cgit v1.2.3