diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 21aaecef7..dec5c57d9 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -620,6 +620,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 464aeb76e..8dc39f12c 100644 --- a/dirmngr/dirmngr.h +++ b/dirmngr/dirmngr.h @@ -223,6 +223,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 65bc50fb4..c65e0633e 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. */ diff --git a/tools/gpgtar-create.c b/tools/gpgtar-create.c index ef9a29d15..80860befd 100644 --- a/tools/gpgtar-create.c +++ b/tools/gpgtar-create.c @@ -28,11 +28,11 @@ #include #include #include +#include #ifdef HAVE_W32_SYSTEM # define WIN32_LEAN_AND_MEAN # include #else /*!HAVE_W32_SYSTEM*/ -# include # include # include #endif /*!HAVE_W32_SYSTEM*/