[git] GpgOL - branch, master, updated. gpgol-2.3.0-64-gd878480

by Andre Heinecke cvs at cvs.gnupg.org
Fri Sep 28 13:50:36 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, master has been updated
       via  d87848059727587be1f660283e0aeb3be16cc382 (commit)
       via  1182155ba3d186bb4437fef82693ab501277be39 (commit)
       via  2ccbfc0ace9f50c788d1e630215a5148aef8b9f5 (commit)
       via  b18f00540c1a78d7700f8cf8d48dbfbff3c1b83f (commit)
       via  13e84a8f612a793f19155779e4cdfc71c7a70d78 (commit)
       via  c186f2832294737ada9de6d23e466c106537676f (commit)
       via  8785d7e7777d749413432a5d294e4f3cc9588fa4 (commit)
      from  a20d413e04778f529f885d0ebe7adf7d7077d436 (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 d87848059727587be1f660283e0aeb3be16cc382
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Sep 28 13:45:08 2018 +0200

    Ignore Content-Id for Cnt-Disp: attachment
    
    * src/mimedataprovider.cpp (t2body): Ignore content-id.
    
    --
    This should hopefully cover all cases where attachments
    were hidden although they should have been shown. Outlook
    itself seems to make the difference based on Content-Disposition.
    
    According to documentation there are also ATTACH_FLAGS set
    in case an attachment is hidden due to MHTML embeds. But
    modifying those did not have an effect.
    
    GnuPG-Bug-Id: T4161

diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp
index ad09c62..01841da 100644
--- a/src/mimedataprovider.cpp
+++ b/src/mimedataprovider.cpp
@@ -189,6 +189,7 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg)
   char *filename = NULL;
   char *cid = NULL;
   char *charset = NULL;
+  bool ignore_cid = false;
 
   /* Figure out the encoding.  */
   ctx->is_qp_encoded = 0;
@@ -215,6 +216,14 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg)
         filename = rfc2047_parse (s);
       s = rfc822parse_query_parameter (field, NULL, 1);
 
+      if (s && strstr (s, "attachment"))
+        {
+          log_debug ("%s:%s: Found Content-Disposition attachment."
+                     " Ignoring content-id to avoid hiding.",
+                     SRCNAME, __func__);
+          ignore_cid = true;
+        }
+
       /* This is a bit of a taste matter how to treat inline
          attachments. Outlook does not show them inline so we
          should not put it in the body either as we have
@@ -269,13 +278,15 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg)
     }
 
   /* Parse a Content Id header */
-  p = rfc822parse_get_field (msg, "Content-Id", -1, &off);
-  if (p)
+  if (!ignore_cid)
     {
-       cid = xstrdup (p+off);
-       xfree (p);
+      p = rfc822parse_get_field (msg, "Content-Id", -1, &off);
+      if (p)
+        {
+           cid = xstrdup (p+off);
+           xfree (p);
+        }
     }
-
   /* Update our idea of the entire MIME structure.  */
   {
     mimestruct_item_t ms;

commit 1182155ba3d186bb4437fef82693ab501277be39
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Sep 28 13:43:41 2018 +0200

    Improve attachment add debug output
    
    * src/mail.cpp (fixup_last_attachment_o): Add a non working
    experiment. Improve debugging.
    * src/oomhelp.h (PR_ATTACH_FLAGS_DASL): New.
    
    --
    The experiment to remove the ATTACH_FLAGS should work in
    theory and according to documentation. In practice it does
    not work :-(
    But maybe we can figure this out later.

diff --git a/src/mail.cpp b/src/mail.cpp
index bef35de..9e1c8d2 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -643,7 +643,8 @@ copy_attachment_to_file (std::shared_ptr<Attachment> att, HANDLE hFile)
 /** Sets some meta data on the last attachment added. The meta
   data is taken from the attachment object. */
 static int
-fixup_last_attachment_o (LPDISPATCH mail, std::shared_ptr<Attachment> attachment)
+fixup_last_attachment_o (LPDISPATCH mail,
+                         std::shared_ptr<Attachment> attachment)
 {
   TSTART;
   /* Currently we only set content id */
@@ -661,9 +662,46 @@ fixup_last_attachment_o (LPDISPATCH mail, std::shared_ptr<Attachment> attachment
                  SRCNAME, __func__);
       TRETURN 1;
     }
+  const std::string cid = attachment->get_content_id ();
   int ret = put_pa_string (attach,
                            PR_ATTACH_CONTENT_ID_DASL,
-                           attachment->get_content_id ().c_str());
+                           cid.c_str());
+
+  log_debug ("%s:%s: Set attachment content id to: '%s'",
+             SRCNAME, __func__, anonstr (cid.c_str()));
+  if (ret)
+    {
+      log_error ("%s:%s: Failed.", SRCNAME, __func__);
+      gpgol_release (attach);
+    }
+#if 0
+
+  The following was an experiement to delete the ATTACH_FLAGS values
+  so that we are not hiding attachments.
+
+  LPATTACH mapi_attach = (LPATTACH) get_oom_iunknown (attach, "MAPIOBJECT");
+  if (mapi_attach)
+    {
+      SPropTagArray proparray;
+      HRESULT hr;
+
+      proparray.cValues = 1;
+      proparray.aulPropTag[0] = 0x37140003;
+      hr = mapi_attach->DeleteProps (&proparray, NULL);
+      if (hr)
+        {
+          log_error ("%s:%s: can't delete property attach flags: hr=%#lx\n",
+                     SRCNAME, __func__, hr);
+          ret = -1;
+        }
+      gpgol_release (mapi_attach);
+    }
+  else
+    {
+      log_error ("%s:%s: Failed to get mapi attachment.",
+                 SRCNAME, __func__);
+    }
+#endif
   gpgol_release (attach);
   TRETURN ret;
 }
