diff --git a/agent/ChangeLog b/agent/ChangeLog index 83ac2b33c..18f02f77b 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,5 +1,12 @@ +2002-02-06 Werner Koch + + * cache.c (housekeeping): Fixed linking in the remove case. + 2002-02-01 Werner Koch + * gpg-agent.c: New option --default-cache-ttl. + * cache.c (agent_put_cache): Use it. + * cache.c: Add a few debug outputs. * protect.c (agent_private_key_type): New. diff --git a/agent/agent.h b/agent/agent.h index 0b88d9a2c..9236ef07a 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -37,6 +37,7 @@ struct { const char *homedir; /* configuration directory name */ const char *pinentry_program; int no_grab; /* don't let the pinentry grab the keyboard */ + unsigned long def_cache_ttl; } opt; diff --git a/agent/cache.c b/agent/cache.c index 480eb277c..58cec4253 100644 --- a/agent/cache.c +++ b/agent/cache.c @@ -125,7 +125,7 @@ housekeeping (void) if (!rprev) thecache = r2; else - rprev = r2; + rprev->next = r2; r = r2; } else @@ -152,7 +152,9 @@ agent_put_cache (const char *key, const char *data, int ttl) housekeeping (); if (ttl < 1) - ttl = 60*5; /* default is 5 minutes */ + ttl = opt.def_cache_ttl; + if (!ttl) + return 0; for (r=thecache; r; r = r->next) { diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index d5176dd72..5e014bbc1 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -69,6 +69,7 @@ enum cmd_and_opt_values oBatch, oPinentryProgram, + oDefCacheTTL, aTest }; @@ -91,8 +92,9 @@ static ARGPARSE_OPTS opts[] = { { oNoGrab, "no-grab" ,0, N_("do not grab keyboard and mouse")}, { oLogFile, "log-file" ,2, N_("use a log file for the server")}, - { oPinentryProgram, "pinentry-program", 2 , "Path of PIN Entry program" }, - + { oPinentryProgram, "pinentry-program", 2 , "path of PIN Entry program" }, + { oDefCacheTTL, "default-cache-ttl", 4, + "|N|expire cached PINs after N seconds"}, {0} }; @@ -268,6 +270,8 @@ main (int argc, char **argv ) opt.homedir = "~/.gnupg-test"; #endif } + opt.def_cache_ttl = 10*60; /* default to 10 minutes */ + /* check whether we have a config file on the commandline */ orig_argc = argc; @@ -368,6 +372,7 @@ main (int argc, char **argv ) case oServer: pipe_server = 1; break; case oPinentryProgram: opt.pinentry_program = pargs.r.ret_str; break; + case oDefCacheTTL: opt.def_cache_ttl = pargs.r.ret_ulong; break; default : pargs.err = configfp? 1:2; break; } @@ -457,7 +462,7 @@ main (int argc, char **argv ) } if (strlen (socket_name)+1 >= sizeof serv_addr.sun_path ) { - log_error ("name of socket to long\n"); + log_error ("name of socket too long\n"); exit (1); }