aboutsummaryrefslogtreecommitdiffstats
path: root/sm/import.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2004-04-30 03:27:10 +0000
committerWerner Koch <[email protected]>2004-04-30 03:27:10 +0000
commit6d96ca16cfcd2c7ba3bdc45799875e2488b0f62d (patch)
tree972a076cfea02f41ccb35cf1efd08f0dcbb12d7f /sm/import.c
parentAdded more runtime flags for the gpg-agent (diff)
downloadgnupg-6d96ca16cfcd2c7ba3bdc45799875e2488b0f62d.tar.gz
gnupg-6d96ca16cfcd2c7ba3bdc45799875e2488b0f62d.zip
(check_and_store): Do not update the stats for hidden
imports of issuer certs.
Diffstat (limited to 'sm/import.c')
-rw-r--r--sm/import.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sm/import.c b/sm/import.c
index df080da9e..bbaa83b86 100644
--- a/sm/import.c
+++ b/sm/import.c
@@ -139,11 +139,13 @@ check_and_store (CTRL ctrl, struct stats_s *stats, ksba_cert_t cert, int depth)
{
int rc;
- stats->count++;
+ if (stats)
+ stats->count++;
if ( depth >= 50 )
{
log_error (_("certificate chain too long\n"));
- stats->not_imported++;
+ if (stats)
+ stats->not_imported++;
print_import_problem (ctrl, cert, 3);
return;
}
@@ -167,12 +169,14 @@ check_and_store (CTRL ctrl, struct stats_s *stats, ksba_cert_t cert, int depth)
if (!existed)
{
print_imported_status (ctrl, cert, 1);
- stats->imported++;
+ if (stats)
+ stats->imported++;
}
else
{
print_imported_status (ctrl, cert, 0);
- stats->unchanged++;
+ if (stats)
+ stats->unchanged++;
}
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
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))
{
- check_and_store (ctrl, stats, next, depth+1);
+ check_and_store (ctrl, NULL, next, depth+1);
ksba_cert_release (next);
}
}
else
{
log_error (_("error storing certificate\n"));
- stats->not_imported++;
+ if (stats)
+ stats->not_imported++;
print_import_problem (ctrl, cert, 4);
}
}
else
{
log_error (_("basic certificate checks failed - not imported\n"));
- stats->not_imported++;
+ if (stats)
+ stats->not_imported++;
print_import_problem (ctrl, cert,
gpg_err_code (rc) == GPG_ERR_MISSING_CERT? 2 :
gpg_err_code (rc) == GPG_ERR_BAD_CERT? 1 : 0);