aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <[email protected]>2018-06-11 22:33:26 +0000
committerDaniel Kahn Gillmor <[email protected]>2018-06-11 23:01:30 +0000
commite051c279216ecd4ec9a48e13ccc695f5ab667b2a (patch)
tree9174698f2e0c4d45ebd29a1e4a7fe9422f098a5e
parentdoc: Mention new command --show-keys in the 2.2.7 NEWS. (diff)
downloadgnupg-fix-T4017.tar.gz
gnupg-fix-T4017.zip
gpg: set full --dry-run when used with --show-keysfix-T4017
* g10/gpg.c (main): ensure that opt.dry_run matches opt.import_options[IMPORT_DRY_RUN]. -- It seems that the import_options IMPORT_DRY_RUN bit doesn't have the same power as the opt.dry_run bit itself. When one is set or cleared by command-line options or other option parsing, we should ensure that the other is also set or cleared. It would probably be cleaner to have just a single bit, stored in a single place, but that kind of overhaul is beyond the scope of this bugfix. GnuPG-Bug-id: 4017 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
-rw-r--r--g10/gpg.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index c117de375..4f4aae79c 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -2609,6 +2609,7 @@ main (int argc, char **argv)
set_cmd (&cmd, pargs.r_opt);
opt.import_options |= IMPORT_SHOW;
opt.import_options |= IMPORT_DRY_RUN;
+ opt.dry_run = 1;
opt.import_options &= ~IMPORT_REPAIR_KEYS;
opt.list_options |= LIST_SHOW_UNUSABLE_UIDS;
opt.list_options |= LIST_SHOW_UNUSABLE_SUBKEYS;
@@ -2647,7 +2648,10 @@ main (int argc, char **argv)
case oQuiet: opt.quiet = 1; break;
case oNoTTY: tty_no_terminal(1); break;
- case oDryRun: opt.dry_run = 1; break;
+ case oDryRun:
+ opt.dry_run = 1;
+ opt.import_options |= IMPORT_DRY_RUN;
+ break;
case oInteractive: opt.interactive = 1; break;
case oVerbose:
opt.verbose++;
@@ -3208,14 +3212,19 @@ main (int argc, char **argv)
}
break;
case oImportOptions:
- if(!parse_import_options(pargs.r.ret_str,&opt.import_options,1))
- {
- if(configname)
- log_error(_("%s:%d: invalid import options\n"),
- configname,configlineno);
- else
- log_error(_("invalid import options\n"));
- }
+ {
+ unsigned int old_import_options = opt.import_options;
+ if(!parse_import_options(pargs.r.ret_str,&opt.import_options,1))
+ {
+ if(configname)
+ log_error(_("%s:%d: invalid import options\n"),
+ configname,configlineno);
+ else
+ log_error(_("invalid import options\n"));
+ }
+ if ((old_import_options & IMPORT_DRY_RUN) != (opt.import_options & IMPORT_DRY_RUN))
+ opt.dry_run = !!(opt.import_options & IMPORT_DRY_RUN);
+ }
break;
case oImportFilter:
rc = parse_and_set_import_filter (pargs.r.ret_str);