diff options
author | Werner Koch <[email protected]> | 2021-04-19 09:33:19 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2021-04-19 09:33:19 +0000 |
commit | d13c5bc244ce1daed285424d920171fc2bcd7290 (patch) | |
tree | 510074df1671ad043855a00c347ea922a937c093 /sm/gpgsm.c | |
parent | gpg: Lookup a missing public key of the current card via LDAP. (diff) | |
download | gnupg-d13c5bc244ce1daed285424d920171fc2bcd7290.tar.gz gnupg-d13c5bc244ce1daed285424d920171fc2bcd7290.zip |
gpg,gpgsm: Move use-keyboxd to the new conf file common.conf
* common/comopt.c, common/comopt.h: New.
* common/Makefile.am: Add them.
* g10/gpg.c: Include comopt.h.
(main): Also parse common.conf.
* sm/gpgsm.c: Include comopt.h.
(main): Set a flag for the --no-logfile option. Parse common.conf.
* tools/gpgconf-comp.c (known_options_gpg): Remove "use-keyboxd", add
pseudo option "use_keyboxd".
(known_pseudo_options_gpg): Add pseudo option "use_keyboxd".
(known_options_gpgsm): Remove "use-keyboxd".
* tests/openpgp/defs.scm (create-gpghome): Create common.conf.
* doc/examples/common.conf: New.
--
Note that --use-keybox still works but prints a warning. We will
eventually remove this option becuase it was marked as an experimental
feature anyway.
It would be too confusing if gpg and gpgsm use different key storages.
Further, other components (e.g. dirmngr or gpg-wks-client) which call
gpg or gpgsm need to be aware that the keyboxd is used and pass that
option on the command line. Now that common.conf is always read (even
if --no-options is used) those tools will work instantly.
Diffstat (limited to 'sm/gpgsm.c')
-rw-r--r-- | sm/gpgsm.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/sm/gpgsm.c b/sm/gpgsm.c index fd59fc7c7..e292aa160 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1,7 +1,7 @@ /* gpgsm.c - GnuPG for S/MIME * Copyright (C) 2001-2020 Free Software Foundation, Inc. * Copyright (C) 2001-2019 Werner Koch - * Copyright (C) 2015-2020 g10 Code GmbH + * Copyright (C) 2015-2021 g10 Code GmbH * * This file is part of GnuPG. * @@ -47,6 +47,7 @@ #include "../common/asshelp.h" #include "../common/init.h" #include "../common/compliance.h" +#include "../common/comopt.h" #include "minip12.h" #ifndef O_BINARY @@ -1005,6 +1006,7 @@ main ( int argc, char **argv) estream_t htmlauditfp = NULL; struct assuan_malloc_hooks malloc_hooks; int pwfd = -1; + int no_logfile = 0; static const char *homedirvalue; static const char *changeuser; @@ -1354,7 +1356,7 @@ main ( int argc, char **argv) break; case oLogFile: logfile = pargs.r.ret_str; break; - case oNoLogFile: logfile = NULL; break; + case oNoLogFile: logfile = NULL; no_logfile = 1; break; case oAuditLog: auditlog = pargs.r.ret_str; break; case oHtmlAuditLog: htmlauditlog = pargs.r.ret_str; break; @@ -1613,6 +1615,34 @@ main ( int argc, char **argv) gpgsm_exit(2); } + /* Process common component options. */ + if (parse_comopt (GNUPG_MODULE_NAME_GPGSM, debug_argparser)) + { + gpgsm_status_with_error (&ctrl, STATUS_FAILURE, + "option-parser", gpg_error (GPG_ERR_GENERAL)); + gpgsm_exit(2); + } + + if (!logfile && !no_logfile) + { + logfile = comopt.logfile; + comopt.logfile = NULL; + } + + if (opt.use_keyboxd) + log_info ("Note: Please move option \"%s\" to \"common.conf\"\n", + "use-keyboxd"); + opt.use_keyboxd = comopt.use_keyboxd; /* Override. */ + + if (opt.keyboxd_program) + log_info ("Note: Please move option \"%s\" to \"common.conf\"\n", + "keyboxd-program"); + if (!opt.keyboxd_program && comopt.keyboxd_program) + { + opt.keyboxd_program = comopt.keyboxd_program; + comopt.keyboxd_program = NULL; + } + if (pwfd != -1) /* Read the passphrase now. */ read_passphrase_from_fd (pwfd); |