diff options
author | David Shaw <[email protected]> | 2006-12-03 04:41:59 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2006-12-03 04:41:59 +0000 |
commit | 884d1af0aec311630a18809d0c61a1a2fc5278a5 (patch) | |
tree | 64185b8eef9c6a005f472513e62956f6c2232609 /g10/passphrase.c | |
parent | The usual po file updates. (diff) | |
download | gnupg-884d1af0aec311630a18809d0c61a1a2fc5278a5.tar.gz gnupg-884d1af0aec311630a18809d0c61a1a2fc5278a5.zip |
* 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.
Diffstat (limited to '')
-rw-r--r-- | g10/passphrase.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c index 744da06ba..ae22074f6 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -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); + } } } |