From 2d432afff653239ef73c97fdecfff2df1622c62d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 26 Sep 2002 07:10:56 +0000 Subject: * gpg-agent.c (handle_signal): Flush cache on SIGHUP. * cache.c (agent_flush_cache): New. * gpg-agent.c, agent.h: Add --keep-display and --keep-tty. * query.c (start_pinentry): Implement them. The option passing needs more thoughts. --- agent/cache.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'agent/cache.c') diff --git a/agent/cache.c b/agent/cache.c index 4b18ad30f..8f5bf9d3d 100644 --- a/agent/cache.c +++ b/agent/cache.c @@ -150,6 +150,35 @@ housekeeping (void) } +void +agent_flush_cache (void) +{ + ITEM r; + + if (DBG_CACHE) + log_debug ("agent_flush_cache\n"); + + for (r=thecache; r; r = r->next) + { + if (!r->lockcount && r->pw) + { + if (DBG_CACHE) + log_debug (" flushing `%s'\n", r->key); + release_data (r->pw); + r->pw = NULL; + r->accessed = 0; + } + else if (r->lockcount && r->pw) + { + if (DBG_CACHE) + log_debug (" marked `%s' for flushing\n", r->key); + r->accessed = 0; + r->ttl = 0; + } + } +} + + /* Store DATA of length DATALEN in the cache under KEY and mark it with a maximum lifetime of TTL seconds. If there is already data -- cgit v1.2.3