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

* findkey.c (unprotect): Show an error message for a bad passphrase.

This commit is contained in:
Werner Koch 2002-02-18 22:39:26 +00:00
parent 5dac4711f9
commit 2585114325
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2002-02-18 Werner Koch <wk@gnupg.org> 2002-02-18 Werner Koch <wk@gnupg.org>
* findkey.c (unprotect): Show an error message for a bad passphrase.
* command.c (cmd_marktrusted): Implemented. * command.c (cmd_marktrusted): Implemented.
* trustlist.c (agent_marktrusted): New. * trustlist.c (agent_marktrusted): New.
(open_list): Add APPEND arg. (open_list): Add APPEND arg.

View File

@ -39,6 +39,7 @@ unprotect (unsigned char **keybuf, const unsigned char *grip)
size_t resultlen; size_t resultlen;
int tries = 0; int tries = 0;
char hexgrip[40+1]; char hexgrip[40+1];
const char *errtext;
for (i=0; i < 20; i++) for (i=0; i < 20; i++)
sprintf (hexgrip+2*i, "%02X", grip[i]); sprintf (hexgrip+2*i, "%02X", grip[i]);
@ -67,9 +68,10 @@ unprotect (unsigned char **keybuf, const unsigned char *grip)
pi->max_digits = 8; pi->max_digits = 8;
pi->max_tries = 3; pi->max_tries = 3;
errtext = NULL;
do do
{ {
rc = agent_askpin (NULL, NULL, pi); rc = agent_askpin (NULL, errtext, pi);
if (!rc) if (!rc)
{ {
rc = agent_unprotect (*keybuf, pi->pin, &result, &resultlen); rc = agent_unprotect (*keybuf, pi->pin, &result, &resultlen);
@ -82,6 +84,7 @@ unprotect (unsigned char **keybuf, const unsigned char *grip)
return 0; return 0;
} }
} }
errtext = pi->min_digits? trans ("Bad PIN") : trans ("Bad Passphrase");
} }
while ((rc == GNUPG_Bad_Passphrase || rc == GNUPG_Bad_PIN) while ((rc == GNUPG_Bad_Passphrase || rc == GNUPG_Bad_PIN)
&& tries++ < 3); && tries++ < 3);