diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-05-18 00:35:21 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-05-18 00:35:21 +0800 |
commit | 8e66c5869a2e84fd4a9e58ddb15afb343103a350 (patch) | |
tree | 47181d18668f0bda422edd87c3680d365fa70633 /camel | |
parent | 4b325fcbdd32f272213ab7de1e0bc95ca7b922bc (diff) | |
download | gsoc2013-evolution-8e66c5869a2e84fd4a9e58ddb15afb343103a350.tar.gz gsoc2013-evolution-8e66c5869a2e84fd4a9e58ddb15afb343103a350.tar.zst gsoc2013-evolution-8e66c5869a2e84fd4a9e58ddb15afb343103a350.zip |
If the encrypted block was also signed, set the signature verification
2004-05-17 Jeffrey Stedfast <fejj@novell.com>
* camel-gpg-context.c (gpg_decrypt): If the encrypted block was
also signed, set the signature verification status on the Validity
structure as well.
svn path=/trunk/; revision=25928
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 6 | ||||
-rw-r--r-- | camel/camel-gpg-context.c | 45 |
2 files changed, 43 insertions, 8 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 3f170b2d74..fc6cd48923 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2004-05-17 Jeffrey Stedfast <fejj@novell.com> + + * camel-gpg-context.c (gpg_decrypt): If the encrypted block was + also signed, set the signature verification status on the Validity + structure as well. + 2004-05-17 Not Zed <NotZed@Ximian.com> ** Bug #56050. diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c index 81e84cbc6f..5e3632cbe1 100644 --- a/camel/camel-gpg-context.c +++ b/camel/camel-gpg-context.c @@ -208,6 +208,10 @@ struct _GpgCtx { unsigned int bad_passwds:2; + unsigned int hadsig:1; + unsigned int badsig:1; + unsigned int errsig:1; + unsigned int goodsig:1; unsigned int validsig:1; unsigned int nopubkey:1; unsigned int trust:3; @@ -216,7 +220,7 @@ struct _GpgCtx { unsigned int utf8:1; - unsigned int padding:15; + unsigned int padding:11; }; static struct _GpgCtx * @@ -261,6 +265,10 @@ gpg_ctx_new (CamelSession *session) gpg->need_id = NULL; gpg->passwd = NULL; + gpg->hadsig = FALSE; + gpg->badsig = FALSE; + gpg->errsig = FALSE; + gpg->goodsig = FALSE; gpg->validsig = FALSE; gpg->nopubkey = FALSE; gpg->trust = GPG_TRUST_NONE; @@ -830,14 +838,19 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex) } else if (!strncmp (status, "UNDEFINED", 9)) { gpg->trust = GPG_TRUST_UNDEFINED; } - } else if (!strncmp (status, "VALIDSIG", 8)) { + } else if (!strncmp (status, "GOODSIG ", 8)) { + gpg->goodsig = TRUE; + gpg->hadsig = TRUE; + } else if (!strncmp (status, "VALIDSIG ", 9)) { gpg->validsig = TRUE; - } else if (!strncmp (status, "BADSIG", 6)) { - gpg->validsig = FALSE; - } else if (!strncmp (status, "ERRSIG", 6)) { + } else if (!strncmp (status, "BADSIG ", 7)) { + gpg->badsig = FALSE; + gpg->hadsig = TRUE; + } else if (!strncmp (status, "ERRSIG ", 7)) { /* Note: NO_PUBKEY often comes after an ERRSIG */ - gpg->validsig = FALSE; - } else if (!strncmp (status, "NO_PUBKEY", 9)) { + gpg->errsig = FALSE; + gpg->hadsig = TRUE; + } else if (!strncmp (status, "NO_PUBKEY ", 10)) { gpg->nopubkey = TRUE; } break; @@ -1647,11 +1660,27 @@ gpg_decrypt(CamelCipherContext *context, CamelMimePart *ipart, CamelMimePart *op valid = camel_cipher_validity_new(); valid->encrypt.description = g_strdup(_("Encrypted content")); valid->encrypt.status = CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED; + + if (gpg->hadsig) { + if (gpg->validsig) { + if (gpg->trust == GPG_TRUST_UNDEFINED || gpg->trust == GPG_TRUST_NONE) + valid->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN; + else if (gpg->trust != GPG_TRUST_NEVER) + valid->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_GOOD; + else + valid->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_BAD; + } else if (gpg->nopubkey) { + valid->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN; + } else { + valid->sign.status = CAMEL_CIPHER_VALIDITY_SIGN_BAD; + } + } } else { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Unable to parse message content")); } -fail: + + fail: camel_object_unref(ostream); camel_object_unref(istream); gpg_ctx_free (gpg); |