From 85425c74ad28b801687babd964cf3e9847d0f497 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 29 Apr 2003 20:50:15 +0000 Subject: [PATCH] 2003-04-29 Marcus Brinkmann * verify.c (calc_sig_summary): Do not set GPGME_SIGSUM_SYS_ERROR for bad signatures. --- gpgme/ChangeLog | 5 +++++ gpgme/verify.c | 41 ++++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 4634a6d..944dc83 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2003-04-29 Marcus Brinkmann + + * verify.c (calc_sig_summary): Do not set GPGME_SIGSUM_SYS_ERROR + for bad signatures. + 2003-04-28 Marcus Brinkmann * context.h: Remove OPDATA_VERIFY_COLLECTING. diff --git a/gpgme/verify.c b/gpgme/verify.c index 85854cd..42341e0 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -108,25 +108,28 @@ calc_sig_summary (GpgmeSignature sig) sum |= GPGME_SIGSUM_RED; /* FIXME: handle the case when key and message are expired. */ - if (sig->status == GPGME_Sig_Expired) - sum |= GPGME_SIGSUM_SIG_EXPIRED; - else if (sig->status == GPGME_Key_Expired) - sum |= GPGME_SIGSUM_KEY_EXPIRED; - else if (sig->status == GPGME_No_Public_Key) - sum |= GPGME_SIGSUM_KEY_MISSING; - else if (sig->status) - sum |= GPGME_SIGSUM_SYS_ERROR; - - if (sig->validity_reason == GPGME_Key_Revoked) - sum |= GPGME_SIGSUM_KEY_REVOKED; - else if (sig->validity_reason == GPGME_No_CRL_Known) - sum |= GPGME_SIGSUM_CRL_MISSING; - else if (sig->validity_reason == GPGME_CRL_Too_Old) - sum |= GPGME_SIGSUM_CRL_TOO_OLD; - else if (sig->validity_reason == GPGME_Policy_Mismatch) - sum |= GPGME_SIGSUM_BAD_POLICY; - else if (sig->validity_reason) - sum |= GPGME_SIGSUM_SYS_ERROR; + switch (sig->status) + { + case GPGME_Sig_Expired: + sum |= GPGME_SIGSUM_SIG_EXPIRED; + break; + + case GPGME_Key_Expired: + sum |= GPGME_SIGSUM_KEY_EXPIRED; + break; + + case GPGME_No_Public_Key: + sum |= GPGME_SIGSUM_KEY_MISSING; + break; + + case GPGME_Bad_Signature: + case GPGME_No_Error: + break; + + default: + sum |= GPGME_SIGSUM_SYS_ERROR; + break; + } if (sig->wrong_key_usage) sum |= GPGME_SIGSUM_BAD_POLICY; -- 2.26.2