summaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-06-10 06:54:03 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2022-06-10 06:54:03 +0200
commitdd600bbc84ddba56b4455cea97e048d681b083ce (patch)
tree29ee9621e0b24cb48793b5fa721d818bdddd853b /scd/command.c
parentscd,openpgp: Support READCERT by keygrip. (diff)
downloadgnupg2-dd600bbc84ddba56b4455cea97e048d681b083ce.tar.xz
gnupg2-dd600bbc84ddba56b4455cea97e048d681b083ce.zip
scd: Support specifying keygrip for learn command.
* scd/command.c (cmd_learn): Allow keygrip argument. -- GnuPG-bug-id: 6002 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r--scd/command.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/scd/command.c b/scd/command.c
index b9303b546..0f0c6c9df 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -538,13 +538,19 @@ cmd_learn (assuan_context_t ctx, char *line)
int only_keypairinfo = has_option (line, "--keypairinfo");
int opt_multi = has_option (line, "--multi");
int opt_reread = has_option (line, "--reread");
+ int opt_force = has_option (line, "--force");
unsigned int flags;
card_t card;
+ const char *keygrip = NULL;
if ((rc = open_card (ctrl)))
return rc;
- card = card_get (ctrl, NULL);
+ line = skip_options (line);
+ if (strlen (line) == 40)
+ keygrip = line;
+
+ card = card_get (ctrl, keygrip);
if (!card)
return gpg_error (GPG_ERR_CARD_NOT_PRESENT);
@@ -581,7 +587,7 @@ cmd_learn (assuan_context_t ctx, char *line)
return out_of_core ();
}
- if (!has_option (line, "--force"))
+ if (!opt_force)
{
char *command;