[git] GpgOL - branch, master, updated. gpgol-2.0.3-8-gc96f484

by Andre Heinecke cvs at cvs.gnupg.org
Mon Nov 27 10:52:18 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  c96f484c79a57b7e2f5dd3aecae71dae198c0467 (commit)
       via  3f49889ab026ea87d945db1a14b2b0289a1ddb07 (commit)
      from  c31d8cdb40af660f020be5161dcbb0f90728ec0f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c96f484c79a57b7e2f5dd3aecae71dae198c0467
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Nov 27 10:48:32 2017 +0100

    Improve error handling for signed only
    
    * src/mail.cpp (Mail::get_crypto_details): Add msg for
    verification error.
    * src/ribbon-callbacks.cpp (get_sig_stip): Get mails
    details for failed verification results.
    
    --
    In the details we can show the error. This might help
    with bug reports.
    
    GnuPG-Bug-Id: T3538

diff --git a/src/mail.cpp b/src/mail.cpp
index d5b6610..00b6a3d 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1802,13 +1802,26 @@ std::string
 Mail::get_crypto_details()
 {
   std::string message;
-  /* Handle encrypt only */
+
+  /* No signature with keys but error */
+  if (!is_encrypted() && !is_signed () && m_verify_result.error())
+    {
+      message = _("You cannot be sure who sent, "
+                  "modified and read the message in transit.");
+      message += "\n\n";
+      message += _("The message was signed but the verification failed with:");
+      message += "\n";
+      message += m_verify_result.error().asString();
+      return message;
+    }
+  /* No crypo, what are we doing here? */
   if (!is_encrypted () && !is_signed ())
     {
       return _("You cannot be sure who sent, "
                "modified and read the message in transit.");
     }
-  else if (is_encrypted() && !is_signed ())
+  /* Handle encrypt only */
+  if (is_encrypted() && !is_signed ())
     {
       if (in_de_vs_mode ())
        {
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 5af1215..8470db2 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1645,7 +1645,7 @@ HRESULT get_sig_stip (LPDISPATCH ctrl, VARIANT *result)
       result->bstrVal = SysAllocString (L"");
       return S_OK;
     }
-  if (!mail || (!mail->is_signed () && !mail->is_encrypted ()))
+  if (!mail || !mail->is_crypto_mail ())
     {
       wchar_t *w_result;
       w_result = utf8_to_wchar (utf8_gettext ("You cannot be sure who sent, "

commit 3f49889ab026ea87d945db1a14b2b0289a1ddb07
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Nov 27 10:46:38 2017 +0100

    Restore body on verification error
    
    * src/mail.cpp (Mail::update_body): Restore body if verify
    fails.
    (Mail::decrypt_verify): Save original body.
    
    --
    If there is an error during verification we should not
    "eat" the body. Mostly this will be a technical error
    and as we show the result as "insecure" this should
    be ok.
    
    GnuPG-Bug-Id: T3538

diff --git a/src/mail.cpp b/src/mail.cpp
index 626809c..d5b6610 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -725,6 +725,7 @@ Mail::decrypt_verify()
 
   if (opt.prefer_html)
     {
+      m_orig_body = get_oom_string (m_mailitem, "HTMLBody");
       if (put_oom_string (m_mailitem, "HTMLBody", placeholder_buf))
         {
           log_error ("%s:%s: Failed to modify html body of item.",
@@ -733,6 +734,7 @@ Mail::decrypt_verify()
     }
   else
     {
+      m_orig_body = get_oom_string (m_mailitem, "Body");
       if (put_oom_string (m_mailitem, "Body", placeholder_buf))
         {
           log_error ("%s:%s: Failed to modify body of item.",
@@ -806,6 +808,30 @@ Mail::update_body()
         }
       return;
     }
+  if (m_verify_result.error())
+    {
+      log_error ("%s:%s: Verification failed. Restoring Body.",
+                 SRCNAME, __func__);
+      if (opt.prefer_html)
+        {
+          if (put_oom_string (m_mailitem, "HTMLBody", m_orig_body.c_str ()))
+            {
+              log_error ("%s:%s: Failed to modify html body of item.",
+                         SRCNAME, __func__);
+            }
+        }
+      else
+        {
+          if (put_oom_string (m_mailitem, "Body", m_orig_body.c_str ()))
+            {
+              log_error ("%s:%s: Failed to modify html body of item.",
+                         SRCNAME, __func__);
+            }
+        }
+      return;
+    }
+  // No need to carry body anymore
+  m_orig_body = std::string();
   auto html = m_parser->get_html_body ();
   /** Outlook does not show newlines if \r\r\n is a newline. We replace
     these as apparently some other buggy MUA sends this. */
diff --git a/src/mail.h b/src/mail.h
index e497190..3885f34 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -354,5 +354,6 @@ private:
   GpgME::Signature m_sig;
   GpgME::UserID m_uid;
   std::string m_uuid;
+  std::string m_orig_body;
 };
 #endif // MAIL_H

-----------------------------------------------------------------------

Summary of changes:
 src/mail.cpp             | 43 +++++++++++++++++++++++++++++++++++++++++--
 src/mail.h               |  1 +
 src/ribbon-callbacks.cpp |  2 +-
 3 files changed, 43 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list