mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-14 08:13:25 +02:00
agent: Recover the old behavior with max-cache-ttl=0.
* agent/cache.c (compute_expiration): Expire newly created entry when max-cache-ttl is zero. -- Fixes-commit: 92de0387f04b1e87a4a49ed063323624f25ac3ef GnuPG-bug-id: 6681 Suggested-by: Lucas Mulling <lucas.mulling@suse.com> Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
8833a34bf0
commit
5fb338168e
@ -330,19 +330,24 @@ compute_expiration (ITEM r)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (r->cache_mode)
|
if (r->cache_mode == CACHE_MODE_DATA)
|
||||||
{
|
{
|
||||||
case CACHE_MODE_DATA:
|
/* No MAX TTL here. */
|
||||||
case CACHE_MODE_PIN:
|
if (r->ttl >= 0)
|
||||||
maxttl = 0; /* No MAX TTL here. */
|
{
|
||||||
break;
|
r->t.tv_sec = r->ttl;
|
||||||
case CACHE_MODE_SSH: maxttl = opt.max_cache_ttl_ssh; break;
|
r->t.reason = CACHE_EXPIRE_CREATION;
|
||||||
default: maxttl = opt.max_cache_ttl; break;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (r->cache_mode == CACHE_MODE_SSH)
|
||||||
|
maxttl = opt.max_cache_ttl_ssh;
|
||||||
|
else
|
||||||
|
maxttl = opt.max_cache_ttl;
|
||||||
|
|
||||||
if (maxttl)
|
if (r->created + maxttl <= current)
|
||||||
{
|
|
||||||
if (r->created + maxttl < current)
|
|
||||||
{
|
{
|
||||||
r->t.tv_sec = 0;
|
r->t.tv_sec = 0;
|
||||||
r->t.reason = CACHE_EXPIRE_CREATION;
|
r->t.reason = CACHE_EXPIRE_CREATION;
|
||||||
@ -350,27 +355,18 @@ compute_expiration (ITEM r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
next = r->created + maxttl - current;
|
next = r->created + maxttl - current;
|
||||||
}
|
if (r->ttl >= 0 && r->ttl < next)
|
||||||
else
|
|
||||||
next = 0;
|
|
||||||
|
|
||||||
if (r->ttl >= 0 && (next == 0 || r->ttl < next))
|
|
||||||
{
|
{
|
||||||
r->t.tv_sec = r->ttl;
|
r->t.tv_sec = r->ttl;
|
||||||
r->t.reason = CACHE_EXPIRE_LAST_ACCESS;
|
r->t.reason = CACHE_EXPIRE_LAST_ACCESS;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next)
|
|
||||||
{
|
|
||||||
r->t.tv_sec = next;
|
r->t.tv_sec = next;
|
||||||
r->t.reason = CACHE_EXPIRE_CREATION;
|
r->t.reason = CACHE_EXPIRE_CREATION;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_expiration (ITEM entry, int is_new_entry)
|
update_expiration (ITEM entry, int is_new_entry)
|
||||||
{
|
{
|
||||||
|
@ -406,10 +406,7 @@ control this behavior but this command line option takes precedence.
|
|||||||
Set the time a cache entry is valid to @var{n} seconds. The default
|
Set the time a cache entry is valid to @var{n} seconds. The default
|
||||||
is 600 seconds. Each time a cache entry is accessed, the entry's
|
is 600 seconds. Each time a cache entry is accessed, the entry's
|
||||||
timer is reset. To set an entry's maximum lifetime, use
|
timer is reset. To set an entry's maximum lifetime, use
|
||||||
@command{max-cache-ttl}. Note that a cached passphrase may not be
|
@command{max-cache-ttl}.
|
||||||
evicted immediately from memory if no client requests a cache
|
|
||||||
operation. This is due to an internal housekeeping function which is
|
|
||||||
only run every few seconds.
|
|
||||||
|
|
||||||
@item --default-cache-ttl-ssh @var{n}
|
@item --default-cache-ttl-ssh @var{n}
|
||||||
@opindex default-cache-ttl
|
@opindex default-cache-ttl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user