mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd:openpgp: Allow PIN length of 6 also with a reset code.
* scd/app-openpgp.c (do_change_pin): Fix PIN length check. Add "R" flag to the reset code prompt. -- When using the reset code it was not possible to set a PIN of length 6. The "R" flags fixes a funny prompt. Fixes-commit: efe325ffdf21205b90f888c8f0248bbd4f61404b scd:openpgp: Allow PIN length of 6 also with a reset code. * scd/app-openpgp.c (do_change_pin): Fix PIN length check. Add "R" flag to the reset code prompt. -- When using the reset code it was not possible to set a PIN of length 6. The "R" flags fixes a funny prompt. Fixes-commit: 2376cdff1318688d94c95fd01adc4b2139c4a8c7
This commit is contained in:
parent
d6dedda3f2
commit
40b85d8e8c
@ -3306,6 +3306,7 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr,
|
|||||||
char *pinvalue = NULL;
|
char *pinvalue = NULL;
|
||||||
int reset_mode = !!(flags & APP_CHANGE_FLAG_RESET);
|
int reset_mode = !!(flags & APP_CHANGE_FLAG_RESET);
|
||||||
int set_resetcode = 0;
|
int set_resetcode = 0;
|
||||||
|
int use_resetcode = 0;
|
||||||
pininfo_t pininfo;
|
pininfo_t pininfo;
|
||||||
int use_pinpad = 0;
|
int use_pinpad = 0;
|
||||||
int minlen = 6;
|
int minlen = 6;
|
||||||
@ -3458,7 +3459,7 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = pincb (pincb_arg,
|
rc = pincb (pincb_arg,
|
||||||
_("||Please enter the Reset Code for the card"),
|
_("|R|Please enter the Reset Code for the card"),
|
||||||
&resetcode);
|
&resetcode);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
@ -3473,13 +3474,14 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr,
|
|||||||
rc = gpg_error (GPG_ERR_BAD_RESET_CODE);
|
rc = gpg_error (GPG_ERR_BAD_RESET_CODE);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
use_resetcode = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = gpg_error (GPG_ERR_INV_ID);
|
rc = gpg_error (GPG_ERR_INV_ID);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
} /* End version 2 cards. */
|
||||||
|
|
||||||
if (chvno == 3)
|
if (chvno == 3)
|
||||||
app->did_chv3 = 0;
|
app->did_chv3 = 0;
|
||||||
@ -3511,6 +3513,17 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr,
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (use_resetcode)
|
||||||
|
{
|
||||||
|
minlen = 6; /* Reset from the RC value to the PIN value. */
|
||||||
|
if (strlen (pinvalue) < minlen)
|
||||||
|
{
|
||||||
|
log_info (_("PIN for CHV%d is too short;"
|
||||||
|
" minimum length is %d\n"), 1, minlen);
|
||||||
|
rc = gpg_error (GPG_ERR_BAD_PIN);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (chvno == 3)
|
if (chvno == 3)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user