1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* options.h, gpg.c (main), passphrase.c (passphrase_to_dek): Add

--passphrase-repeat option to control how many times gpg will
re-prompt for a passphrase to ensure the user has typed it correctly.
Defaults to 1.
This commit is contained in:
David Shaw 2006-12-03 04:41:59 +00:00
parent 7da18e7797
commit 884d1af0ae
4 changed files with 28 additions and 13 deletions

View file

@ -613,17 +613,21 @@ passphrase_to_dek (u32 *keyid, int pubkey_algo,
pw = xstrdup ("");
if ( *pw && mode == 2 )
{
char *pw2 = passphrase_get ( keyid, 2, NULL, NULL, NULL,
NULL, canceled );
if (!pw2)
pw2 = xstrdup ("");
if ( strcmp(pw, pw2) )
{
xfree(pw2);
xfree(pw);
return NULL;
}
xfree(pw2);
int i;
for(i=0;i<opt.passwd_repeat;i++)
{
char *pw2 = passphrase_get ( keyid, 2, NULL, NULL, NULL,
NULL, canceled );
if (!pw2)
pw2 = xstrdup ("");
if ( strcmp(pw, pw2) )
{
xfree(pw2);
xfree(pw);
return NULL;
}
xfree(pw2);
}
}
}