1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-02 12:01:32 +01:00

gpg: Disable keydb handle caching only for W32

* g10/getkey.c (getkey_end) [!W32]: Re-enable caching.
--

This change limits of the effects of commit
d3d640b9cc98dd0d06b49a2e4d46eb67af96fe29 to W32 system.

GnuPG-bug-id: 3097
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2017-06-13 09:05:40 +02:00
parent a36c48a780
commit e80925171d
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

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