diff options
author | Werner Koch <[email protected]> | 2014-10-09 19:01:49 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-10-09 19:01:49 +0000 |
commit | 2ca90f78cee91c43b8d538d1cb92728f8e1452d5 (patch) | |
tree | 2690fc51434a88b781e8efa836c72d51215fc42d /g10/keydb.c | |
parent | gpg: Sync keylist output and warning messages. (diff) | |
download | gnupg-2ca90f78cee91c43b8d538d1cb92728f8e1452d5.tar.gz gnupg-2ca90f78cee91c43b8d538d1cb92728f8e1452d5.zip |
gpg: Skip overlong keys and a print a warning.
* kbx/keybox-search.c (keybox_search): Add arg r_skipped and skip too
long blobs.
* sm/keydb.c (keydb_search): Call keybox_search with a dummy param.
* g10/keydb.c (struct keydb_handle): Add field skipped_long_blobs.
(keydb_search_reset): Reset that field.
(keydb_search): Update that field.
(keydb_get_skipped_counter): New.
* g10/keylist.c (list_all): Print count of skipped keys.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/keydb.c')
-rw-r--r-- | g10/keydb.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/g10/keydb.c b/g10/keydb.c index a38795120..a9a975378 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -67,6 +67,7 @@ struct keydb_handle { int locked; int found; + unsigned long skipped_long_blobs; int current; int used; /* Number of items in ACTIVE. */ struct resource_item active[MAX_KEYDB_RESOURCES]; @@ -1289,6 +1290,13 @@ keydb_rebuild_caches (int noisy) } +/* Return the number of skipped blocks since the last search reset. */ +unsigned long +keydb_get_skipped_counter (KEYDB_HANDLE hd) +{ + return hd ? hd->skipped_long_blobs : 0; +} + /* * Start the next search on this handle right at the beginning @@ -1307,6 +1315,7 @@ keydb_search_reset (KEYDB_HANDLE hd) if (DBG_CLOCK) log_clock ("keydb_search_reset"); + hd->skipped_long_blobs = 0; hd->current = 0; hd->found = -1; /* Now reset all resources. */ @@ -1424,7 +1433,7 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, break; case KEYDB_RESOURCE_TYPE_KEYBOX: rc = keybox_search (hd->active[hd->current].u.kb, desc, - ndesc, descindex); + ndesc, descindex, &hd->skipped_long_blobs); break; } if (rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF) |