1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

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>
This commit is contained in:
NIIBE Yutaka 2022-06-10 13:54:03 +09:00
parent 273b8ec193
commit dd600bbc84

View File

@ -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;