diff options
author | Werner Koch <wk@gnupg.org> | 2024-01-24 18:23:02 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2024-01-24 18:26:01 +0100 |
commit | d4976e35d2ca431b2a651aa11be8a4589c8dd39a (patch) | |
tree | 7b0e4d8566d734a274d13f006647c0f32c1ce32c /g10/import.c | |
parent | po: Update German translation. (diff) | |
download | gnupg2-d4976e35d2ca431b2a651aa11be8a4589c8dd39a.tar.xz gnupg2-d4976e35d2ca431b2a651aa11be8a4589c8dd39a.zip |
gpg: Add sub-option ignore-attributes to --import-options.
* g10/options.h (IMPORT_IGNORE_ATTRIBUTES): New.
* g10/import.c (parse_import_options): Add new sub-option.
(read_block): Implement sub-option.
--
Suggested-by: Robin H. Johnson
Tested using the import-export feature:
gpg --export KEY_WITH_PICTURE \
| gpg --import --import-options import-export,ignore-attributes \
| gpg --show-key
Diffstat (limited to 'g10/import.c')
-rw-r--r-- | g10/import.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/g10/import.c b/g10/import.c index c1e76c3f0..8f874a7d1 100644 --- a/g10/import.c +++ b/g10/import.c @@ -209,6 +209,9 @@ parse_import_options(char *str,unsigned int *options,int noisy) {"repair-keys", IMPORT_REPAIR_KEYS, NULL, N_("repair keys on import")}, + /* New options. Right now, without description string. */ + {"ignore-attributes", IMPORT_IGNORE_ATTRIBUTES, NULL, NULL}, + /* Hidden options which are enabled by default and are provided * in case of problems with the respective implementation. */ {"collapse-uids", IMPORT_COLLAPSE_UIDS, NULL, NULL}, @@ -1008,6 +1011,15 @@ read_block( IOBUF a, unsigned int options, init_packet(pkt); continue; } + else if ((opt.import_options & IMPORT_IGNORE_ATTRIBUTES) + && (pkt->pkttype == PKT_USER_ID || pkt->pkttype == PKT_ATTRIBUTE) + && pkt->pkt.user_id->attrib_data) + { + skip_sigs = 1; + free_packet (pkt, &parsectx); + init_packet (pkt); + continue; + } if (skip_sigs) { |