diff options
author | Werner Koch <[email protected]> | 2022-08-22 10:01:55 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2022-08-22 10:05:02 +0000 |
commit | 203dcc19eb48228c60036691fe87fb37e29369a4 (patch) | |
tree | 03944832ea477df71ad14ed535926355d2e0b43a /tools/gpg-card.c | |
parent | dirmngr: Fix NTBTLS include for test (diff) | |
download | gnupg-203dcc19eb48228c60036691fe87fb37e29369a4.tar.gz gnupg-203dcc19eb48228c60036691fe87fb37e29369a4.zip |
common: New common option no-autostart.
* common/comopt.c (opts): Add "no-autostart".
(parse_comopt): Set it.
* common/comopt.h (comopt): Add no_autostart.
* g10/gpg.c (main): Take care of the new option.
* sm/gpgsm.c (main): Ditto.
* tools/gpg-connect-agent.c (INCLUDED_BY_MAIN_MODULE): Add.
(main): Parse common options and handle new option.
* tools/gpg-card.c (main): Ditto.
(cmd_yubikey): Fix minor error reporting issue.
* common/util.h (GNUPG_MODULE_NAME_CARD): New const.
* common/homedir.c (gnupg_module_name): Support it.
--
Having a global option makes it easier to use disable autostart on a
server which is required to use a remote gpg-agent reliable.
Diffstat (limited to 'tools/gpg-card.c')
-rw-r--r-- | tools/gpg-card.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/gpg-card.c b/tools/gpg-card.c index 9c83f556c..1ccace478 100644 --- a/tools/gpg-card.c +++ b/tools/gpg-card.c @@ -43,6 +43,7 @@ #include "../common/server-help.h" #include "../common/openpgpdefs.h" #include "../common/tlv.h" +#include "../common/comopt.h" #include "gpg-card.h" @@ -292,6 +293,17 @@ main (int argc, char **argv) if (log_get_errorcount (0)) exit (2); + /* Process common component options. */ + if (parse_comopt (GNUPG_MODULE_NAME_CARD, opt.debug)) + { + gnupg_status_printf (STATUS_FAILURE, "option-parser %u", + gpg_error (GPG_ERR_GENERAL)); + exit(2); + } + + if (comopt.no_autostart) + opt.autostart = 0; + /* Set defaults for non given options. */ if (!opt.gpg_program) opt.gpg_program = gnupg_module_name (GNUPG_MODULE_NAME_GPG); @@ -3505,7 +3517,7 @@ cmd_yubikey (card_info_t info, char *argstr) err = yubikey_commands (info, fp, nwords, words); err2 = scd_learn (info, 0); if (err2) - log_error ("Error re-reading card: %s\n", gpg_strerror (err)); + log_error ("Error re-reading card: %s\n", gpg_strerror (err2)); leave: return err; |