Line 0
Link Here
|
|
|
1 |
From f1c3eb4b16ca43b5d3712a3b54c22d17ce85af47 Mon Sep 17 00:00:00 2001 |
2 |
From: Werner Koch <wk@gnupg.org> |
3 |
Date: Mon, 1 Dec 2014 11:54:51 +0100 |
4 |
Subject: [PATCH] gpg: Fix export bug using exact search with only one key in |
5 |
the keybox. |
6 |
|
7 |
* g10/export.c (do_export_stream): Disable caching. |
8 |
* g10/keyserver.c (keyidlist): Ditto. |
9 |
-- |
10 |
|
11 |
GnuPG-bug-id: 1774 |
12 |
--- |
13 |
g10/export.c | 2 ++ |
14 |
g10/keydb.c | 3 +++ |
15 |
g10/keyserver.c | 3 ++- |
16 |
3 files changed, 7 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/g10/export.c b/g10/export.c |
19 |
index a92eace..b65fb8d 100644 |
20 |
--- g10/export.c |
21 |
+++ g10/export.c |
22 |
@@ -804,6 +804,8 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret, |
23 |
sl->d, gpg_strerror (err)); |
24 |
} |
25 |
|
26 |
+ keydb_disable_caching (kdbhd); /* We are looping the search. */ |
27 |
+ |
28 |
/* It would be nice to see which of the given users did actually |
29 |
match one in the keyring. To implement this we need to have |
30 |
a found flag for each entry in desc. To set this flag we |
31 |
diff --git a/g10/keydb.c b/g10/keydb.c |
32 |
index bafae18..a578c7c 100644 |
33 |
--- g10/keydb.c |
34 |
+++ g10/keydb.c |
35 |
@@ -1424,6 +1424,9 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, |
36 |
if (DBG_CACHE) |
37 |
dump_search_desc (hd, "keydb_search", desc, ndesc); |
38 |
|
39 |
+ /* NB: If one of the exact search modes below is used in a loop to |
40 |
+ walk over all keys (with the same fingerprint) the caching must |
41 |
+ have been disabled for the handle. */ |
42 |
if (!hd->no_caching |
43 |
&& ndesc == 1 |
44 |
&& (desc[0].mode == KEYDB_SEARCH_MODE_FPR20 |
45 |
diff --git a/g10/keyserver.c b/g10/keyserver.c |
46 |
index 5bc1eba..e3ad707 100644 |
47 |
--- g10/keyserver.c |
48 |
+++ g10/keyserver.c |
49 |
@@ -1229,7 +1229,8 @@ keyidlist(strlist_t users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3) |
50 |
|
51 |
*klist=xmalloc(sizeof(KEYDB_SEARCH_DESC)*num); |
52 |
|
53 |
- kdbhd=keydb_new (); |
54 |
+ kdbhd = keydb_new (); |
55 |
+ keydb_disable_caching (kdbhd); /* We are looping the search. */ |
56 |
|
57 |
if(!users) |
58 |
{ |
59 |
-- |
60 |
1.7.10.4 |
61 |
|