diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-06-10 06:54:03 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-06-10 06:54:03 +0200 |
commit | dd600bbc84ddba56b4455cea97e048d681b083ce (patch) | |
tree | 29ee9621e0b24cb48793b5fa721d818bdddd853b /scd/command.c | |
parent | scd,openpgp: Support READCERT by keygrip. (diff) | |
download | gnupg2-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.c | 10 |
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; |