aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr
diff options
context:
space:
mode:
Diffstat (limited to 'dirmngr')
-rw-r--r--dirmngr/dirmngr.c9
-rw-r--r--dirmngr/dirmngr.h1
-rw-r--r--dirmngr/server.c4
3 files changed, 12 insertions, 2 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 15f3bd30f..b24c8b83e 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -621,6 +621,15 @@ dirmngr_use_tor (void)
}
+/* This is somewhat similar to dirmngr_use_tor but avoids a trial
+ * connect and may thus be faster for this special case. */
+int
+dirmngr_never_use_tor_p (void)
+{
+ return tor_mode == TOR_MODE_NEVER;
+}
+
+
static void
wrong_args (const char *text)
{
diff --git a/dirmngr/dirmngr.h b/dirmngr/dirmngr.h
index 69d8270b5..159fab4ad 100644
--- a/dirmngr/dirmngr.h
+++ b/dirmngr/dirmngr.h
@@ -224,6 +224,7 @@ void dirmngr_deinit_default_ctrl (ctrl_t ctrl);
void dirmngr_sighup_action (void);
const char* dirmngr_get_current_socket_name (void);
int dirmngr_use_tor (void);
+int dirmngr_never_use_tor_p (void);
/*-- Various housekeeping functions. --*/
void ks_hkp_housekeeping (time_t curtime);
diff --git a/dirmngr/server.c b/dirmngr/server.c
index 4d2bd4c73..7b7a087dd 100644
--- a/dirmngr/server.c
+++ b/dirmngr/server.c
@@ -2276,7 +2276,7 @@ ensure_keyserver (ctrl_t ctrl)
{
/* If there is just one onion and one plain keyserver given, we take
only one depending on whether Tor is running or not. */
- if (is_tor_running (ctrl))
+ if (!dirmngr_never_use_tor_p () && is_tor_running (ctrl))
{
ctrl->server_local->keyservers = onion_items;
onion_items = NULL;
@@ -2287,7 +2287,7 @@ ensure_keyserver (ctrl_t ctrl)
plain_items = NULL;
}
}
- else if (!is_tor_running (ctrl))
+ else if (dirmngr_never_use_tor_p () || !is_tor_running (ctrl))
{
/* Tor is not running. It does not make sense to add Onion
addresses. */