mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01: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:
parent
09c6f71351
commit
1e5959ec05
@ -233,7 +233,7 @@ read from STDIN. If only a one argument is given, it is expected to
|
|||||||
be a complete signature.
|
be a complete signature.
|
||||||
|
|
||||||
With more than 1 argument, the first should be a detached signature
|
With more than 1 argument, the first should be a detached signature
|
||||||
and the remaining files ake up the the signed data. To read the signed
|
and the remaining files make up the the signed data. To read the signed
|
||||||
data from STDIN, use @samp{-} as the second filename. For security
|
data from STDIN, use @samp{-} as the second filename. For security
|
||||||
reasons a detached signature cannot read the signed material from
|
reasons a detached signature cannot read the signed material from
|
||||||
STDIN without denoting it in the above way.
|
STDIN without denoting it in the above way.
|
||||||
@ -2180,6 +2180,11 @@ opposite meaning. The options are:
|
|||||||
subkey. Defaults to no for regular @option{--import} and to yes for
|
subkey. Defaults to no for regular @option{--import} and to yes for
|
||||||
keyserver @option{--recv-keys}.
|
keyserver @option{--recv-keys}.
|
||||||
|
|
||||||
|
@item import-show
|
||||||
|
Show a listing of the key as imported right before it is stored.
|
||||||
|
This can be combined with the option @option{--dry-run} to only look
|
||||||
|
at keys.
|
||||||
|
|
||||||
@item merge-only
|
@item merge-only
|
||||||
During import, allow key updates to existing keys, but do not allow
|
During import, allow key updates to existing keys, but do not allow
|
||||||
any new keys to be imported. Defaults to no.
|
any new keys to be imported. Defaults to no.
|
||||||
|
23
g10/import.c
23
g10/import.c
@ -112,6 +112,9 @@ parse_import_options(char *str,unsigned int *options,int noisy)
|
|||||||
{"fast-import",IMPORT_FAST,NULL,
|
{"fast-import",IMPORT_FAST,NULL,
|
||||||
N_("do not update the trustdb after import")},
|
N_("do not update the trustdb after import")},
|
||||||
|
|
||||||
|
{"import-show",IMPORT_SHOW,NULL,
|
||||||
|
N_("show key during import")},
|
||||||
|
|
||||||
{"merge-only",IMPORT_MERGE_ONLY,NULL,
|
{"merge-only",IMPORT_MERGE_ONLY,NULL,
|
||||||
N_("only accept updates to existing keys")},
|
N_("only accept updates to existing keys")},
|
||||||
|
|
||||||
@ -936,7 +939,7 @@ import_one (ctrl_t ctrl,
|
|||||||
import_screener_t screener, void *screener_arg)
|
import_screener_t screener, void *screener_arg)
|
||||||
{
|
{
|
||||||
PKT_public_key *pk;
|
PKT_public_key *pk;
|
||||||
PKT_public_key *pk_orig;
|
PKT_public_key *pk_orig = NULL;
|
||||||
kbnode_t node, uidnode;
|
kbnode_t node, uidnode;
|
||||||
kbnode_t keyblock_orig = NULL;
|
kbnode_t keyblock_orig = NULL;
|
||||||
byte fpr2[MAX_FINGERPRINT_LEN];
|
byte fpr2[MAX_FINGERPRINT_LEN];
|
||||||
@ -1050,6 +1053,22 @@ import_one (ctrl_t ctrl,
|
|||||||
return 0;
|
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 ? */
|
/* Do we have this key already in one of our pubrings ? */
|
||||||
pk_orig = xmalloc_clear( sizeof *pk_orig );
|
pk_orig = xmalloc_clear( sizeof *pk_orig );
|
||||||
rc = get_pubkey_byfprint_fast (pk_orig, fpr2, fpr2len);
|
rc = get_pubkey_byfprint_fast (pk_orig, fpr2, fpr2len);
|
||||||
@ -1258,7 +1277,7 @@ import_one (ctrl_t ctrl,
|
|||||||
keydb_release (hd); hd = NULL;
|
keydb_release (hd); hd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
if (mod_key || new_key || same_key)
|
if (mod_key || new_key || same_key)
|
||||||
{
|
{
|
||||||
/* A little explanation for this: we fill in the fingerprint
|
/* A little explanation for this: we fill in the fingerprint
|
||||||
|
@ -334,6 +334,7 @@ EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
|
|||||||
#define IMPORT_LOCAL_SIGS (1<<0)
|
#define IMPORT_LOCAL_SIGS (1<<0)
|
||||||
#define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1)
|
#define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1)
|
||||||
#define IMPORT_FAST (1<<2)
|
#define IMPORT_FAST (1<<2)
|
||||||
|
#define IMPORT_SHOW (1<<3)
|
||||||
#define IMPORT_MERGE_ONLY (1<<4)
|
#define IMPORT_MERGE_ONLY (1<<4)
|
||||||
#define IMPORT_MINIMAL (1<<5)
|
#define IMPORT_MINIMAL (1<<5)
|
||||||
#define IMPORT_CLEAN (1<<6)
|
#define IMPORT_CLEAN (1<<6)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user