1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-21 19:48:05 +01:00

* getkey.c: Set MAX_PK_CACHE_ENTRIES and MAX_UID_CACHE_ENTRIES to

PK_UID_CACHE_SIZE (set in ./configure).

* getkey.c (get_pubkey): When reading key data into the cache, properly
handle keys that are partially (pk, no UIDs) cached already.  This is
Debian bug #176425 and #229549.
This commit is contained in:
David Shaw 2004-01-27 17:36:26 +00:00
parent d726dc1223
commit 8e2a476fb7
2 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2004-01-27 David Shaw <dshaw@jabberwocky.com>
* getkey.c: Set MAX_PK_CACHE_ENTRIES and MAX_UID_CACHE_ENTRIES to
PK_UID_CACHE_SIZE (set in ./configure).
* getkey.c (get_pubkey): When reading key data into the cache,
properly handle keys that are partially (pk, no UIDs) cached
already. This is Debian bug #176425 and #229549.
2004-01-26 David Shaw <dshaw@jabberwocky.com>
* compress.c (init_compress): Remove "-z10" trick to get

View File

@ -35,14 +35,13 @@
#include "trustdb.h"
#include "i18n.h"
#define MAX_PK_CACHE_ENTRIES 200
#define MAX_UID_CACHE_ENTRIES 200
#define MAX_PK_CACHE_ENTRIES PK_UID_CACHE_SIZE
#define MAX_UID_CACHE_ENTRIES PK_UID_CACHE_SIZE
#if MAX_PK_CACHE_ENTRIES < 2
#error We need the cache for key creation
#endif
struct getkey_ctx_s {
int exact;
KBNODE keyblock;
@ -320,16 +319,21 @@ get_pubkey( PKT_public_key *pk, u32 *keyid )
int rc = 0;
#if MAX_PK_CACHE_ENTRIES
{ /* Try to get it from the cache */
if(pk)
{
/* Try to get it from the cache. We don't do this when pk is
NULL as it does not guarantee that the user IDs are
cached. */
pk_cache_entry_t ce;
for( ce = pk_cache; ce; ce = ce->next ) {
if( ce->keyid[0] == keyid[0] && ce->keyid[1] == keyid[1] ) {
if( pk )
copy_public_key( pk, ce->pk );
for( ce = pk_cache; ce; ce = ce->next )
{
if( ce->keyid[0] == keyid[0] && ce->keyid[1] == keyid[1] )
{
copy_public_key( pk, ce->pk );
return 0;
}
}
}
}
}
}
#endif
/* more init stuff */
if( !pk ) {