mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
scd: Enhance PASSWD command to accept KEYGRIP optionally.
* scd/command.c (cmd_passwd): Handle KEYGRIP optionally. -- GnuPG-bug-id: 5862 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
d577ed2956
commit
934864d399
@ -1620,7 +1620,7 @@ cmd_random (assuan_context_t ctx, char *line)
|
||||
|
||||
|
||||
static const char hlp_passwd[] =
|
||||
"PASSWD [--reset] [--nullpin] [--clear] <chvno>\n"
|
||||
"PASSWD [--reset] [--nullpin] [--clear] <chvno> [<keygrip>]\n"
|
||||
"\n"
|
||||
"Change the PIN or, if --reset is given, reset the retry counter of\n"
|
||||
"the card holder verification vector CHVNO. The option --nullpin is\n"
|
||||
@ -1635,6 +1635,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
|
||||
char *chvnostr;
|
||||
unsigned int flags = 0;
|
||||
card_t card;
|
||||
const char *keygrip = NULL;
|
||||
|
||||
if (has_option (line, "--reset"))
|
||||
flags |= APP_CHANGE_FLAG_RESET;
|
||||
@ -1650,7 +1651,11 @@ cmd_passwd (assuan_context_t ctx, char *line)
|
||||
chvnostr = line;
|
||||
while (*line && !spacep (line))
|
||||
line++;
|
||||
*line = 0;
|
||||
if (*line)
|
||||
*line++ = 0;
|
||||
|
||||
if (strlen (line) == 40)
|
||||
keygrip = line;
|
||||
|
||||
/* Do not allow other flags aside of --clear. */
|
||||
if ((flags & APP_CHANGE_FLAG_CLEAR) && (flags & ~APP_CHANGE_FLAG_CLEAR))
|
||||
@ -1660,7 +1665,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
|
||||
if ((rc = open_card (ctrl)))
|
||||
return rc;
|
||||
|
||||
card = card_get (ctrl, NULL);
|
||||
card = card_get (ctrl, keygrip);
|
||||
if (!card)
|
||||
return gpg_error (GPG_ERR_UNSUPPORTED_OPERATION);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user