[git] GpgOL - branch, STABLE-BRANCH-2-3, created. gpgol-2.3.0-4-g4b84e07

by Andre Heinecke cvs at cvs.gnupg.org
Thu Sep 6 12:01:16 CEST 2018


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, STABLE-BRANCH-2-3 has been created
        at  4b84e078d28ec572b9181009867d3c0555dee50c (commit)

- Log -----------------------------------------------------------------
commit 4b84e078d28ec572b9181009867d3c0555dee50c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Sep 6 11:54:34 2018 +0200

    Fallback to MAPI SubmitMessage if OOM Send fails
    
    * src/common.h (ERR_SEND_FALLBACK_FAILED): New error code.
    * src/windowmessages.cpp (gpgol_window_proc): Fallback to SubmitMessage
    on OOM Send failure.
    
    --
    This is a workaround for a strange case where the write
    in the send event fails. This happens for example if
    office documents are attached to a mail. In that
    case we can fallback to MAPI as we already do when
    Outlooks internal Sign / Encrypt is selected.
    Maybe we could be so bold as to always send over
    MAPI.
    
    GnuPG-Bug-Id: T4131
    (cherry picked from commit 8fb3524262283c77a91f7e6c615d97f426455332)

diff --git a/src/common.h b/src/common.h
index 52099fd..583a63a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -123,6 +123,7 @@ void i18n_init (void);
 #define ERR_WANTS_SEND_INLINE_BODY 3
 #define ERR_INLINE_BODY_TO_BODY 4
 #define ERR_INLINE_BODY_INV_STATE 5
+#define ERR_SEND_FALLBACK_FAILED 6
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index e9ec1e5..e0c5bab 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -163,10 +163,33 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                              SRCNAME, __func__, mail);
                 }
               // Finaly this should pass.
-              invoke_oom_method (mail->item (), "Send", NULL);
+              if (invoke_oom_method (mail->item (), "Send", NULL))
+                {
+                  log_error ("%s:%s: Send failed for %p. "
+                             "Trying SubmitMessage instead.",
+                             SRCNAME, __func__, mail);
+                  auto mail_message = get_oom_base_message (mail->item());
+                  // It's important we use the _base_ message here.
+                  mapi_save_changes (mail_message,
+                                     KEEP_OPEN_READWRITE | FORCE_SAVE);
+                  HRESULT hr = mail_message->SubmitMessage(0);
+                  gpgol_release (mail_message);
+
+                  if (hr == S_OK)
+                    {
+                      do_in_ui_thread_async (CLOSE, (LPVOID) mail);
+                    }
+                  else
+                    {
+                      log_error ("%s:%s: SubmitMessage Failed hr=0x%lx.",
+                                 SRCNAME, __func__, hr);
+                      gpgol_bug (mail->getWindow (),
+                                 ERR_SEND_FALLBACK_FAILED);
+                    }
+                }
               log_debug ("%s:%s:  Send for %p completed.",
                          SRCNAME, __func__, mail);
-              mail->releaseCurrentItem();
+              mail->releaseCurrentItem ();
               break;
             }
           case (BRING_TO_FRONT):

commit 5853c8e2fb99acd9355cf6d8f274a476984bc1fa
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Sep 6 10:25:40 2018 +0200

    Ignore temporary recipient resolve errors
    
    * src/cryptocontroller.cpp (CryptController::resolve_keys):
    Add unlikely error handling if recipients could not be resolved here.
    * src/mail.cpp (Mail::getRecipients_o): Ignore error when
    getting recipients.
    
    --
    When editing the recipients of a draft Outlook still has an
    recipient object for the former recipient but does not provide
    properties on it. So the address resolution fails. We can
    treat the mail as having no recipients and only have a
    fatal error if we can't resolve recipients in the cryptcontroller.
    
    GnuPG-Bug-Id: T4129
    (cherry picked from commit 3c0a66e402e84c0f8c5db4d2219eb8da6e5c0cac)

diff --git a/src/cryptcontroller.cpp b/src/cryptcontroller.cpp
index afeb24d..df35d70 100644
--- a/src/cryptcontroller.cpp
+++ b/src/cryptcontroller.cpp
@@ -420,6 +420,23 @@ CryptController::resolve_keys ()
 {
   m_recipients.clear();
 
+  if (!m_recipient_addrs.size())
+    {
+      /* Should not happen. But we add it for better bug reports. */
+      const char *bugmsg = utf8_gettext ("Operation failed.\n\n"
+              "This is usually caused by a bug in GpgOL or an error in your setup.\n"
+              "Please see https://www.gpg4win.org/reporting-bugs.html "
+              "or ask your Administrator for support.");
+      char *buf;
+      gpgrt_asprintf (&buf, "Failed to resolve recipients.\n\n%s\n", bugmsg);
+      memdbg_alloc (buf);
+      gpgol_message_box (get_active_hwnd (),
+                         buf,
+                         _("GpgOL"), MB_OK);
+      xfree(buf);
+      return -1;
+    }
+
   if (opt.autoresolve && !resolve_keys_cached ())
     {
       log_debug ("%s:%s: resolved keys through the cache",
diff --git a/src/mail.cpp b/src/mail.cpp
index 06f58cd..a3ec7ac 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1856,18 +1856,9 @@ Mail::getRecipients_o () const
 
   if (err)
     {
-      /* Should not happen. But we add it for better bug reports. */
-      const char *bugmsg = utf8_gettext ("Operation failed.\n\n"
-              "This is usually caused by a bug in GpgOL or an error in your setup.\n"
-              "Please see https://www.gpg4win.org/reporting-bugs.html "
-              "or ask your Administrator for support.");
-      char *buf;
-      gpgrt_asprintf (&buf, "Failed to resolve recipients.\n\n%s\n", bugmsg);
-      memdbg_alloc (buf);
-      gpgol_message_box (get_active_hwnd (),
-                         buf,
-                         _("GpgOL"), MB_OK);
-      xfree(buf);
+      log_debug ("%s:%s: Failed to resolve recipients at this time.",
+                 SRCNAME, __func__);
+
     }
 
   return ret;

commit 3db0bc6fb9474e0a746d99b63fca1613538feb04
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Sep 4 13:50:28 2018 +0200

    Rename autoresolveCheck to autosecureCheck
    
    * src/mail.cpp, src/mail.h (Mail::autoresolveCheck): Rename
    to autosecureCheck.
    (Mail::autsecureCheck): Also check for opt.autosecure.
    
    --
    This reduces confusing naming and ensures that when opt.autosecure
    is not set auto secure won't happen.
    
    GnuPG-Bug-Id: T4126
    (cherry picked from commit 3b770f928eb17fd876a00e85e7b384d566de2175)

diff --git a/src/mail.cpp b/src/mail.cpp
index d25b9d2..06f58cd 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -2807,7 +2807,7 @@ Mail::locateKeys_o ()
   KeyCache::instance()->startLocateSecret (getSender_o ().c_str (), this);
   KeyCache::instance()->startLocate (getSender_o ().c_str (), this);
   KeyCache::instance()->startLocate (getCachedRecipients (), this);
-  autoresolveCheck ();
+  autosecureCheck ();
 
   locate_in_progress = false;
 }
@@ -3374,14 +3374,14 @@ Mail::decrementLocateCount ()
     }
   if (!m_locate_count)
     {
-      autoresolveCheck ();
+      autosecureCheck ();
     }
 }
 
 void
-Mail::autoresolveCheck ()
+Mail::autosecureCheck ()
 {
-  if (!opt.autoresolve || m_manual_crypto_opts ||
+  if (!opt.autosecure || !opt.autoresolve || m_manual_crypto_opts ||
       m_locate_count)
     {
       return;
diff --git a/src/mail.h b/src/mail.h
index 7865336..44c15da 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -576,7 +576,7 @@ public:
   /* Check if the keys can be resolved automatically and trigger
    * setting the crypto flags accordingly.
    */
-  void autoresolveCheck ();
+  void autosecureCheck ();
 
   /* Set if a mail should be secured (encrypted and signed)
    *

commit aec234ee13ba6d4fd4f8c3f54e4cf6d0984bac72
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Sep 4 13:47:04 2018 +0200

    Fix Mail::needs_crypto_m
    
    * src/mail.cpp (Mail::needs_crypto_m): Fix function.
    
    --
    It would always return 1 if any crypto was required. This
    had a side effect like:
    
    GnuPG-Bug-Id: T4126
    (cherry picked from commit a507d8bdfb9e31814abf21ad5a9915abd66c96c1)

diff --git a/src/mail.cpp b/src/mail.cpp
index 04d0b8e..d25b9d2 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1519,7 +1519,7 @@ int
 Mail::needs_crypto_m () const
 {
   LPMESSAGE message = get_oom_message (m_mailitem);
-  bool ret;
+  int ret;
   if (!message)
     {
       log_error ("%s:%s: Failed to get message.",

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


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




More information about the Gnupg-commits mailing list