summaryrefslogtreecommitdiffstats
path: root/g10/gpg.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2015-12-22 14:21:18 +0100
committerNeal H. Walfield <neal@g10code.com>2015-12-22 15:03:54 +0100
commitdc52995d85048ed12ae8b9f330e9ca41a4030aae (patch)
tree3c22fc598e33f3038f360f2752e6dd948c0e3b9d /g10/gpg.c
parentgpg: Remove unused parameter. (diff)
downloadgnupg2-dc52995d85048ed12ae8b9f330e9ca41a4030aae.tar.xz
gnupg2-dc52995d85048ed12ae8b9f330e9ca41a4030aae.zip
gpg: Lazily evaluate --default-key.
* g10/gpg.c (main): If --encrypt-to-default-key is specified, don't add --default-key's value to REMUSR here... * g10/pkclist.c (build_pk_list): ... do it here. * tests/openpgp/Makefile.am (TESTS): Add default-key.test. * tests/openpgp/default-key.test: New file. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
Diffstat (limited to 'g10/gpg.c')
-rw-r--r--g10/gpg.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index 11dbf5631..71f44eddf 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -4281,8 +4281,6 @@ main (int argc, char **argv)
}
{
- int have_def_secret_key = opt.def_secret_key != NULL;
-
rc = check_user_ids (&locusr, 1, 1);
if (rc)
g10_exit (1);
@@ -4292,25 +4290,6 @@ main (int argc, char **argv)
rc = check_user_ids (&opt.def_secret_key, 1, 0);
if (rc)
g10_exit (1);
-
- if (opt.encrypt_to_default_key)
- {
- const char *default_key = parse_def_secret_key (ctrl);
- if (default_key)
- {
- sl = add_to_strlist2 (&remusr, default_key, utf8_strings);
- sl->flags = ((oEncryptToDefaultKey << PK_LIST_SHIFT)
- | PK_LIST_ENCRYPT_TO);
- if (opt.encrypt_to_default_key == 2)
- sl->flags |= PK_LIST_CONFIG;
- }
- else if (have_def_secret_key)
- log_info (_("option '%s' given, but no valid default keys given\n"),
- "--encrypt-to-default-key");
- else
- log_info (_("option '%s' given, but option '%s' not given\n"),
- "--encrypt-to-default-key", "--default-key");
- }
}
/* The command dispatcher. */