aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-01-11 10:08:47 +0000
committerWerner Koch <[email protected]>2023-01-11 10:40:18 +0000
commitb58cf129f47a9f03af9cd48ce684c11a3b16d867 (patch)
treec4d83b3bad3e0421ddd404d72fa576fc02471157 /dirmngr/dirmngr.c
parentw32: Make sure DEP is enabled. (diff)
downloadgnupg-b58cf129f47a9f03af9cd48ce684c11a3b16d867.tar.gz
gnupg-b58cf129f47a9f03af9cd48ce684c11a3b16d867.zip
dirmngr: Cleanup of the no-Tor check with --gpgconf-* commands
* dirmngr/dirmngr.c (post_option_parsing): Add arg CMD. (main): Pass the current command. -- Updates-commit: 9f37e93dd741a5436ff412955628806ae84725ca
Diffstat (limited to 'dirmngr/dirmngr.c')
-rw-r--r--dirmngr/dirmngr.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 977e7dd04..cbc693bd8 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -886,7 +886,7 @@ parse_rereadable_options (gpgrt_argparse_t *pargs, int reread)
/* This function is called after option parsing to adjust some values
* and call option setup functions. */
static void
-post_option_parsing (void)
+post_option_parsing (enum cmd_and_opt_values cmd)
{
/* It would be too surpirsing if the quick timeout is larger than
* the standard value. */
@@ -894,6 +894,18 @@ post_option_parsing (void)
opt.connect_quick_timeout = opt.connect_timeout;
set_debug ();
+ /* For certain commands we do not want to set/test for Tor mode
+ * because that is somewhat expensive. */
+ switch (cmd)
+ {
+ case aGPGConfList:
+ case aGPGConfTest:
+ case aGPGConfVersions:
+ break;
+ default:
+ set_tor_mode ();
+ break;
+ }
}
@@ -1214,12 +1226,7 @@ main (int argc, char **argv)
log_printf ("\n");
}
- /* Note that we do not run set_tor_mode in --gpgconf-list mode
- * because it will attempt to connect to the tor client and that can
- * be time consuming. */
- post_option_parsing ();
- if (cmd != aGPGConfTest && cmd != aGPGConfList && cmd != aGPGConfVersions)
- set_tor_mode ();
+ post_option_parsing (cmd);
/* Get LDAP server list from file unless --ldapserver has been used. */
#if USE_LDAP
@@ -1965,7 +1972,7 @@ reread_configuration (void)
}
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
xfree (twopart);
- post_option_parsing ();
+ post_option_parsing (0);
finish:
/* Get a default log file from common.conf. */