[git] GpgOL - branch, master, updated. gpgol-1.4.0-211-g209490b

by Andre Heinecke cvs at cvs.gnupg.org
Mon Dec 5 17:44:29 CET 2016


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  209490bfa1054e52ffed0a3fc01182ec213486a7 (commit)
       via  2424a72898912287b8dcde2c23536e7a2a191949 (commit)
       via  07e6004ae619f61dc4f8d71eb8b69ebb659edbe5 (commit)
       via  6749896725f84c0c11feb278399d8e02afd9b83f (commit)
       via  3c221f684b1407f03efb38bf9dfeec9c4f7d9c1a (commit)
       via  38f98dfeb754ad4992c86ab295415c5346ca7bb6 (commit)
       via  c774a46f5b59bc811452e643492d7fdddf933213 (commit)
      from  b527d97b06c684bc00df3023407c60c4338a71ec (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 209490bfa1054e52ffed0a3fc01182ec213486a7
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Dec 5 17:43:43 2016 +0100

    Fix multipart/alternative html mails
    
    * src/mimemaker.cpp (add_body_and_attachments): Properly
    handle the case when inner and outer boundary is null.

diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp
index 18bc271..dbed524 100644
--- a/src/mimemaker.cpp
+++ b/src/mimemaker.cpp
@@ -1366,6 +1366,8 @@ add_body_and_attachments (sink_t sink, LPMESSAGE message,
   int rc = 0;
   char inner_boundary[BOUNDARYSIZE+1];
   char outer_boundary[BOUNDARYSIZE+1];
+  *outer_boundary = 0;
+  *inner_boundary = 0;
 
   if (((body && n_att_usable) || n_att_usable > 1) && related == 1)
     {
@@ -1386,10 +1388,8 @@ add_body_and_attachments (sink_t sink, LPMESSAGE message,
                                  NULL)))
         return rc;
     }
-  else
-  /* Only one part.  */
-    *outer_boundary = 0;
 
+  /* Only one part.  */
   if (*outer_boundary && related == 2)
     {
       /* We have attachments that are related to the body and unrelated
@@ -1407,13 +1407,10 @@ add_body_and_attachments (sink_t sink, LPMESSAGE message,
           return rc;
         }
     }
-  else
-    {
-      *inner_boundary = 0;
-    }
 
 
-  if ((rc=add_body (mail, *inner_boundary ? inner_boundary : outer_boundary,
+  if ((rc=add_body (mail, *inner_boundary ? inner_boundary :
+                          *outer_boundary ? outer_boundary : NULL,
                     sink, body)))
     {
       log_error ("%s:%s: Adding the body failed.",

commit 2424a72898912287b8dcde2c23536e7a2a191949
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Dec 5 17:42:00 2016 +0100

    Use MAPI message for mapi_get_uid
    
    * src/mapihelp.cpp, src/mapihelp.h (mapi_get_message):
    Change to take message as argument.
    * src/ribbon-callbacks.cpp (get_mail_from_control): Update usage.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index 8b0c45a..92def26 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -292,31 +292,28 @@ get_gpgoluid_tag (LPMESSAGE message, ULONG *r_tag)
 }
 
 char *
-mapi_get_uid (LPDISPATCH mail)
+mapi_get_uid (LPMESSAGE msg)
 {
   /* If the UUID is not in OOM maybe we find it in mapi. */
-  LPMESSAGE msg = get_oom_base_message (mail);
   if (!msg)
     {
-      log_debug ("%s:%s: Failed to get message for '%p'",
-                 SRCNAME, __func__, mail);
-      gpgol_release (msg);
+      log_error ("%s:%s: Called without message",
+                 SRCNAME, __func__);
+      return NULL;
     }
   ULONG tag;
   if (get_gpgoluid_tag (msg, &tag))
     {
       log_debug ("%s:%s: Failed to get tag for '%p'",
-                 SRCNAME, __func__, mail);
-      gpgol_release (msg);
+                 SRCNAME, __func__, msg);
       return NULL;
     }
   LPSPropValue propval = NULL;
   HRESULT hr = HrGetOneProp ((LPMAPIPROP)msg, tag, &propval);
