(check_and_store): Do not update the stats for hidden

imports of issuer certs.
This commit is contained in:
Werner Koch 2004-04-30 03:27:10 +00:00
parent 93e9f9aedd
commit 6d96ca16cf
2 changed files with 20 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2004-04-30 Werner Koch <wk@gnupg.org>
* import.c (check_and_store): Do not update the stats for hidden
imports of issuer certs.
2004-04-28 Werner Koch <wk@gnupg.org> 2004-04-28 Werner Koch <wk@gnupg.org>
* gpgsm.c: New command --keydb-clear-some-cert-flags. * gpgsm.c: New command --keydb-clear-some-cert-flags.

View File

@ -139,11 +139,13 @@ check_and_store (CTRL ctrl, struct stats_s *stats, ksba_cert_t cert, int depth)
{ {
int rc; int rc;
stats->count++; if (stats)
stats->count++;
if ( depth >= 50 ) if ( depth >= 50 )
{ {
log_error (_("certificate chain too long\n")); log_error (_("certificate chain too long\n"));
stats->not_imported++; if (stats)
stats->not_imported++;
print_import_problem (ctrl, cert, 3); print_import_problem (ctrl, cert, 3);
return; return;
} }
@ -167,12 +169,14 @@ check_and_store (CTRL ctrl, struct stats_s *stats, ksba_cert_t cert, int depth)
if (!existed) if (!existed)
{ {
print_imported_status (ctrl, cert, 1); print_imported_status (ctrl, cert, 1);
stats->imported++; if (stats)
stats->imported++;
} }
else else
{ {
print_imported_status (ctrl, cert, 0); print_imported_status (ctrl, cert, 0);
stats->unchanged++; if (stats)
stats->unchanged++;
} }
if (opt.verbose > 1 && existed) if (opt.verbose > 1 && existed)
@ -192,24 +196,27 @@ check_and_store (CTRL ctrl, struct stats_s *stats, ksba_cert_t cert, int depth)
/* Now lets walk up the chain and import all certificates up /* Now lets walk up the chain and import all certificates up
the chain. This is required in case we already stored the chain. This is required in case we already stored
parent certificates in the ephemeral keybox. */ parent certificates in the ephemeral keybox. Do not
update the statistics, though. */
if (!gpgsm_walk_cert_chain (cert, &next)) if (!gpgsm_walk_cert_chain (cert, &next))
{ {
check_and_store (ctrl, stats, next, depth+1); check_and_store (ctrl, NULL, next, depth+1);
ksba_cert_release (next); ksba_cert_release (next);
} }
} }
else else
{ {
log_error (_("error storing certificate\n")); log_error (_("error storing certificate\n"));
stats->not_imported++; if (stats)
stats->not_imported++;
print_import_problem (ctrl, cert, 4); print_import_problem (ctrl, cert, 4);
} }
} }
else else
{ {
log_error (_("basic certificate checks failed - not imported\n")); log_error (_("basic certificate checks failed - not imported\n"));
stats->not_imported++; if (stats)
stats->not_imported++;
print_import_problem (ctrl, cert, print_import_problem (ctrl, cert,
gpg_err_code (rc) == GPG_ERR_MISSING_CERT? 2 : gpg_err_code (rc) == GPG_ERR_MISSING_CERT? 2 :
gpg_err_code (rc) == GPG_ERR_BAD_CERT? 1 : 0); gpg_err_code (rc) == GPG_ERR_BAD_CERT? 1 : 0);