aboutsummaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2015-04-03 08:39:59 +0000
committerNIIBE Yutaka <[email protected]>2015-04-03 08:39:59 +0000
commitf82c4a6d0d76e716b6a7b22ca964fa2da1f962a0 (patch)
tree4a2ff1ab9e04bc630126719fce01d097308028e3 /g10/call-agent.c
parentagent: Add --force option for LEARN. (diff)
downloadgnupg-f82c4a6d0d76e716b6a7b22ca964fa2da1f962a0.tar.gz
gnupg-f82c4a6d0d76e716b6a7b22ca964fa2da1f962a0.zip
g10: Fix keytocard.
g10/call-agent.h (agent_scd_learn): Add FORCE option. g10/call-agent.c (agent_scd_learn): Implement FORCE option. g10/keygen.c (gen_card_key): Follow the change of option. g10/card-util.c (change_pin, card_status, factory_reset): Likewise. g10/keyedit.c (keyedit_menu): Update private key storage by agent_scd_learn. -- This is not a perfect solution since there is a possibility user unplug card before quitting 'gpg --keyedit' session. Usually, it works well. GnuPG-bug-id: 1846
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r--g10/call-agent.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 4bac8a0ef..2a80f22b8 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -673,7 +673,7 @@ learn_status_cb (void *opaque, const char *line)
/* Call the scdaemon to learn about a smartcard */
int
-agent_scd_learn (struct agent_card_info_s *info)
+agent_scd_learn (struct agent_card_info_s *info, int force)
{
int rc;
struct default_inq_parm_s parm;
@@ -701,7 +701,8 @@ agent_scd_learn (struct agent_card_info_s *info)
return rc;
parm.ctx = agent_ctx;
- rc = assuan_transact (agent_ctx, "LEARN --sendinfo",
+ rc = assuan_transact (agent_ctx,
+ force ? "LEARN --sendinfo --force" : "LEARN --sendinfo",
dummy_data_cb, NULL, default_inq_cb, &parm,
learn_status_cb, info);
/* Also try to get the key attributes. */