aboutsummaryrefslogtreecommitdiffstats
path: root/g10/skclist.c
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2015-11-03 22:15:27 +0000
committerNeal H. Walfield <[email protected]>2015-11-04 12:19:52 +0000
commite16d7168c54e5f7bc2f0037806ee4f730930eaf0 (patch)
tree8cf75fb29648d091e01533506d6377e645451123 /g10/skclist.c
parentscd: Fix error handling with libusb-compat library. (diff)
downloadgnupg-e16d7168c54e5f7bc2f0037806ee4f730930eaf0.tar.gz
gnupg-e16d7168c54e5f7bc2f0037806ee4f730930eaf0.zip
gpg: Allow multiple --default-key options. Take the last available key.
* g10/getkey.c (parse_def_secret_key): New function. (get_seckey_default): Add parameter ctrl. Update callers. Use parse_def_secret_key to get the default secret key, if any. (getkey_byname): Likewise. (enum_secret_keys): Likewise. * g10/options.h (opt): Change def_secret_key's type from a char * to a strlist_t. * g10/gpg.c (main): When processing --default-key, add the key to OPT.DEF_SECRET_KEY. * g10/gpgv.c (get_session_key): Add parameter ctrl. Update callers. * g10/mainproc.c (proc_pubkey_enc): Likewise. (do_proc_packets): Likewise. * g10/pkclist.c (default_recipient): Likewise. * g10/pubkey-enc.c (get_session_key): Likewise. * g10/sign.c (clearsign_file): Likewise. (sign_symencrypt_file): Likewise. * g10/skclist.c (build_sk_list): Likewise. * g10/test-stubs.c (get_session_key): Likewise. -- Signed-off-by: Neal H. Walield <[email protected]> GnuPG-bug-id: 806
Diffstat (limited to 'g10/skclist.c')
-rw-r--r--g10/skclist.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/g10/skclist.c b/g10/skclist.c
index 53d6f7734..3d137b261 100644
--- a/g10/skclist.c
+++ b/g10/skclist.c
@@ -114,7 +114,8 @@ is_duplicated_entry (strlist_t list, strlist_t item)
gpg_error_t
-build_sk_list (strlist_t locusr, SK_LIST *ret_sk_list, unsigned int use)
+build_sk_list (ctrl_t ctrl,
+ strlist_t locusr, SK_LIST *ret_sk_list, unsigned int use)
{
gpg_error_t err;
SK_LIST sk_list = NULL;
@@ -125,7 +126,7 @@ build_sk_list (strlist_t locusr, SK_LIST *ret_sk_list, unsigned int use)
pk = xmalloc_clear (sizeof *pk);
pk->req_usage = use;
- if ((err = getkey_byname (NULL, pk, NULL, 1, NULL)))
+ if ((err = getkey_byname (ctrl, NULL, pk, NULL, 1, NULL)))
{
free_public_key (pk);
pk = NULL;
@@ -182,7 +183,7 @@ build_sk_list (strlist_t locusr, SK_LIST *ret_sk_list, unsigned int use)
}
pk = xmalloc_clear (sizeof *pk);
pk->req_usage = use;
- if ((err = getkey_byname (NULL, pk, locusr->d, 1, NULL)))
+ if ((err = getkey_byname (ctrl, NULL, pk, locusr->d, 1, NULL)))
{
free_public_key (pk);
pk = NULL;