diff options
author | Justus Winter <[email protected]> | 2017-06-13 13:35:01 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-06-14 07:36:28 +0000 |
commit | 9b12b45aa5e67d4d422bf75a3879df1d52dbe67f (patch) | |
tree | db1933787e95085e1dd9457311106fe6f2d2a919 /g10/import.c | |
parent | gpg: Refactor key checking and fixing. (diff) | |
download | gnupg-9b12b45aa5e67d4d422bf75a3879df1d52dbe67f.tar.gz gnupg-9b12b45aa5e67d4d422bf75a3879df1d52dbe67f.zip |
gpg: Check and fix keys on import.
* doc/gpg.texi: Document the new import option.
* g10/gpg.c (main): Make the new option default to yes.
* g10/import.c (parse_import_options): Parse the new option.
(import_one): Act on the new option.
* g10/options.h (IMPORT_REPAIR_KEYS): New macro.
GnuPG-bug-id: 2236
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | g10/import.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/g10/import.c b/g10/import.c index d9d658b1c..491609d0a 100644 --- a/g10/import.c +++ b/g10/import.c @@ -40,6 +40,7 @@ #include "../common/membuf.h" #include "../common/init.h" #include "../common/mbox-util.h" +#include "key-check.h" struct import_stats_s @@ -179,6 +180,9 @@ parse_import_options(char *str,unsigned int *options,int noisy) N_("assume the GnuPG key backup format")}, {"import-restore", IMPORT_RESTORE, NULL, NULL}, + {"repair-keys", IMPORT_REPAIR_KEYS, NULL, + N_("repair keys on import")}, + /* Aliases for backward compatibility */ {"allow-local-sigs",IMPORT_LOCAL_SIGS,NULL,NULL}, {"repair-hkp-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG,NULL,NULL}, @@ -1482,6 +1486,9 @@ import_one (ctrl_t ctrl, log_info (_("key %s: PKS subkey corruption repaired\n"), keystr_from_pk(pk)); + if ((options & IMPORT_REPAIR_KEYS)) + key_check_all_keysigs (ctrl, keyblock, 0, 0); + if (chk_self_sigs (ctrl, keyblock, keyid, &non_self)) return 0; /* Invalid keyblock - error already printed. */ |