(gpgsm_export): Make sure that we don't export more

than one certificate.
This commit is contained in:
Werner Koch 2004-03-03 08:55:50 +00:00
parent 58a722938b
commit 9008835d8a
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2004-03-03 Werner Koch <wk@gnupg.org>
* export.c (gpgsm_export): Make sure that we don't export more
than one certificate.
2004-03-02 Werner Koch <wk@gnupg.org>
* export.c (create_duptable, destroy_duptable)

View File

@ -44,7 +44,7 @@
#endif
/* A table tem to store a fingerprint used in a duplicates table. We
/* A table to store a fingerprint as used in a duplicates table. We
don't need to hash here because a fingerprint is alrady a perfect
hash value. This we use the most significant bits to index the
table and then use a linked list for the overflow. Possible
@ -105,8 +105,8 @@ insert_duptable (duptable_t *table, unsigned char *fpr, int *exists)
*exists = 0;
idx = fpr[0];
#if DUPTABLE_BITS > 16
#error cannot handle a table larger than 16 bits
#if DUPTABLE_BITS > 16 || DUPTABLE_BITS < 8
#error cannot handle a table larger than 16 bits or smaller than 8 bits
#elif DUPTABLE_BITS > 8
idx <<= (DUPTABLE_BITS - 8);
idx |= (fpr[1] & ~(~0 << 4));
@ -239,6 +239,14 @@ gpgsm_export (CTRL ctrl, STRLIST names, FILE *fp)
goto leave;
}
if (!exists && count && !ctrl->create_pem)
{
log_info ("exporting more than one certificate "
"is not possible in binary mode\n");
log_info ("ignoring other certificates\n");
break;
}
if (!exists)
{
const unsigned char *image;