mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-17 14:07:03 +01:00
2008-01-29 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (list_internal_keys): New variable lastcert. Use it to suppress duplicates which immediately follow each other.
This commit is contained in:
parent
3d654dfb29
commit
8ac61bc708
@ -1,3 +1,8 @@
|
||||
2008-01-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* keylist.c (list_internal_keys): New variable lastcert. Use it
|
||||
to suppress duplicates which immediately follow each other.
|
||||
|
||||
2008-01-27 Werner Koch <wk@g10code.com>
|
||||
|
||||
* import.c (popen_protect_tool): Set bit 7 in the flags for
|
||||
|
15
sm/keylist.c
15
sm/keylist.c
@ -1171,6 +1171,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp,
|
||||
strlist_t sl;
|
||||
int ndesc;
|
||||
ksba_cert_t cert = NULL;
|
||||
ksba_cert_t lastcert = NULL;
|
||||
gpg_error_t rc = 0;
|
||||
const char *lastresname, *resname;
|
||||
int have_secret;
|
||||
@ -1228,6 +1229,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp,
|
||||
currently we stop at the first match. To do this we need an
|
||||
extra flag to enable this feature so */
|
||||
|
||||
/* Suppress duplicates at least when they follow each other. */
|
||||
lastresname = NULL;
|
||||
while (!(rc = keydb_search (hd, desc, ndesc)))
|
||||
{
|
||||
@ -1248,6 +1250,14 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp,
|
||||
log_error ("keydb_get_cert failed: %s\n", gpg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
/* Skip duplicated certificates, at least if they follow each
|
||||
others. This works best if a single key is searched for and
|
||||
expected. FIXME: Non-sequential duplicates remain. */
|
||||
if (gpgsm_certs_identical_p (cert, lastcert))
|
||||
{
|
||||
ksba_cert_release (cert);
|
||||
continue;
|
||||
}
|
||||
|
||||
resname = keydb_get_resource_name (hd);
|
||||
|
||||
@ -1301,7 +1311,9 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp,
|
||||
es_putc ('\n', fp);
|
||||
}
|
||||
}
|
||||
ksba_cert_release (cert);
|
||||
|
||||
ksba_cert_release (lastcert);
|
||||
lastcert = cert;
|
||||
cert = NULL;
|
||||
}
|
||||
if (gpg_err_code (rc) == GPG_ERR_EOF || rc == -1 )
|
||||
@ -1311,6 +1323,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp,
|
||||
|
||||
leave:
|
||||
ksba_cert_release (cert);
|
||||
ksba_cert_release (lastcert);
|
||||
xfree (desc);
|
||||
keydb_release (hd);
|
||||
return rc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user