mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-28 22:49:59 +01: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
@ -1,3 +1,10 @@
|
|||||||
|
2006-12-02 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2006-11-27 Werner Koch <wk@g10code.com>
|
2006-11-27 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* openfile.c (ask_outfile_name): Fixed buffer overflow occurring
|
* openfile.c (ask_outfile_name): Fixed buffer overflow occurring
|
||||||
|
@ -211,6 +211,7 @@ enum cmd_and_opt_values
|
|||||||
oPasswd,
|
oPasswd,
|
||||||
oPasswdFD,
|
oPasswdFD,
|
||||||
oPasswdFile,
|
oPasswdFile,
|
||||||
|
oPasswdRepeat,
|
||||||
oCommandFD,
|
oCommandFD,
|
||||||
oCommandFile,
|
oCommandFile,
|
||||||
oQuickRandom,
|
oQuickRandom,
|
||||||
@ -564,6 +565,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oPasswd, "passphrase",2, "@" },
|
{ oPasswd, "passphrase",2, "@" },
|
||||||
{ oPasswdFD, "passphrase-fd",1, "@" },
|
{ oPasswdFD, "passphrase-fd",1, "@" },
|
||||||
{ oPasswdFile, "passphrase-file",2, "@" },
|
{ oPasswdFile, "passphrase-file",2, "@" },
|
||||||
|
{ oPasswdRepeat, "passphrase-repeat", 1, "@"},
|
||||||
{ oCommandFD, "command-fd",1, "@" },
|
{ oCommandFD, "command-fd",1, "@" },
|
||||||
{ oCommandFile, "command-file",2, "@" },
|
{ oCommandFile, "command-file",2, "@" },
|
||||||
{ oQuickRandom, "debug-quick-random", 0, "@"},
|
{ oQuickRandom, "debug-quick-random", 0, "@"},
|
||||||
@ -1858,6 +1860,7 @@ main (int argc, char **argv )
|
|||||||
opt.def_sig_expire="0";
|
opt.def_sig_expire="0";
|
||||||
opt.def_cert_expire="0";
|
opt.def_cert_expire="0";
|
||||||
set_homedir ( default_homedir () );
|
set_homedir ( default_homedir () );
|
||||||
|
opt.passwd_repeat=1;
|
||||||
|
|
||||||
/* Check whether we have a config file on the command line. */
|
/* Check whether we have a config file on the command line. */
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
@ -2419,6 +2422,7 @@ main (int argc, char **argv )
|
|||||||
case oPasswdFile:
|
case oPasswdFile:
|
||||||
pwfd = open_info_file (pargs.r.ret_str, 0);
|
pwfd = open_info_file (pargs.r.ret_str, 0);
|
||||||
break;
|
break;
|
||||||
|
case oPasswdRepeat: opt.passwd_repeat=pargs.r.ret_int; break;
|
||||||
case oCommandFD:
|
case oCommandFD:
|
||||||
opt.command_fd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
|
opt.command_fd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -239,8 +239,8 @@ struct
|
|||||||
} *auto_key_locate;
|
} *auto_key_locate;
|
||||||
|
|
||||||
/* True if multiple concatenated signatures may be verified. */
|
/* True if multiple concatenated signatures may be verified. */
|
||||||
int allow_multisig_verification;
|
int allow_multisig_verification;
|
||||||
|
int passwd_repeat;
|
||||||
} opt;
|
} opt;
|
||||||
|
|
||||||
/* CTRL is used to keep some global variables we currently can't
|
/* CTRL is used to keep some global variables we currently can't
|
||||||
|
@ -613,17 +613,21 @@ passphrase_to_dek (u32 *keyid, int pubkey_algo,
|
|||||||
pw = xstrdup ("");
|
pw = xstrdup ("");
|
||||||
if ( *pw && mode == 2 )
|
if ( *pw && mode == 2 )
|
||||||
{
|
{
|
||||||
char *pw2 = passphrase_get ( keyid, 2, NULL, NULL, NULL,
|
int i;
|
||||||
NULL, canceled );
|
for(i=0;i<opt.passwd_repeat;i++)
|
||||||
if (!pw2)
|
{
|
||||||
pw2 = xstrdup ("");
|
char *pw2 = passphrase_get ( keyid, 2, NULL, NULL, NULL,
|
||||||
if ( strcmp(pw, pw2) )
|
NULL, canceled );
|
||||||
{
|
if (!pw2)
|
||||||
xfree(pw2);
|
pw2 = xstrdup ("");
|
||||||
xfree(pw);
|
if ( strcmp(pw, pw2) )
|
||||||
return NULL;
|
{
|
||||||
}
|
xfree(pw2);
|
||||||
xfree(pw2);
|
xfree(pw);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
xfree(pw2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user