summaryrefslogtreecommitdiffstats
path: root/dirmngr/dns-stuff.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-01-03 12:03:28 +0100
committerWerner Koch <wk@gnupg.org>2017-01-03 12:43:33 +0100
commit969512401603639e4467ede7d892f1b02582c2c9 (patch)
tree0e720221d906ac82ade2dbc0831f5f9b9d0aa27a /dirmngr/dns-stuff.c
parentdirmngr: New debug message on correctly initialized libdns. (diff)
downloadgnupg2-969512401603639e4467ede7d892f1b02582c2c9.tar.xz
gnupg2-969512401603639e4467ede7d892f1b02582c2c9.zip
dirmngr: Make sure Tor mode is also set for DNS on SIGHUP.
* dirmngr/dns-stuff.c (enable_dns_tormode): Always succeed. (reload_dns_stuff): Reset tor port. * dirmngr/dirmngr.c (set_tor_mode): Also enable Tor mode for DNS. (main): Remove warning that Tor mode may not fully work. * dirmngr/server.c (cmd_dns_cert): Remove explicit Tor for DNS initialization. * dirmngr/t-dns-stuff.c (main): Remove option --new-circuit and error checking for enable_dns_tormode. -- This patch also resets the port on SIGHUP so that after starting Tor SIGHUP is sufficient to use Tor. Without the SIGHUP and when not using the Tor browser Dirmngr would keep on trying the Tor browser port. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'dirmngr/dns-stuff.c')
-rw-r--r--dirmngr/dns-stuff.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
index cf8cefb2e..e32e1e3e1 100644
--- a/dirmngr/dns-stuff.c
+++ b/dirmngr/dns-stuff.c
@@ -199,9 +199,9 @@ recursive_resolver_p (void)
}
-/* Sets the module in Tor mode. Returns 0 is this is possible or an
- error code. */
-gpg_error_t
+/* Puts this module eternally into Tor mode. When called agained with
+ * NEW_CIRCUIT request a new TOR circuit for the next DNS query. */
+void
enable_dns_tormode (int new_circuit)
{
if (!*tor_socks_user || new_circuit)
@@ -215,7 +215,6 @@ enable_dns_tormode (int new_circuit)
counter++;
}
tor_mode = 1;
- return 0;
}
@@ -548,7 +547,10 @@ reload_dns_stuff (int force)
libdns_reinit_pending = 0;
}
else
- libdns_reinit_pending = 1;
+ {
+ libdns_reinit_pending = 1;
+ libdns_tor_port = 0; /* Start again with the default port. */
+ }
#else
(void)force;
#endif