-  gpgol_release (msg);
   if (hr)
     {
       log_debug ("%s:%s: Failed to get prop for '%p'",
-                 SRCNAME, __func__, mail);
+                 SRCNAME, __func__, msg);
       return NULL;
     }
   char *ret = NULL;
@@ -324,13 +321,13 @@ mapi_get_uid (LPDISPATCH mail)
     {
       ret = wchar_to_utf8 (propval->Value.lpszW);
       log_debug ("%s:%s: Fund uuid in MAPI for %p",
-                 SRCNAME, __func__, mail);
+                 SRCNAME, __func__, msg);
     }
   else if (PROP_TYPE (propval->ulPropTag) == PT_STRING8)
     {
       ret = strdup (propval->Value.lpszA);
       log_debug ("%s:%s: Fund uuid in MAPI for %p",
-                 SRCNAME, __func__, mail);
+                 SRCNAME, __func__, msg);
     }
   MAPIFreeBuffer (propval);
   return ret;
diff --git a/src/mapihelp.h b/src/mapihelp.h
index 9bcd58f..4985d58 100644
--- a/src/mapihelp.h
+++ b/src/mapihelp.h
@@ -131,7 +131,8 @@ int mapi_mark_or_create_moss_attach (LPMESSAGE message, msgtype_t msgtype);
 /* Copy the MAPI body to a PGPBODY type attachment. */
 int mapi_body_to_attachment (LPMESSAGE message);
 
