mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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
This commit is contained in:
parent
1e94a672ef
commit
e16d7168c5
16 changed files with 145 additions and 53 deletions
11
g10/sign.c
11
g10/sign.c
|
@ -769,7 +769,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
|
|||
|
||||
/* Note: In the old non-agent version the following call used to
|
||||
unprotect the secret key. This is now done on demand by the agent. */
|
||||
if( (rc = build_sk_list (locusr, &sk_list, PUBKEY_USAGE_SIG )) )
|
||||
if( (rc = build_sk_list (ctrl, locusr, &sk_list, PUBKEY_USAGE_SIG )) )
|
||||
goto leave;
|
||||
|
||||
if (encryptflag
|
||||
|
@ -1057,7 +1057,8 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
|
|||
* make a clear signature. note that opt.armor is not needed
|
||||
*/
|
||||
int
|
||||
clearsign_file( const char *fname, strlist_t locusr, const char *outfile )
|
||||
clearsign_file (ctrl_t ctrl,
|
||||
const char *fname, strlist_t locusr, const char *outfile )
|
||||
{
|
||||
armor_filter_context_t *afx;
|
||||
progress_filter_context_t *pfx;
|
||||
|
@ -1080,7 +1081,7 @@ clearsign_file( const char *fname, strlist_t locusr, const char *outfile )
|
|||
|
||||
/* Note: In the old non-agent version the following call used to
|
||||
unprotect the secret key. This is now done on demand by the agent. */
|
||||
if( (rc=build_sk_list( locusr, &sk_list, PUBKEY_USAGE_SIG )) )
|
||||
if( (rc=build_sk_list (ctrl, locusr, &sk_list, PUBKEY_USAGE_SIG )) )
|
||||
goto leave;
|
||||
|
||||
/* prepare iobufs */
|
||||
|
@ -1191,7 +1192,7 @@ clearsign_file( const char *fname, strlist_t locusr, const char *outfile )
|
|||
* FIXME: Far too much code is duplicated - revamp the whole file.
|
||||
*/
|
||||
int
|
||||
sign_symencrypt_file (const char *fname, strlist_t locusr)
|
||||
sign_symencrypt_file (ctrl_t ctrl, const char *fname, strlist_t locusr)
|
||||
{
|
||||
armor_filter_context_t *afx;
|
||||
progress_filter_context_t *pfx;
|
||||
|
@ -1224,7 +1225,7 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
|
|||
|
||||
/* Note: In the old non-agent version the following call used to
|
||||
unprotect the secret key. This is now done on demand by the agent. */
|
||||
rc = build_sk_list (locusr, &sk_list, PUBKEY_USAGE_SIG);
|
||||
rc = build_sk_list (ctrl, locusr, &sk_list, PUBKEY_USAGE_SIG);
|
||||
if (rc)
|
||||
goto leave;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue