1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpg: New import option "import-show".

* g10/options.h (IMPORT_SHOW): New.
* g10/import.c (parse_import_options): Add "import-show".
(import_one): Implement that.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-06-23 19:25:53 +02:00
parent 09c6f71351
commit 1e5959ec05
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 28 additions and 3 deletions

View file

@ -112,6 +112,9 @@ parse_import_options(char *str,unsigned int *options,int noisy)
{"fast-import",IMPORT_FAST,NULL,
N_("do not update the trustdb after import")},
{"import-show",IMPORT_SHOW,NULL,
N_("show key during import")},
{"merge-only",IMPORT_MERGE_ONLY,NULL,
N_("only accept updates to existing keys")},
@ -936,7 +939,7 @@ import_one (ctrl_t ctrl,
import_screener_t screener, void *screener_arg)
{
PKT_public_key *pk;
PKT_public_key *pk_orig;
PKT_public_key *pk_orig = NULL;
kbnode_t node, uidnode;
kbnode_t keyblock_orig = NULL;
byte fpr2[MAX_FINGERPRINT_LEN];
@ -1050,6 +1053,22 @@ import_one (ctrl_t ctrl,
return 0;
}
/* Get rid of deleted nodes. */
commit_kbnode (&keyblock);
/* Show the key in the form it is merged or inserted. */
if ((options & IMPORT_SHOW))
{
merge_keys_and_selfsig (keyblock);
/* Note that we do not want to show the validity because the key
* has not yet imported. */
list_keyblock_direct (ctrl, keyblock, 0, 0, 1, 1);
es_fflush (es_stdout);
}
if (opt.dry_run)
goto leave;
/* Do we have this key already in one of our pubrings ? */
pk_orig = xmalloc_clear( sizeof *pk_orig );
rc = get_pubkey_byfprint_fast (pk_orig, fpr2, fpr2len);
@ -1258,7 +1277,7 @@ import_one (ctrl_t ctrl,
keydb_release (hd); hd = NULL;
}
leave:
leave:
if (mod_key || new_key || same_key)
{
/* A little explanation for this: we fill in the fingerprint

View file

@ -334,6 +334,7 @@ EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
#define IMPORT_LOCAL_SIGS (1<<0)
#define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1)
#define IMPORT_FAST (1<<2)
#define IMPORT_SHOW (1<<3)
#define IMPORT_MERGE_ONLY (1<<4)
#define IMPORT_MINIMAL (1<<5)
#define IMPORT_CLEAN (1<<6)