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:
parent
7da18e7797
commit
884d1af0ae
4 changed files with 28 additions and 13 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue