[evolution-data-server] CamelGpgContext: Report decrypt error only if no data was decrypted



commit 8541c66506f1c50e8d8d1cf1957832955579d346
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 16 16:15:05 2013 +0200

    CamelGpgContext: Report decrypt error only if no data was decrypted
    
    When there is a message which is both signed and encrypted in once,
    the gpg checks also signature of the sender, and if the sender's key
    is not available between user's keys, or it's not trusted, or
    the signature is otherwise incorrect, then the gpg returns failure,
    which caused no data returned, though the decrypt itself worked
    flawlessly.

 camel/camel-gpg-context.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 0a9397f..200bc21 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -2126,7 +2126,11 @@ gpg_decrypt_sync (CamelCipherContext *context,
                }
        }
 
-       if (gpg_ctx_op_wait (gpg) != 0) {
+       /* Report errors only if nothing was decrypted; missing sender's key used
+          for signature of a signed and encrypted messages causes GPG to return
+          failure, thus count with it.
+        */
+       if (gpg_ctx_op_wait (gpg) != 0 && gpg->nodata) {
                const gchar *diagnostics;
 
                diagnostics = gpg_ctx_get_diagnostics (gpg);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]