gpg: Disable keydb handle caching

* g10/getkey.c (getkey_end): Disable caching of the open keydb
handle.

--
This created a big regression for Windows because the keyring
is only released after the global ctrl is released. So if an operation
does a getkey and then tries to modify the keyring it will fail on
Windows with a sharing violation. We need to modify all
keyring write operations to also take the ctrl and close the
cached_getkey_kdb handle to make writing work. See:
https://dev.gnupg.org/T3097

GnuPG-Bug-Id: T3097

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
This commit is contained in:
Andre Heinecke 2017-05-30 10:22:35 +02:00
parent 996544626e
commit d3d640b9cc
No known key found for this signature in database
GPG Key ID: 1FDF723CF462B6B1
1 changed files with 11 additions and 1 deletions

View File

@ -2219,10 +2219,20 @@ getkey_end (ctrl_t ctrl, getkey_ctx_t ctx)
{
if (ctx)
{
/*
XXX: This creates a big regression for Windows because the keyring
* is only released after the global ctrl is released. So if an operation
* does a getkey and then tries to modify the keyring it will fail on
* Windows with a sharing violation. We need to modify all
* keyring write operations to also take the ctrl and close the
* cached_getkey_kdb handle to make writing work. See:
* https://dev.gnupg.org/T3097
if (ctrl && !ctrl->cached_getkey_kdb)
ctrl->cached_getkey_kdb = ctx->kr_handle;
else
keydb_release (ctx->kr_handle);
*/
keydb_release (ctx->kr_handle);
free_strlist (ctx->extra_list);
if (!ctx->not_allocated)
xfree (ctx);