From fca694b372a6c3a43f3937269753c8378c499569 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 22 Jun 2006 17:20:47 +0000 Subject: [PATCH] 2006-06-22 Marcus Brinkmann * keylist.c (gpgme_get_key): Also clone the engine info. --- gpgme/ChangeLog | 4 ++++ gpgme/keylist.c | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index b446e6a5..d1342550 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,7 @@ +2006-06-22 Marcus Brinkmann + + * keylist.c (gpgme_get_key): Also clone the engine info. + 2006-03-06 Marcus Brinkmann * gpgme-config.in (cflags_pth): Revert accidential removal of diff --git a/gpgme/keylist.c b/gpgme/keylist.c index 28129753..b6190162 100644 --- a/gpgme/keylist.c +++ b/gpgme/keylist.c @@ -939,8 +939,22 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key, err = gpgme_new (&listctx); if (err) return err; - gpgme_set_protocol (listctx, gpgme_get_protocol (ctx)); - gpgme_set_keylist_mode (listctx, ctx->keylist_mode); + { + gpgme_protocol_t proto; + gpgme_engine_info_t info; + + /* Clone the relevant state. */ + proto = gpgme_get_protocol (ctx); + gpgme_set_protocol (listctx, proto); + gpgme_set_keylist_mode (listctx, gpgme_get_keylist_mode (ctx)); + info = gpgme_ctx_get_engine_info (ctx); + while (info && info->protocol != proto) + info = info->next; + if (info) + gpgme_ctx_set_engine_info (listctx, proto, + info->file_name, info->home_dir); + } + err = gpgme_op_keylist_start (listctx, fpr, secret); if (!err) err = gpgme_op_keylist_next (listctx, r_key);