diff options
author | Werner Koch <[email protected]> | 2016-07-01 14:24:04 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-07-01 14:28:29 +0000 |
commit | 5137bf73ccc98a72c2eeac148e4d4b5d58f0a854 (patch) | |
tree | 1649345e632dcc2198b1ee96dafe80c019554b4c /g10/gpg.c | |
parent | gpg: Allow to cache the mbox in a user id struct. (diff) | |
download | gnupg-5137bf73ccc98a72c2eeac148e4d4b5d58f0a854.tar.gz gnupg-5137bf73ccc98a72c2eeac148e4d4b5d58f0a854.zip |
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='[email protected]' \
< full-key.pub > key-with-one-uid.pub
More features will eventually be added.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/gpg.c')
-rw-r--r-- | g10/gpg.c | 8 |
1 files changed, 8 insertions, 0 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)) { |