1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Implement --faked-systrem-time for gpg.

Typo and comment fixes.
This commit is contained in:
Werner Koch 2009-12-17 17:25:26 +00:00
parent 34baa18187
commit af935bd410
8 changed files with 49 additions and 12 deletions

View file

@ -1,3 +1,7 @@
2009-12-17 Werner Koch <wk@g10code.com>
* gpg.c: Add new option --faked-system-time.
2009-12-15 Werner Koch <wk@g10code.com>
* keydb.c (keydb_add_resource): s/readonly/read_only/g.

View file

@ -362,6 +362,7 @@ enum cmd_and_opt_values
oDisableDSA2,
oAllowMultipleMessages,
oNoAllowMultipleMessages,
oFakedSystemTime,
oNoop
};
@ -704,6 +705,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_s (oPersonalDigestPreferences, "personal-digest-preferences","@"),
ARGPARSE_s_s (oPersonalCompressPreferences,
"personal-compress-preferences", "@"),
ARGPARSE_s_s (oFakedSystemTime, "faked-system-time", "@"),
/* Aliases. I constantly mistype these, and assume other people do
as well. */
@ -2963,6 +2965,15 @@ main (int argc, char **argv)
opt.flags.allow_multiple_messages=0;
break;
case oFakedSystemTime:
{
time_t faked_time = isotime2epoch (pargs.r.ret_str);
if (faked_time == (time_t)(-1))
faked_time = (time_t)strtoul (pargs.r.ret_str, NULL, 10);
gnupg_set_time (faked_time, 0);
}
break;
case oNoop: break;
default:
@ -3069,6 +3080,17 @@ main (int argc, char **argv)
if( opt.batch )
tty_batchmode( 1 );
if (gnupg_faked_time_p ())
{
gnupg_isotime_t tbuf;
log_info (_("WARNING: running with faked system time: "));
gnupg_get_isotime (tbuf);
dump_isotime (tbuf);
log_printf ("\n");
}
gcry_control (GCRYCTL_RESUME_SECMEM_WARN);
if(require_secmem && !got_secmem)

View file

@ -608,7 +608,7 @@ static const char hlp_passwd[] =
static gpg_error_t
cmd_passwd (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
/* ctrl_t ctrl = assuan_get_pointer (ctx); */
gpg_error_t err;
line = skip_options (line);
@ -629,7 +629,7 @@ register_commands (assuan_context_t ctx)
{
const char *name;
assuan_handler_t handler;
assuan_handler_t help;
const char * const help;
} table[] = {
{ "RECIPIENT", cmd_recipient },
{ "SIGNER", cmd_signer },