diff options
author | Werner Koch <[email protected]> | 2015-10-26 15:32:03 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-10-26 15:34:19 +0000 |
commit | 4524a2a3714f263d56bb7db349c169b456994fd9 (patch) | |
tree | 42196995be5336dad31f93d87603124a83644a00 /dirmngr/http.c | |
parent | dirmngr,w32: Remove gethostbyname hack and make it build again. (diff) | |
download | gnupg-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/http.c')
-rw-r--r-- | dirmngr/http.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/dirmngr/http.c b/dirmngr/http.c index 1a7c1ff17..9e2ba90f8 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -2212,6 +2212,32 @@ connect_server (const char *server, unsigned short port, init_sockets (); #endif /*Windows*/ + /* Onion addresses require special treatment. */ + if (is_onion_address (server)) + { +#ifdef ASSUAN_SOCK_TOR + + my_unprotect (); + sock = assuan_sock_connect_byname (server, port, 0, NULL, + ASSUAN_SOCK_TOR); + my_protect (); + + if (sock == ASSUAN_INVALID_FD) + { + if (errno == EHOSTUNREACH) + *r_host_not_found = 1; + log_error ("can't connect to '%s': %s\n", server, strerror (errno)); + } + return sock; + +#else /*!ASSUAN_SOCK_TOR*/ + + gpg_err_set_errno (ENETUNREACH); + return -1; /* Out of core. */ + +#endif /*!HASSUAN_SOCK_TOR*/ + } + #ifdef USE_DNS_SRV /* Do the SRV thing */ if (srvtag) |