aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/dns-stuff.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-10-26 15:32:03 +0000
committerWerner Koch <[email protected]>2015-10-26 15:34:19 +0000
commit4524a2a3714f263d56bb7db349c169b456994fd9 (patch)
tree42196995be5336dad31f93d87603124a83644a00 /dirmngr/dns-stuff.c
parentdirmngr,w32: Remove gethostbyname hack and make it build again. (diff)
downloadgnupg-4524a2a3714f263d56bb7db349c169b456994fd9.tar.gz
gnupg-4524a2a3714f263d56bb7db349c169b456994fd9.zip
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 <[email protected]>
Diffstat (limited to 'dirmngr/dns-stuff.c')
-rw-r--r--dirmngr/dns-stuff.c14
1 files changed, 14 insertions, 0 deletions
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