gpg: Allow multiple --default-key options. Take the last available key.
authorNeal H. Walfield <neal@g10code.com>
Tue, 3 Nov 2015 22:15:27 +0000 (23:15 +0100)
committerNeal H. Walfield <neal@g10code.com>
Wed, 4 Nov 2015 12:19:52 +0000 (13:19 +0100)
commite16d7168c54e5f7bc2f0037806ee4f730930eaf0
tree8cf75fb29648d091e01533506d6377e645451123
parent1e94a672efb8bf66f416bc63bf6670e509a21fe5
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 <neal@g10code.com>
GnuPG-bug-id: 806
16 files changed:
doc/gpg.texi
g10/getkey.c
g10/gpg.c
g10/gpgv.c
g10/keydb.h
g10/keyedit.c
g10/main.h
g10/mainproc.c
g10/options.h
g10/packet.h
g10/pkclist.c
g10/pubkey-enc.c
g10/revoke.c
g10/sign.c
g10/skclist.c
g10/test-stubs.c