mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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>
This commit is contained in:
parent
28ae8ad70b
commit
935edf88ab
9 changed files with 61 additions and 51 deletions
|
@ -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 ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue