mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-09 12:54:23 +01:00
* gpg-agent.c: New option --max-cache-ttl. Suggested by Alexander
Belopolsky. * cache.c (housekeeping): Use it here instead of the hardwired default of 1 hour.
This commit is contained in:
parent
0ded031237
commit
ebaba6bdab
@ -1,5 +1,10 @@
|
|||||||
2004-08-20 Werner Koch <wk@g10code.de>
|
2004-08-20 Werner Koch <wk@g10code.de>
|
||||||
|
|
||||||
|
* gpg-agent.c: New option --max-cache-ttl. Suggested by Alexander
|
||||||
|
Belopolsky.
|
||||||
|
* cache.c (housekeeping): Use it here instead of the hardwired
|
||||||
|
default of 1 hour.
|
||||||
|
|
||||||
* query.c (start_pinentry): Use a timeout for the pinentry lock.
|
* query.c (start_pinentry): Use a timeout for the pinentry lock.
|
||||||
|
|
||||||
2004-08-18 Werner Koch <wk@g10code.de>
|
2004-08-18 Werner Koch <wk@g10code.de>
|
||||||
|
@ -54,6 +54,7 @@ struct {
|
|||||||
const char *scdaemon_program;
|
const char *scdaemon_program;
|
||||||
int no_grab; /* don't let the pinentry grab the keyboard */
|
int no_grab; /* don't let the pinentry grab the keyboard */
|
||||||
unsigned long def_cache_ttl;
|
unsigned long def_cache_ttl;
|
||||||
|
unsigned long max_cache_ttl;
|
||||||
|
|
||||||
int running_detached; /* we are running detached from the tty. */
|
int running_detached; /* we are running detached from the tty. */
|
||||||
|
|
||||||
|
@ -103,10 +103,11 @@ housekeeping (void)
|
|||||||
that the user has to enter it from time to time. We do this every hour */
|
that the user has to enter it from time to time. We do this every hour */
|
||||||
for (r=thecache; r; r = r->next)
|
for (r=thecache; r; r = r->next)
|
||||||
{
|
{
|
||||||
if (!r->lockcount && r->pw && r->created + 60*60 < current)
|
if (!r->lockcount && r->pw && r->created + opt.max_cache_ttl < current)
|
||||||
{
|
{
|
||||||
if (DBG_CACHE)
|
if (DBG_CACHE)
|
||||||
log_debug (" expired `%s' (1h after creation)\n", r->key);
|
log_debug (" expired `%s' (%lus after creation)\n",
|
||||||
|
r->key, opt.max_cache_ttl);
|
||||||
release_data (r->pw);
|
release_data (r->pw);
|
||||||
r->pw = NULL;
|
r->pw = NULL;
|
||||||
r->accessed = current;
|
r->accessed = current;
|
||||||
|
@ -77,8 +77,9 @@ enum cmd_and_opt_values
|
|||||||
oLCctype,
|
oLCctype,
|
||||||
oLCmessages,
|
oLCmessages,
|
||||||
oScdaemonProgram,
|
oScdaemonProgram,
|
||||||
oDefCacheTTL,
|
|
||||||
oDisablePth,
|
oDisablePth,
|
||||||
|
oDefCacheTTL,
|
||||||
|
oMaxCacheTTL,
|
||||||
|
|
||||||
oIgnoreCacheForSigning,
|
oIgnoreCacheForSigning,
|
||||||
oAllowMarkTrusted,
|
oAllowMarkTrusted,
|
||||||
@ -127,6 +128,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
|
|
||||||
{ oDefCacheTTL, "default-cache-ttl", 4,
|
{ oDefCacheTTL, "default-cache-ttl", 4,
|
||||||
N_("|N|expire cached PINs after N seconds")},
|
N_("|N|expire cached PINs after N seconds")},
|
||||||
|
{ oMaxCacheTTL, "max-cache-ttl", 4, "@" },
|
||||||
{ oIgnoreCacheForSigning, "ignore-cache-for-signing", 0,
|
{ oIgnoreCacheForSigning, "ignore-cache-for-signing", 0,
|
||||||
N_("do not use the PIN cache when signing")},
|
N_("do not use the PIN cache when signing")},
|
||||||
{ oAllowMarkTrusted, "allow-mark-trusted", 0,
|
{ oAllowMarkTrusted, "allow-mark-trusted", 0,
|
||||||
@ -136,6 +138,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
|
|
||||||
|
|
||||||
#define DEFAULT_CACHE_TTL (10*60) /* 10 minutes */
|
#define DEFAULT_CACHE_TTL (10*60) /* 10 minutes */
|
||||||
|
#define MAX_CACHE_TTL (120*60) /* 2 hours */
|
||||||
|
|
||||||
static volatile int caught_fatal_sig = 0;
|
static volatile int caught_fatal_sig = 0;
|
||||||
|
|
||||||
@ -342,6 +345,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
|
|||||||
opt.pinentry_program = NULL;
|
opt.pinentry_program = NULL;
|
||||||
opt.scdaemon_program = NULL;
|
opt.scdaemon_program = NULL;
|
||||||
opt.def_cache_ttl = DEFAULT_CACHE_TTL;
|
opt.def_cache_ttl = DEFAULT_CACHE_TTL;
|
||||||
|
opt.max_cache_ttl = MAX_CACHE_TTL;
|
||||||
opt.ignore_cache_for_signing = 0;
|
opt.ignore_cache_for_signing = 0;
|
||||||
opt.allow_mark_trusted = 0;
|
opt.allow_mark_trusted = 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -372,6 +376,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
|
|||||||
case oScdaemonProgram: opt.scdaemon_program = pargs->r.ret_str; break;
|
case oScdaemonProgram: opt.scdaemon_program = pargs->r.ret_str; break;
|
||||||
|
|
||||||
case oDefCacheTTL: opt.def_cache_ttl = pargs->r.ret_ulong; break;
|
case oDefCacheTTL: opt.def_cache_ttl = pargs->r.ret_ulong; break;
|
||||||
|
case oMaxCacheTTL: opt.max_cache_ttl = pargs->r.ret_ulong; break;
|
||||||
|
|
||||||
case oIgnoreCacheForSigning: opt.ignore_cache_for_signing = 1; break;
|
case oIgnoreCacheForSigning: opt.ignore_cache_for_signing = 1; break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user