1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Tweaks for gpgconf.

Fixed dirmngr bug 1010.
This commit is contained in:
Werner Koch 2010-12-14 19:17:58 +00:00
parent 43a7cb7fd4
commit 5fd7ff3488
9 changed files with 103 additions and 19 deletions

View file

@ -178,7 +178,7 @@ static crl_cache_entry_t find_entry (crl_cache_entry_t first,
/* The currently loaded cache object. This isi usually initialized
/* The currently loaded cache object. This is usually initialized
right at startup. */
static crl_cache_t current_cache;
@ -393,7 +393,7 @@ release_cache (crl_cache_t cache)
{
entry2 = entry->next;
release_one_cache_entry (entry);
}
}
cache->entries = NULL;
xfree (cache);
}
@ -1189,6 +1189,7 @@ unlock_db_file (crl_cache_t cache, crl_cache_entry_t entry)
cache->entries = enext;
else
eprev->next = enext;
/* FIXME: Do we leak ENTRY? */
}
}
@ -1204,7 +1205,6 @@ find_entry (crl_cache_entry_t first, const char *issuer_hash)
}
/* Create a new CRL cache. This fucntion is usually called only once.
never fail. */
void
@ -2177,6 +2177,31 @@ crl_cache_insert (ctrl_t ctrl, const char *url, ksba_reader_t reader)
newfname = make_db_file_name (entry->issuer_hash);
if (opt.verbose)
log_info (_("creating cache file `%s'\n"), newfname);
/* Just in case close unused matching files. Actually we need this
only under Windows but saving file descriptors is never bad. */
{
int any;
do
{
any = 0;
for (e = cache->entries; e; e = e->next)
if (!e->cdb_use_count && e->cdb
&& !strcmp (e->issuer_hash, entry->issuer_hash))
{
int fd = cdb_fileno (e->cdb);
cdb_free (e->cdb);
xfree (e->cdb);
e->cdb = NULL;
if (close (fd))
log_error (_("error closing cache file: %s\n"),
strerror(errno));
any = 1;
break;
}
}
while (any);
}
#ifdef HAVE_W32_SYSTEM
gnupg_remove (newfname);
#endif