aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-03-06 14:16:37 +0000
committerWerner Koch <[email protected]>2002-03-06 14:16:37 +0000
commit4e637f22851869020929ad541012e23d859fa1a9 (patch)
tree0d1f66624c4de4f1679c7e14a96e3b387848c4d6 /agent/command.c
parent* assuan-client.c (_assuan_read_from_server): Detect END. (diff)
downloadgnupg-4e637f22851869020929ad541012e23d859fa1a9.tar.gz
gnupg-4e637f22851869020929ad541012e23d859fa1a9.zip
sm/
* gpgsm.c: New command --learn-card * call-agent.c (learn_cb,gpgsm_agent_learn): New. * gpgsm.c (main): Print error messages for non-implemented commands. agent/ * learncard.c: New. * divert-scd.c (ask_for_card): The serial number is binary so convert it to hex here. * findkey.c (agent_write_private_key): New. * genkey.c (store_key): And use it here. scd/ * pkdecrypt.c (agent_pkdecrypt): Changed the way the diversion is done. * divert-scd.c (divert_pkdecrypt): Changed interface and implemented it.
Diffstat (limited to 'agent/command.c')
-rw-r--r--agent/command.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/agent/command.c b/agent/command.c
index bed9da648..e617d684f 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -64,6 +64,21 @@ reset_notify (ASSUAN_CONTEXT ctx)
ctrl->digest.valuelen = 0;
}
+
+/* Check whether the option NAME appears in LINE */
+static int
+has_option (const char *line, const char *name)
+{
+ const char *s;
+ int n = strlen (name);
+
+ s = strstr (line, name);
+ return (s && (s == line || spacep (s-1)) && (!s[n] || spacep (s+n)));
+}
+
+
+
+
/* ISTRUSTED <hexstring_with_fingerprint>
Return OK when we have an entry with this fingerprint in our
@@ -463,18 +478,18 @@ cmd_clear_passphrase (ASSUAN_CONTEXT ctx, char *line)
}
-/* LEARN
+/* LEARN [--send]
- Learn something about the currently inserted smartcard
- */
+ Learn something about the currently inserted smartcard. With
+ --send the new certificates are send back. */
static int
cmd_learn (ASSUAN_CONTEXT ctx, char *line)
{
int rc;
- rc = agent_card_learn ();
+ rc = agent_handle_learn (has_option (line, "--send")? ctx : NULL);
if (rc)
- log_error ("agent_learn_card failed: %s\n", gnupg_strerror (rc));
+ log_error ("agent_handle_learn failed: %s\n", gnupg_strerror (rc));
return map_to_assuan_status (rc);
}