gpg: Allow import of large keys.

* g10/import.c (import): Skip too large keys.
* kbx/keybox-file.c (IMAGELEN_LIMIT): Change limit from 2MB to 5MB.
--

The key which triggered the problem was 0x57930DAB0B86B067.  With this
patch it can be imported.  Keys larger than the now increased limit of
5MB will are skipped and the already existing not_imported counter is
bumped up.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2014-12-04 10:53:10 +01:00
parent 2d37e0c800
commit 63e7891f0f
3 changed files with 16 additions and 4 deletions

2
NEWS
View File

@ -26,6 +26,8 @@ Noteworthy changes in version 2.1.1 (unreleased)
* gpg: Removed the option aliases --throw-keyid and --notation-data;
use --throw-keyids and --set-notation instead.
* gpg: Skip too large keys during import.
Noteworthy changes in version 2.1.0 (2014-11-06)
------------------------------------------------

View File

@ -341,10 +341,20 @@ import (ctrl_t ctrl, IOBUF inp, const char* fname,struct stats_s *stats,
log_info (_("skipping block of type %d\n"), keyblock->pkt->pkttype);
}
release_kbnode (keyblock);
/* fixme: we should increment the not imported counter but this
does only make sense if we keep on going despite of errors. */
if (rc)
/* fixme: we should increment the not imported counter but
this does only make sense if we keep on going despite of
errors. For now we do this only if the imported key is too
large. */
if (gpg_err_code (rc) == GPG_ERR_TOO_LARGE
&& gpg_err_source (rc) == GPG_ERR_SOURCE_KEYBOX)
{
stats->not_imported++;
rc = 0;
}
else if (rc)
break;
if (!(++stats->count % 100) && !opt.quiet)
log_info (_("%lu keys processed so far\n"), stats->count );
}

View File

@ -27,7 +27,7 @@
#include "keybox-defs.h"
#define IMAGELEN_LIMIT (2*1024*1024)
#define IMAGELEN_LIMIT (5*1024*1024)
#if !defined(HAVE_FTELLO) && !defined(ftello)