-char * mapi_get_uid (LPDISPATCH mail);
+/* Get malloced uid of a message */
+char * mapi_get_uid (LPMESSAGE message);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 374885d..f14f43b 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1468,7 +1468,9 @@ get_mail_from_control (LPDISPATCH ctrl)
   uid = get_unique_id (mailitem, 0, nullptr);
   if (!uid)
     {
-      uid = mapi_get_uid (mailitem);
+      LPMESSAGE msg = get_oom_base_message (mailitem);
+      uid = mapi_get_uid (msg);
+      gpgol_release (msg);
       if (!uid)
         {
           log_debug ("%s:%s: Failed to get uid for %p",

commit 07e6004ae619f61dc4f8d71eb8b69ebb659edbe5
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Dec 5 17:21:23 2016 +0100

    Mention srcname / func in debug of invalidation
    
    * src/gpgoladdin.cpp (gpgoladdin_invalidate_ui): Put srcname
    and func in debug.
    
    --
    Makes debug output easier to read.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index d291ab4..3b26107 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -1298,7 +1298,8 @@ void gpgoladdin_invalidate_ui ()
 
   for (it = g_ribbon_uis.begin(); it != g_ribbon_uis.end(); ++it)
     {
-      log_debug ("Invalidating ribbon: %p", *it);
+      log_debug ("%s:%s: Invalidating ribbon: %p",
+                 SRCNAME, __func__, *it);
       invoke_oom_method (*it, "Invalidate", NULL);
     }
 }

commit 6749896725f84c0c11feb278399d8e02afd9b83f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Dec 5 17:19:50 2016 +0100

    Prepare OOM Event handler for OL 2007
    
    * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Set uuid
    on Open and pre_process in Read for OL 2007.

diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 110f7ce..b6ad311 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -128,6 +128,16 @@ EVENT_SINK_INVOKE(MailItemEvents)
           log_oom_extra ("%s:%s: Open : %p",
                          SRCNAME, __func__, m_mail);
           LPMESSAGE message;
+          if (g_ol_version_major < 14 && m_mail->set_uuid ())
+            {
+              /* In Outlook 2007 we need the uid for every
+                 open mail to track the message in case
+                 it is sent and crypto is required. */
+              log_debug ("%s:%s: Failed to set uuid.",
+                         SRCNAME, __func__);
+              delete m_mail; /* deletes this, too */
+              return S_OK;
+            }
           int draft_flags = 0;
           if (!opt.encrypt_default && !opt.sign_default)
             {
@@ -165,6 +175,20 @@ EVENT_SINK_INVOKE(MailItemEvents)
         }
       case Read:
         {
+          if (g_ol_version_major < 14)
+            {
+              /* In Outlook 2007 there is no Before read event.
+                 We change the message class in message-events to
+                 prevent that outlook parses the mail itself but
+                 we still need to update our mail object accordingly.
+                 So we call pre_process here gain although the message
+                 class already was changed. */
+              if (m_mail->pre_process_message ())
+                {
+                  log_error ("%s:%s: Pre process message failed.",
+                             SRCNAME, __func__);
+                }
+            }
           log_oom_extra ("%s:%s: Read : %p",
                          SRCNAME, __func__, m_mail);
           if (!m_mail->is_crypto_mail())

commit 3c221f684b1407f03efb38bf9dfeec9c4f7d9c1a
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Dec 5 17:17:54 2016 +0100

    Add send_seen as member variable to Mail object
    
    * src/mail.cpp, src/mail.h (Mail::needs_encrypt),
    (Mail::set_needs_encrypt): New.
    * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Use new functions.
    
    --
    This puts the last state variable from the event handler into
    the Mail object. It will be needed to Support Outlook 2007
    where we have two event handlers.

diff --git a/src/mail.cpp b/src/mail.cpp
index 162b817..395c75a 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -77,6 +77,7 @@ Mail::Mail (LPDISPATCH mailitem) :
     m_is_valid(false),
     m_close_triggered(false),
     m_is_html_alternative(false),
+    m_needs_encrypt(false),
     m_moss_position(0),
     m_crypto_flags(0),
     m_type(MSGTYPE_UNKNOWN)
@@ -1720,3 +1721,15 @@ Mail::get_crypto_flags () const
 {
   return m_crypto_flags;
 }
+
+void
+Mail::set_needs_encrypt (bool value)
+{
+  m_needs_encrypt = value;
+}
+
+bool
+Mail::needs_encrypt() const
+{
+  return m_needs_encrypt;
+}
diff --git a/src/mail.h b/src/mail.h
index 680ea1c..340b7e3 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -304,6 +304,11 @@ public:
       Only valid after decrypt_verify.
   */
   int get_crypto_flags () const;
+
+  /** Returns true if the mail should be encrypted in the
+      after write event. */
+  bool needs_encrypt () const;
+  void set_needs_encrypt (bool val);
 private:
   void update_categories ();
   void update_body ();
@@ -320,7 +325,8 @@ private:
        m_is_signed, /* Mail is signed */
        m_is_valid, /* Mail is valid signed. */
        m_close_triggered, /* We have programtically triggered a close */
-       m_is_html_alternative; /* Body Format is not plain text */
+       m_is_html_alternative, /* Body Format is not plain text */
+       m_needs_encrypt; /* Send was triggered we want to encrypt. */
   int m_moss_position; /* The number of the original message attachment. */
   int m_crypto_flags;
   std::string m_sender;
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 4ae4ec3..110f7ce 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -79,7 +79,6 @@ BEGIN_EVENT_SINK(MailItemEvents, IDispatch)
 
 private:
   Mail * m_mail; /* The mail object related to this mailitem */
-  bool m_send_seen;   /* The message is about to be submitted */
 };
 
 MailItemEvents::MailItemEvents() :
@@ -87,8 +86,7 @@ MailItemEvents::MailItemEvents() :
     m_pCP(NULL),
     m_cookie(0),
     m_ref(1),
-    m_mail(NULL),
-    m_send_seen (false)
+    m_mail(NULL)
 {
 }
 
@@ -307,13 +305,12 @@ EVENT_SINK_INVOKE(MailItemEvents)
              break;
            }
           m_mail->update_oom_data ();
-          m_send_seen = true;
+          m_mail->set_needs_encrypt (true);
           invoke_oom_method (m_object, "Save", NULL);
           if (m_mail->crypto_successful ())
             {
                log_debug ("%s:%s: Passing send event for message %p.",
                           SRCNAME, __func__, m_object);
-               m_send_seen = false;
                break;
             }
           else
@@ -363,9 +360,8 @@ EVENT_SINK_INVOKE(MailItemEvents)
         {
           log_oom_extra ("%s:%s: AfterWrite : %p",
                          SRCNAME, __func__, m_mail);
-          if (m_send_seen)
+          if (m_mail->needs_encrypt ())
             {
-              m_send_seen = false;
               m_mail->encrypt_sign ();
               return S_OK;
             }

commit 38f98dfeb754ad4992c86ab295415c5346ca7bb6
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Dec 5 17:14:54 2016 +0100

    Add fallback to create categories
    
    * src/oomhelp.cpp (ensure_category_exists): Fallback to
    Session.Categories.
    
    --
    If there are not multiple sessions this fallback is needed
    t least for outlook 2007.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 49eaca5..9570eaf 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -1490,8 +1490,12 @@ ensure_category_exists (LPDISPATCH application, const char *category, int color)
       gpgol_release (store);
       if (!categories)
         {
-          TRACEPOINT;
-          continue;
+          categories = get_oom_object (application, "Session.Categories");
+          if (!categories)
+            {
+              TRACEPOINT;
+              continue;
+            }
         }
 
       auto count = get_oom_int (categories, "Count");

commit c774a46f5b59bc811452e643492d7fdddf933213
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Dec 5 17:12:56 2016 +0100

    Always initialize execpinfo
    
    * src/oomhelp.cpp (get_oom_object, put_oom_string),
    (add_oom_attachment, get_pa_variant, invoke_oom_method_with_parms):
    Initialize execepinfo.
    
    --
    It is not assured that invoke sets excepinfo. This might have
    lead to crashes in dump_excepinfo.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 1b23d75..49eaca5 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -181,6 +181,8 @@ get_oom_object (LPDISPATCH pStart, const char *fullname)
       unsigned int argErr = 0;
       EXCEPINFO execpinfo;
 
+      init_excepinfo (&execpinfo);
+
       if (pDisp)
         {
           gpgol_release (pDisp);
@@ -487,6 +489,7 @@ put_oom_string (LPDISPATCH pDisp, const char *name, const char *string)
   BSTR bstring;
   EXCEPINFO execpinfo;
 
+  init_excepinfo (&execpinfo);
   dispid = lookup_oom_dispid (pDisp, name);
   if (dispid == DISPID_UNKNOWN)
     return -1;
@@ -934,6 +937,7 @@ int get_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *rVariant)
   wchar_t *w_property;
   unsigned int argErr = 0;
 
+  init_excepinfo (&execpinfo);
   log_oom ("%s:%s: Looking up property: %s;",
              SRCNAME, __func__, dasl_id);
 
@@ -1128,6 +1132,7 @@ add_oom_attachment (LPDISPATCH disp, const wchar_t* inFileW,
   unsigned int argErr = 0;
   EXCEPINFO execpinfo;
 
+  init_excepinfo (&execpinfo);
   dispid = lookup_oom_dispid (attachments, "Add");
 
   if (dispid == DISPID_UNKNOWN)
@@ -1307,6 +1312,7 @@ invoke_oom_method_with_parms (LPDISPATCH pDisp, const char *name,
   if (dispid != DISPID_UNKNOWN)
     {
       EXCEPINFO execpinfo;
+      init_excepinfo (&execpinfo);
       DISPPARAMS dispparams = {NULL, NULL, 0, 0};
 
       hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,

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

Summary of changes:
 src/gpgoladdin.cpp       |  3 ++-
 src/mail.cpp             | 13 +++++++++++++
 src/mail.h               |  8 +++++++-
 src/mailitem-events.cpp  | 34 +++++++++++++++++++++++++++-------
 src/mapihelp.cpp         | 19 ++++++++-----------
 src/mapihelp.h           |  3 ++-
 src/mimemaker.cpp        | 13 +++++--------
 src/oomhelp.cpp          | 14 ++++++++++++--
 src/ribbon-callbacks.cpp |  4 +++-
 9 files changed, 79 insertions(+), 32 deletions(-)


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




More information about the Gnupg-commits mailing list