@@ -730,6 +768,8 @@ add_attachments_o(LPDISPATCH mail,
 
       if (!err)
         {
+          log_debug ("%s:%s: Added attachment '%s'",
+                     SRCNAME, __func__, anonstr (dispName.c_str()));
           err = fixup_last_attachment_o (mail, att);
         }
       if (err)
diff --git a/src/oomhelp.h b/src/oomhelp.h
index 043276a..b922333 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -129,6 +129,9 @@ DEFINE_OLEGUID(IID_IOleWindow,                0x00000114, 0, 0);
   "http://schemas.microsoft.com/mapi/proptag/0x370E001F"
 #define PR_ATTACH_CONTENT_ID_DASL \
   "http://schemas.microsoft.com/mapi/proptag/0x3712001F"
+#define PR_ATTACH_FLAGS_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x37140003"
+
 #define PR_TAG_SENDER_SMTP_ADDRESS \
   "http://schemas.microsoft.com/mapi/proptag/0x5D01001F"
 #define PR_TAG_RECEIVED_REPRESENTING_SMTP_ADDRESS \

commit 2ccbfc0ace9f50c788d1e630215a5148aef8b9f5
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Sep 28 13:35:18 2018 +0200

    Fix error message in keycache lookup
    
    * src/keycache.cpp (do_update): Fix error / debug output.

diff --git a/src/keycache.cpp b/src/keycache.cpp
index b62884b..268accf 100644
--- a/src/keycache.cpp
+++ b/src/keycache.cpp
@@ -129,8 +129,9 @@ do_update (LPVOID arg)
     }
   if (err)
     {
-      log_debug ("%s:%s Failed to find key for %s err: ",
-                 SRCNAME, __func__, err.asString ());
+      log_debug ("%s:%s Failed to find key for %s err: %s",
+                 SRCNAME, __func__, anonstr (args->first.c_str()),
+                 err.asString ());
     }
   KeyCache::instance ()->onUpdateJobDone (args->first.c_str(),
                                           newKey);

commit b18f00540c1a78d7700f8cf8d48dbfbff3c1b83f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Sep 28 13:33:42 2018 +0200

    Ignore reads when shutdown was triggered
    
    * src/gpgoladdin.cpp (GpgolAddin::shutdown): Set state
    variable at begin of shutdown.
    * src/mailitem-events.cpp (BeforeRead): Ignore when
    shutting down.
    
    --
    This happened when we are closing and closing all mails
    but there are multiple inspectors around e.g. if the mail
    is open in Outlook Spy. In that case Outlook tries to read
    it again immediately after close.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 5f12ab8..acc1969 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -1192,6 +1192,7 @@ GpgolAddin::shutdown ()
       return;
     }
 
+  m_shutdown = true;
   /* Disabling message hook */
   UnhookWindowsHookEx (m_hook);
 
@@ -1225,7 +1226,6 @@ GpgolAddin::shutdown ()
                   _("GpgOL"),
                   MB_ICONINFORMATION|MB_OK);
     }
