mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpg: New option --import-filter
* g10/gpg.c (oImportFilter): New. (opts): Add --import-filter. (main): Handle option. * g10/import.c: Include recsel.h, init.h, and mbox-util.h. (import_keep_uid): New global var. (cleanup_import_globals): New. (parse_and_set_import_filter): New. (filter_getval): New. (apply_keep_uid_filter): New. (import_one): Apply filter if set. -- Funny new option. It can for example be used to export a key with only one user id: gpg --no-options --import --import-options import-export \ --import-filter keep-uid='mbox=wk@gnupg.org' \ < full-key.pub > key-with-one-uid.pub More features will eventually be added. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
f015552374
commit
5137bf73cc
4 changed files with 182 additions and 1 deletions
|
@ -300,6 +300,7 @@ enum cmd_and_opt_values
|
|||
oKeyServer,
|
||||
oKeyServerOptions,
|
||||
oImportOptions,
|
||||
oImportFilter,
|
||||
oExportOptions,
|
||||
oListOptions,
|
||||
oVerifyOptions,
|
||||
|
@ -572,6 +573,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||
ARGPARSE_s_s (oKeyServer, "keyserver", "@"),
|
||||
ARGPARSE_s_s (oKeyServerOptions, "keyserver-options", "@"),
|
||||
ARGPARSE_s_s (oImportOptions, "import-options", "@"),
|
||||
ARGPARSE_s_s (oImportFilter, "import-filter", "@"),
|
||||
ARGPARSE_s_s (oExportOptions, "export-options", "@"),
|
||||
ARGPARSE_s_s (oListOptions, "list-options", "@"),
|
||||
ARGPARSE_s_s (oVerifyOptions, "verify-options", "@"),
|
||||
|
@ -2033,6 +2035,7 @@ parse_tofu_db_format (const char *db_format)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function called to initialized a new control object. It is
|
||||
assumed that this object has been zeroed out before calling this
|
||||
function. */
|
||||
|
@ -3031,6 +3034,11 @@ main (int argc, char **argv)
|
|||
log_error(_("invalid import options\n"));
|
||||
}
|
||||
break;
|
||||
case oImportFilter:
|
||||
rc = parse_and_set_import_filter (pargs.r.ret_str);
|
||||
if (rc)
|
||||
log_error (_("invalid filter option: %s\n"), gpg_strerror (rc));
|
||||
break;
|
||||
case oExportOptions:
|
||||
if(!parse_export_options(pargs.r.ret_str,&opt.export_options,1))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue