aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-07-26 08:58:15 +0000
committerWerner Koch <[email protected]>2017-07-26 08:58:15 +0000
commitfd68bdb61ec4f8441da6d3023a8da4315df54cec (patch)
treef832e63f5887ea1e380989857315dfb152fbac0c
parentagent,dirmngr: Check for homedir removal also using stat(2). (diff)
downloadgnupg-fd68bdb61ec4f8441da6d3023a8da4315df54cec.tar.gz
gnupg-fd68bdb61ec4f8441da6d3023a8da4315df54cec.zip
dirmngr: Auto-enable Tor on startup or reload.
* dirmngr/dirmngr.c (dirmngr_use_tor): Test for Tor availibility. -- GnuPG-bug-id: 2935 Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--dirmngr/dirmngr.c12
-rw-r--r--dirmngr/server.c4
-rw-r--r--doc/dirmngr.texi12
3 files changed, 22 insertions, 6 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 1ddc568a0..0d133c61b 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -532,7 +532,17 @@ dirmngr_use_tor (void)
{
if (tor_mode == TOR_MODE_AUTO)
{
- /* FIXME: Figure out whether Tor is running. */
+ /* Figure out whether Tor is running. */
+ assuan_fd_t sock;
+
+ sock = assuan_sock_connect_byname (NULL, 0, 0, NULL, ASSUAN_SOCK_TOR);
+ if (sock == ASSUAN_INVALID_FD)
+ tor_mode = TOR_MODE_NO;
+ else
+ {
+ tor_mode = TOR_MODE_YES;
+ assuan_sock_close (sock);
+ }
}
if (tor_mode == TOR_MODE_FORCE)
diff --git a/dirmngr/server.c b/dirmngr/server.c
index 4f5a3b218..7ed6cde15 100644
--- a/dirmngr/server.c
+++ b/dirmngr/server.c
@@ -308,8 +308,8 @@ strcpy_escaped_plus (char *d, const unsigned char *s)
}
-/* This function returns true if a Tor server is running. The sattus
- is cached for the current connection. */
+/* This function returns true if a Tor server is running. The status
+ * is cached for the current connection. */
static int
is_tor_running (ctrl_t ctrl)
{
diff --git a/doc/dirmngr.texi b/doc/dirmngr.texi
index 64b24f9f7..eef78a8b7 100644
--- a/doc/dirmngr.texi
+++ b/doc/dirmngr.texi
@@ -243,10 +243,16 @@ Enabling this option forces loading of expired CRLs; this is only
useful for debugging.
@item --use-tor
+@itemx --no-use-tor
@opindex use-tor
-This option switches Dirmngr and thus GnuPG into ``Tor mode'' to route
-all network access via Tor (an anonymity network). Certain other
-features are disabled if this mode is active.
+@opindex no-use-tor
+The option @option{--use-tor} switches Dirmngr and thus GnuPG into
+``Tor mode'' to route all network access via Tor (an anonymity
+network). Certain other features are disabled in this mode. The
+effect of @option{--use-tor} cannot be overridden by any other command
+or even be reloading gpg-agent. The use of @option{--no-use-tor}
+disables the use of Tor. The default is to use Tor if it is available
+on startup or after reloading dirmngr.
@item --standard-resolver
@opindex standard-resolver