-  m_shutdown = true;
 
   gpgol_release (m_application);
   m_application = nullptr;
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index b02ad0e..7a741c0 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -173,6 +173,13 @@ EVENT_SINK_INVOKE(MailItemEvents)
         {
           log_oom ("%s:%s: BeforeRead : %p",
                          SRCNAME, __func__, m_mail);
+          if (GpgolAddin::get_instance ()->isShutdown())
+            {
+              log_debug ("%s:%s: Ignoring read after shutdown.",
+                         SRCNAME, __func__);
+              TBREAK;
+            }
+
           if (m_mail->preProcessMessage_m ())
             {
               log_error ("%s:%s: Pre process message failed.",

commit 13e84a8f612a793f19155779e4cdfc71c7a70d78
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Sep 28 13:32:31 2018 +0200

    Fix potential crash in revert
    
    * src/revert.cpp (gpgol_mailitem_revert): Bail out if
    msg class is NULL.
    
    --
    This happened to me in a weird close scenario where I
    had multiple outlook spy windows open.

diff --git a/src/revert.cpp b/src/revert.cpp
index bd0b647..2b5db94 100644
--- a/src/revert.cpp
+++ b/src/revert.cpp
@@ -96,6 +96,10 @@ gpgol_mailitem_revert (LPDISPATCH mailitem)
   msgcls = get_pa_string (mailitem, PR_MESSAGE_CLASS_W_DASL);
   log_debug ("%s:%s: message class is `%s'\n",
              SRCNAME, __func__, msgcls? msgcls:"[none]");
+  if (!msgcls)
+    {
+      return -1;
+    }
   if ( !( !strncmp (msgcls, "IPM.Note.GpgOL", 14)
           && (!msgcls[14] || msgcls[14] == '.') ) )
     {

commit c186f2832294737ada9de6d23e466c106537676f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Sep 26 15:47:48 2018 +0200

    Show signer KeyID and UserID for valid mails
    
    * src/mail.cpp (Mail::updateSigFlag_o): Set the flag.
    (Mail::flagChangeTriggered): New helper to carry the state.
    (pretty_id): Helper to format a fingerprint / long keyid.
    * src/mailitem-events.cpp (PropertyChange): Ignore our
    own changes.
    
    --
    This has two purposes. If the name of the sender is large
    or looks like a mail address it is not visible at first
    glance which key was used to verify as the real mail
    address might be out of the screen.
    
    Additionally this serves as another split between the
    Verified Sender category and the body to make it even
    harder to undetectable fake this through HTML. It
    is never possible to fake it or replace it together
    with the changed status icon.

diff --git a/src/mail.cpp b/src/mail.cpp
index d3b0f0d..bef35de 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -104,7 +104,8 @@ Mail::Mail (LPDISPATCH mailitem) :
     m_first_autosecure_check(true),
     m_locate_count(0),
     m_is_about_to_be_moved(false),
-    m_locate_in_progress(false)
+    m_locate_in_progress(false),
+    m_flag_change_triggered(false)
 {
   TSTART;
   if (getMailForItem (mailitem))
@@ -1408,6 +1409,10 @@ Mail::parsing_done()
   updateCategories_o ();
 
   TRACEPOINT;
+  /* Show the signers uid as a flag */
+  updateSigFlag_o ();
+  TRACEPOINT;
+
   m_block_html = m_parser->shouldBlockHtml ();
 
   if (m_block_html)
@@ -2238,6 +2243,84 @@ Mail::updateCategories_o ()
   TRETURN;
 }
 
+static std::string
+pretty_id (const char *keyId)
+{
+  /* Three spaces, four quads and a NULL */
+  char buf[20];
+  buf[19] = '\0';
+  if (!keyId)
+    {
+      return std::string ("null");
+    }
+  size_t len = strlen (keyId);
+  if (!len)
+    {
+      return std::string ("empty");
+    }
+  if (len < 16)
+    {
+      return std::string (_("Invalid Key"));
+    }
+  const char *p = keyId + (len - 16);
+  int j = 0;
+  for (size_t i = 0; i < 16; i++)
+    {
+      if (i && i % 4 == 0)
+        {
+          buf[j++] = ' ';
+        }
+      buf[j++] = *(p + i);
+    }
+  return std::string (buf);
+}
+
+void
+Mail::updateSigFlag_o ()
+{
+  TSTART;
+  if (isValidSig ())
+    {
+      char *buf;
+      /* Resolve to the primary fingerprint */
+      const auto sigKey = KeyCache::instance ()->getByFpr (m_sig.fingerprint (),
+                                                           true);
+      const char *sigFpr;
+      if (sigKey.isNull())
+        {
+          sigFpr = m_sig.fingerprint ();
+        }
+      else
+        {
+          sigFpr = sigKey.primaryFingerprint ();
+        }
+
+      gpgrt_asprintf (&buf, "%s: %s (%s)", _("Signer"), m_uid.email(),
+                      pretty_id (sigFpr).c_str ());
+      memdbg_alloc (buf);
+      log_debug ("%s:%s: Setting signer flag %s",
+                 SRCNAME, __func__, anonstr (buf));
+      m_flag_change_triggered = true;
+      put_oom_string (m_mailitem, "FlagRequest", buf);
+      m_flag_change_triggered = false;
+      xfree (buf);
+    }
+  else
+    {
+      char *flag = get_oom_string (m_mailitem, "FlagRequest");
+      if (flag && (strstr (flag, _("Signer")) || strstr (flag, "Signer")))
+        {
+          m_flag_change_triggered = true;
+          log_debug ("%s:%s: Removing flag containting Signer.",
+                     SRCNAME, __func__);
+          put_oom_string (m_mailitem, "FlagRequest", "");
+          m_flag_change_triggered = false;
+        }
+      xfree (flag);
+    }
+  TRETURN;
+}
+
 bool
 Mail::isSigned () const
 {
diff --git a/src/mail.h b/src/mail.h
index c4f2369..d925dde 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -598,7 +598,11 @@ public:
   /* Gets an additional reference for GetInspector.CurrentItem */
   void refCurrentItem ();
 
+  /* Check if a flag change was triggered and can be ignored. */
+  bool flagChangeTriggered () const { return m_flag_change_triggered; }
+
 private:
+  void updateSigFlag_o ();
   void updateCategories_o ();
   void updateSigstate ();
 
@@ -649,5 +653,6 @@ private:
   int m_locate_count; /* The number of key locates pending for this mail. */
   bool m_is_about_to_be_moved;
   bool m_locate_in_progress; /* Simplified state variable for locate */
+  bool m_flag_change_triggered; /* We trigger a flagrequest change */
 };
 #endif // MAIL_H
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 31acc40..b02ad0e 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -263,6 +263,14 @@ EVENT_SINK_INVOKE(MailItemEvents)
                   TRETURN S_OK;
                 }
             }
+          if (m_mail->flagChangeTriggered () &&
+              (!wcscmp (prop_name, L"FlagStatus") || !wcscmp (prop_name, L"FlagRequest") ||
+               !wcscmp (prop_name, L"FlagIcon") || !wcscmp (prop_name, L"FlagDueBy")))
+            {
+              log_oom ("%s:%s: Message %p propchange: %ls was requested.",
+                       SRCNAME, __func__, m_object, prop_name);
+              TRETURN S_OK;
+            }
           log_oom ("%s:%s: Message %p propchange: %ls.",
                    SRCNAME, __func__, m_object, prop_name);
 

commit 8785d7e7777d749413432a5d294e4f3cc9588fa4
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Sep 26 15:46:52 2018 +0200

    Add sender name and repr name DASL
    
    * src/oomhelp.h: Add new defines.
    
    --
    We do not need them right now but I've used them for experiments.

diff --git a/src/oomhelp.h b/src/oomhelp.h
index 1882057..043276a 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -140,6 +140,11 @@ DEFINE_OLEGUID(IID_IOleWindow,                0x00000114, 0, 0);
 #define PR_SENT_REPRESENTING_EMAIL_ADDRESS_W_DASL \
   "http://schemas.microsoft.com/mapi/proptag/0x0065001F"
 
+#define PR_SENDER_NAME_W_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x0C1A001F"
+#define PR_SENT_REPRESENTING_NAME_W_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x0042001F"
+
 #define DISTRIBUTION_LIST_ADDRESS_ENTRY_TYPE 11
 
 typedef std::shared_ptr<IDispatch> shared_disp_t;

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

Summary of changes:
 src/gpgoladdin.cpp       |   2 +-
 src/keycache.cpp         |   5 +-
 src/mail.cpp             | 129 +++++++++++++++++++++++++++++++++++++++++++++--
 src/mail.h               |   5 ++
 src/mailitem-events.cpp  |  15 ++++++
 src/mimedataprovider.cpp |  21 ++++++--
 src/oomhelp.h            |   8 +++
 src/revert.cpp           |   4 ++
 8 files changed, 178 insertions(+), 11 deletions(-)


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




More information about the Gnupg-commits mailing list