diff options
author | NIIBE Yutaka <[email protected]> | 2015-04-03 08:33:11 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2015-04-03 08:33:11 +0000 |
commit | 4ffadb74b3ada8a5d69ef8d87f4326df9bd97e97 (patch) | |
tree | 4081a136e6da908756c76123dc8eeda924bd3953 /agent/learncard.c | |
parent | dirmngr: Don't use alloca. (diff) | |
download | gnupg-4ffadb74b3ada8a5d69ef8d87f4326df9bd97e97.tar.gz gnupg-4ffadb74b3ada8a5d69ef8d87f4326df9bd97e97.zip |
agent: Add --force option for LEARN.
* agent/command.c (cmd_learn): Handle --force option.
(cmd_keytocard): Don't update key storage file.
* agent/agent.h (agent_handle_learn): Add FORCE.
* agent/learncard.c (agent_handle_learn): Implement FORCE to update
key stroage file.
--
Diffstat (limited to 'agent/learncard.c')
-rw-r--r-- | agent/learncard.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/agent/learncard.c b/agent/learncard.c index 62569ceff..e0f23400d 100644 --- a/agent/learncard.c +++ b/agent/learncard.c @@ -299,7 +299,7 @@ send_cert_back (ctrl_t ctrl, const char *id, void *assuan_context) /* Perform the learn operation. If ASSUAN_CONTEXT is not NULL and SEND is true all new certificates are send back via Assuan. */ int -agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context) +agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context, int force) { int rc; @@ -399,7 +399,7 @@ agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context) for (p=item->hexgrip, i=0; i < 20; p += 2, i++) grip[i] = xtoi_2 (p); - if (!agent_key_available (grip)) + if (!force && !agent_key_available (grip)) continue; /* The key is already available. */ /* Unknown key - store it. */ @@ -430,7 +430,7 @@ agent_handle_learn (ctrl_t ctrl, int send, void *assuan_context) n = gcry_sexp_canon_len (shdkey, 0, NULL, NULL); assert (n); - rc = agent_write_private_key (grip, shdkey, n, 0); + rc = agent_write_private_key (grip, shdkey, n, force); xfree (shdkey); if (rc) { |