diff options
author | Werner Koch <wk@gnupg.org> | 2014-10-31 12:15:34 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2014-10-31 12:15:34 +0100 |
commit | 935edf88ab29b2f63afc2a0e3af1b33c92033ab7 (patch) | |
tree | eed38381131b8d98f4aa95a2a6aa9227ec576699 /kbx/keybox-blob.c | |
parent | gpg: Fix --rebuild-keydb-caches. (diff) | |
download | gnupg2-935edf88ab29b2f63afc2a0e3af1b33c92033ab7.tar.xz gnupg2-935edf88ab29b2f63afc2a0e3af1b33c92033ab7.zip |
kbx: Let keydb_search skip unwanted blobs.
* kbx/keybox.h (keybox_blobtype_t): New.
* kbx/keybox-defs.h (BLOBTYPE_*): Replace by KEYBOX_BLOBTYPE_*.
* kbx/keybox-search.c (keybox_search): Add arg want_blobtype and skip
non-matching blobs.
* sm/keydb.c (keydb_search): Pass KEYBOX_BLOBTYPE_X509 to keybox_search.
* g10/keydb.c (keydb_search): Pass KEYBOX_BLOBTYPE_PGP to keybox_search.
--
Without this fix a listing of all keys would fail because the wrong
blob type would be returned for the gpg or gpgsm.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'kbx/keybox-blob.c')
-rw-r--r-- | kbx/keybox-blob.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c index 35ce3e360..ef72148da 100644 --- a/kbx/keybox-blob.c +++ b/kbx/keybox-blob.c @@ -591,7 +591,7 @@ create_blob_header (KEYBOXBLOB blob, int blobtype, int as_ephemeral) /* space where we write keyIDs and and other stuff so that the pointers can actually point to somewhere */ - if (blobtype == BLOBTYPE_PGP) + if (blobtype == KEYBOX_BLOBTYPE_PGP) { /* We need to store the keyids for all pgp v3 keys because those key IDs are not part of the fingerprint. While we are doing that, we @@ -611,7 +611,7 @@ create_blob_header (KEYBOXBLOB blob, int blobtype, int as_ephemeral) } } - if (blobtype == BLOBTYPE_X509) + if (blobtype == KEYBOX_BLOBTYPE_X509) { /* We don't want to point to ASN.1 encoded UserIDs (DNs) but to the utf-8 string represenation of them */ @@ -750,7 +750,7 @@ _keybox_create_openpgp_blob (KEYBOXBLOB *r_blob, init_membuf (&blob->bufbuf, 1024); blob->buf = &blob->bufbuf; - err = create_blob_header (blob, BLOBTYPE_PGP, as_ephemeral); + err = create_blob_header (blob, KEYBOX_BLOBTYPE_PGP, as_ephemeral); if (err) goto leave; err = pgp_create_blob_keyblock (blob, image, imagelen); @@ -937,7 +937,7 @@ _keybox_create_x509_blob (KEYBOXBLOB *r_blob, ksba_cert_t cert, init_membuf (&blob->bufbuf, 1024); blob->buf = &blob->bufbuf; /* write out what we already have */ - rc = create_blob_header (blob, BLOBTYPE_X509, as_ephemeral); + rc = create_blob_header (blob, KEYBOX_BLOBTYPE_X509, as_ephemeral); if (rc) goto leave; rc = x509_create_blob_cert (blob, cert); @@ -1031,7 +1031,7 @@ _keybox_get_blob_fileoffset (KEYBOXBLOB blob) void _keybox_update_header_blob (KEYBOXBLOB blob, int for_openpgp) { - if (blob->bloblen >= 32 && blob->blob[4] == BLOBTYPE_HEADER) + if (blob->bloblen >= 32 && blob->blob[4] == KEYBOX_BLOBTYPE_HEADER) { u32 val = make_timestamp (); |